Stuck on finding the integrating factor for an exact differential equation.

The following DV is given $\sin(y)\cos(x) + \cos(y)[\sin(y)-\sin(x)]y'=0$ where $y$ is a function of $x$. This is in the form $M(x,y(x))+N(x,y(x))y'=0.$ This equation is not exact. To make it exact I have to calculate the integrating factor $\mu(x)$. Now when I use the formula $(M_y-N_x)/N$ to find the integrating factor, I get the expression $2\cos(x)/(\sin(y)-\sin(x))$ which is not only depending on $x$ or $y$. The problem states that there should be an integrating factor so what am I doing wrong. Can someone help me out?

• Try deriving the formula for the integrating factor from first principles. It's an important technique, especially for Poisson's equation and others you find in physics. – TurlocTheRed Sep 24 '18 at 16:04

The method that appealed to me was to spot that the substitutions $u=\sin y$, $v=\sin x$ leads to a homogeneous differential equation which can be made variables separable by letting $v=wu$. But since you insist on doing it the hard way, assume our integrating factor depends only on $y$: $\mu=\mu(y)$. Then the differential equation reads $$\mu(y)M(x,y)+\mu(y)N(x,y)\frac{dy}{dx}=0$$ To be exact, $$\frac{\partial}{\partial y}\left[\mu(y)M(x,y)\right]=\frac{\partial}{\partial x}\left[\mu(y)N(x,y)\right]$$ $$\frac{d\mu}{dy}M(x,y)+\mu(y)\frac{\partial M}{\partial y}=\mu(y)\frac{\partial N}{\partial x}$$ $$\frac1{\mu}\frac{d\mu}{dy}=\frac{\frac{\partial N}{\partial x}-\frac{\partial M}{\partial y}}M=\frac{-\cos x\cos y-\cos x\cos y}{\sin y\cos x}=-2\cot y$$ On integration, $$\ln|\mu|=-2\ln|\sin y|+C_1$$ $$\mu(y)=\frac{\pm e^{C_1}}{\sin^2y}$$ So we choose $\mu(y)=\csc^2y$ and now we have $$\left(\frac1{\sin y}-\frac{\sin x}{\sin^2y}\right)\cos y \frac{dy}{dx}+\frac{\cos x}{\sin y}=0$$ This is exact and integrates to $$\frac{\sin x}{\sin y}+\ln|\sin y|=C_2$$