Solve the differential equation cos(x)dy/dx+y=sin(x) given that Y=2 when X=0 ?

1 Answer
Jun 26, 2018

y= 1-((x-1)cosx)/(1+sinx)y=1(x1)cosx1+sinx

Explanation:

For x != pi/2 + kpixπ2+kπ divide by cosxcosx:

dy/dx +y secx = tanxdydx+ysecx=tanx

Solve first the homogeneous equation:

dy/dx + ysecx= 0dydx+ysecx=0

which is separable:

dy/dx = -ysecxdydx=ysecx

dy/y = - secxdxdyy=secxdx

int dy/y = -int secxdxdyy=secxdx

lnabs y = -ln abs(secx+tanx) +Cln|y|=ln|secx+tanx|+C

y = c/(secx+tanx)y=csecx+tanx

Using the method of variable coefficient look now for a particular solution of the complete equation in the form:

bar y = (c(x))/ (secx+tanx)¯y=c(x)secx+tanx

(dbary)/dx = (c'(x) (secx+tanx) -c(x)(secxtanx +sec^2x))/(secx+tanx)^2

(dbary)/dx = (c'(x) (secx+tanx) -secx c(x)(secx +tanx))/(secx+tanx)^2

(dbary)/dx = (c'(x) -secx c(x))/(secx+tanx)

Substitute in the complete equation:

(dbary)/dx +ysecx = tanx

(c'(x) -secx c(x))/(secx+tanx)+(c(x) secx)/(secx+tanx) = tanx

(c'(x))/(secx+tanx)= tanx

c'(x)= secxtanx+tan^2x

Using the trigonometric identity: tan^2x = sec^2x-1

c'(x)= secxtanx+sec^2x-1

c(x) = int (secxtanx+sec^2x-1)dx

c(x) = secx+tanx -x +c_1

Choose the solution for c_1 =0:

bary = (secx+tanx -x)/(secx+tanx) = 1-x/(secx+tanx)

The complete solution is then:

y = c/(secx+tanx) -x/(secx+tanx) +1

y= 1-(x-c)/(secx+tanx)

In fact:

dy/dx = ((x-c)secx-1)/(secx+tanx)

cosx dy/dx +y =((x-c)-cosx)/(secx+tanx)+1-(x-c)/(secx+tanx) =

:. = 1- cosx/(secx+tanx)

:. = (secx+tanx- cosx)/(secx+tanx)

:. = (1+sinx- cos^2x)/(1+sinx)

:. = (sin^2x+sinx)/(1+sinx) = sinx

Note that we can write the general solution also as:

y= 1-((x-c)cosx)/(1+sinx)

If we let x=0 then:

y(0) = 1+c

so that from the initial condition:

y(0) = 2 we get c=1.

y= 1-((x-1)cosx)/(1+sinx)