Solve the ODE : $(x\sin(y)+y\cos(y))dx+(x\cos(y)-y\sin(y))dy=0$ $$(x\sin(y)+y\cos(y))dx+(x\cos(y)-y\sin(y))dy=0$$
I tried this:
$$y'=-\frac{x\sin(y)+y\cos(y)}{x\cos(y)-y\sin(y)} = -\frac{\frac{x}{y}\tan(y)+1}{\frac{x}{y}-\tan(y)}$$
This looks like substitution to me, but I'm not sure what to substitute.
Any help is appreciated! Thanks.
 A: You need to find an integrating factor, such that your equation becomes exact. More specifically : 
$$(x\sin(y)+y\cos(y))dx+(x\cos(y)-y\sin(y))dy=0 $$
$$\Leftrightarrow$$
$$(x\sin(y)+y\cos(y))+(x\cos(y)-y\sin(y))\frac{dy}{dx}=0$$
Let :
$$R(x,y)= x\sin(y) + y\cos(y)$$
$$\text{and}$$
$$S(x,y)= x\cos(y) - y\sin(y)$$
This is not an exact equation, as mentioned above, because it is : 
$$R_y(x,y)\neq S_x(x,y)$$
So, you need to find an integrating factor, such that : 
$$\frac{d}{dy} \left( μ(x)R(x,y) \right)= \frac{d}{dx} \left( μ(x)S(x,y) \right)$$
$$\Rightarrow$$
$$(\cos(y) + x\cos(y)-y\sin(y))μ(x) = μ'(x)(x\cos(y) - y\sin(y)) + μ(x)\cos(y)$$
$$\Leftrightarrow$$
$$\frac{μ'(x)}{μ(x)}=1 \Rightarrow \ln(μ(x))=x \Leftrightarrow μ(x) = e^x$$
Check now, as we did initially, that the given equation is exact (I'll leave this to you). 
Now, we need to define a function $f(x,y)$ such that : 
$$f_x(x,y) = P(x,y)=e^x(x\sin(y) + y\cos(y))\quad\text{and} \quad f_y(x,y) = Q(x,y)=e^x(x\cos(y)-y\sin(y)+\cos(y))$$
Then, the solution will be given by $f(x,y)=c_1$ where $c_1$ is an arbitrary constant.
By integrating by respect to each variable, we get (I'll leave the analytic calculations of the integrations to you) : 
$$\int f_x(x,y)dx = \dots = g(y) + e^x(y\cos(y) + (x-1)\sin(y)) $$
where $g(y)$ is an arbitrary function of $y$.
Let's differentiate $f(x,y)$ in order to find $g(y)$ :
$$\frac{\partial f}{\partial y}(x,y)=\dots = \frac{dg(y)}{dy} + e^x(\cos(y) + (x-1)\cos(y) - y\sin(y))$$
Substitute in $f_y(x,y) = Q(x,y)$ and after some calculations (which I'll also leave to you) , you'll get to :
$$\frac{dg(y)}{dy}=0 \Rightarrow g(y) = 0$$
which means that : 
$$f(x,y) = e^x(y\cos(y) + (x-1)\sin(y))$$
and since we've assumed the solution to be of the form $f(x,y)=c_1$ then the solution $y(x)$ is  given by : 
$$e^x(y\cos(y(x)) + (x-1)\sin(y(x)))=c_1$$
Sorry for leaving a lot of calculations to the reader (you) but it was a long solution. 
