# Find the solution of the given differential equation: dy/dx+(cosx)y=2xy where y(0)=-2

Printable View

• Apr 19th 2011, 09:57 PM
Taurus3
Find the solution of the given differential equation: dy/dx+(cosx)y=2xy where y(0)=-2
Find a solution to the given differential equation: y'+(cosx)y=2xy where y(0)=-2

Let p(x)=cosx
Let g(x)=2xy
Let mu(x)=e^(integral of cosx)=e^sinx
e^sinx(y')+e^sinx(cosx)y=e^sinx(2xy)
Integral of (e^sin(x)y)' dx= Integral of e^(sinx)2xy dx
But then I realized I couldn't further simplify the integral on the right hand side. So how do I find C?
• Apr 19th 2011, 10:07 PM
Prove It
If you rewrite this as

y' = [2x - cos(x)]y

y'/y = 2x - cos(x)

the equation is separable.

Alternatively you can write it as

y' + [cos(x) - 2x]y = 0

and use the Integrating Factor method since it's also first-order linear.
• Apr 19th 2011, 10:10 PM
Taurus3
never mind. I got it using separation of variables.
• Apr 19th 2011, 10:14 PM
Prove It
You're welcome ><
• Apr 19th 2011, 10:28 PM
Taurus3
So if I use separation of variables:
dy/dx+(cosx)y=2xy
dy/dx=2xy-(cosx)y
dy/dx=y(2x-cosx)
(1/y)dy=(2x-cosx)dx
ln (absolute y)+K=x^2-sinx+C
e^(x^2-sinx+C)= absolute y

2=e^(0+sin(0)+c) (-2 becomes 2 since it's absolute value)
2=e^(c)
c=ln(absolute value 2)
So plugging it back in: ln(absolute y)=x^2-sinx+ln(absolute 2)
e^(x^2-sinx+ln(absolute 2))=y. FINAL ANSWER. IS IT RIGHT?
• Apr 19th 2011, 10:32 PM
Prove It
It's correct, but you can clean it up a lot more... ln|2| = ln(2) for example...

Also remember that e^(a + b) = (e^a)(e^b), which means you should be able to simplify the e^ln(2) part...
• Apr 19th 2011, 10:45 PM
Taurus3
wait. I've a question. If I plug in 0 for x. Then I would get e^(ln2), which is positive 2. But the given value of y is -2. What did I do wrong?
• Apr 19th 2011, 10:47 PM
Prove It
It's because you're getting back |y|, not y...
• Apr 19th 2011, 11:03 PM
Taurus3
gotcha.