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.
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?
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?