Did I do this First order linear differential equation right?

y'-ytanx = 2xsinxcosx
Ok so I was told I.F. = #e^(intF(x))#
and I got y=cosx(sinx-xcosx)+C
Is this right? If not, please help me?

2 Answers
May 29, 2018

#y(x) = \frac{\tan (x)}{2}+\frac{1}{18} \sin (3 x)\sec(x)-\frac{2}{3} x \cos ^2(x)+C\sec x#

Explanation:

The integrating factor for a linear first order equation

#dy/dx +P(x) y= Q(x)#

is given by #e^{int P(x)dx}#

For our case #P(x) = -tan x# and #Q(x) = 2x sin x cos x#

Thus the integrating factor is

#e^{int (-tan x) dx} = e^{-ln sec x} = cos x#

Thus, we multiply both sides of the equation by #cos x#

This yields

#cos x dy/dx-y sin x = 2xsin xcos^2x#

The left hand side is

#cos x dy /dx +y d/dx (sin x) = d/dx(y cos x)#

and this means that

#y cos x = int 2 x sin s cos^2 x dx#

The integral can be evaluated easily by integration by parts to yield

#y cos x = \frac{\sin (x)}{2}+\frac{1}{18} \sin (3 x)-\frac{2}{3} x \cos ^3(x)+C#

and thus the solution is

#y(x) = \frac{\tan (x)}{2}+\frac{1}{18} \sin (3 x)\sec(x)-\frac{2}{3} x \cos ^2(x)+C\sec x#

May 29, 2018

# y = -2/3xcos^2x + 2/3tanx - 2/9sin^3xsecx + Csecx #

Explanation:

We have:

# y'-ytanx = 2xsinxcosx #

We can use an integrating factor when we have a First Order Linear non-homogeneous Ordinary Differential Equation of the form;

# dy/dx + P(x)y=Q(x) #

So, we can put the equation in standard form:

# y' - (tanx)y = 2xsinxcosx #

Then the integrating factor is given by;

# I = e^(int P(x) dx) #
# \ \ = exp(int \ -tanx) \ dx) #
# \ \ = exp(-lnsecx) #
# \ \ = exp(lncosx) #
# \ \ = cosx #

And if we multiply the DE [A] by this Integrating Factor, #I#, we will have a perfect product differential (in fact the original equation);

# :. cosxy' - cosx(tanx)y = cosx 2xsinxcosx # #

# :. cosxy' - sinxy = 2xsinxcos^2x #

# :. d/dx (cosx \ y) = 2xsinxcos^2x #

This is now separable, so by "separating the variables" we get:

# cosx \ y = int \ 2x \ sinx \ cos^2x \ dx#

Now, consider the integral:

# I = int \ 2x \ sinx \ cos^2x \ dx #

We can then apply Integration By Parts:

Let # { (u,=2x, => (du)/dx,=2), ((dv)/dx,=sinx \ cos^2x, => v,=-1/3cos^3x ) :}#

Then plugging into the IBP formula:

# int \ (u)((dv)/dx) \ dx = (u)(v) - int \ (v)((du)/dx) \ dx #

We have:

# int \ (2x)(sinx \ cos^2x) \ dx = (2x)(-1/3cos^3x) - int \ (-1/3cos^3x)(2) \ dx #

# :. I = -2/3xcos^3x + 2/3 \ int \ cos^3x \ dx #

So, next we must consider the integral:

# I_1 = int \ cos^3x \ dx #
# \ \ \ = int \ cosx \ cos^2x \ dx #
# \ \ \ = int \ cosx \ (1-sin^2x) \ dx #
# \ \ \ = int \ cosx \ dx - int \ cosx \ sin^2x \ dx #
# \ \ \ = sinx - 1/3sin^3x #

Combining these results, we have

# I = -2/3xcos^3x + 2/3 {sinx - 1/3sin^3x} #
# \ \ = -2/3xcos^3x + 2/3sinx - 2/9sin^3x #

So that, returning to the DE, we have:

# cosx \ y = -2/3xcos^3x + 2/3sinx - 2/9sin^3x + C #

# :. y = 1/cosx{-2/3xcos^3x + 2/3sinx - 2/9sin^3x + C} #

# :. y = -2/3xcos^2x + 2/3tanx - 2/9sin^3xsecx + Csecx #