How to find the general solution for this ODE? I'm really stuck on how to go about solving the following first order ODE; I've got little idea on how to approach it, and I'd really appreciate if someone could give me some hints and/or working for a solution so I can have a reference point on how to approach these sorts of problems.
The following is one of many ODE's I've gotten off a problem set I found in a textbook at a library:
$$y' = xe^{-\sin(x)} - y\cos(x)$$
Can anyone help?

This kind of ODE should be solved as follows:


*

*Solve the corresponding homogeneous equation.


In your case it is $y'+y\cos(x)=0$ which has solution $y=c\cdot e^{-\sin(x)}$.


*Consider constant in previous solution as a function of variable $x$ and substitute it in original equation.


So, we have $y(x)=c(x)\cdot e^{-\sin(x)}$ and should substitute it into $y'+y\cos(x) = xe^{-\sin(x)}$.
This leads us to general solution in the form of $y(x) = \frac{1}{2}x^2e^{-\sin(x)}+ce^{-\sin(x)}$. 
