Integrating factor not making ODE exact

$\cos^2(y)\sin(x)+y'\sin(y)\cos(x)=0$

$h(x)=\frac{1}{\cos^2(x)\sin(x)}(-\sin(y)\sin(x)+2\cos(y)\sin(y)\sin(x))$

Then the integrating factor is:

$e^{\int{\frac{2\sin(y)}{\cos(y)}-\frac{\sin(y)}{\cos^2(y)}\,dx}}=\frac{\sec^2(x)}{e^{\sec(x)}}$

But when I differentiate the new $M(x,y)$ and $N(x,y)$ I don't get that they are equal, and therefore exact ODE.

I'm failing to see my mistake in the above calculations, I've reviewed a couple of times already.

• This is part of a list of exercises, I'm training this method, but I appreciate your tip, definitely trying this later. – João Pedro Sep 30 '16 at 1:06
• Yes, after I find the integrating factor I multiply both M and N by it. Then I have a new M and N, and their partial derivative in respect to y and x are suppose to be equal. – João Pedro Sep 30 '16 at 1:49
• No. That's my point, I can't figure out where I made an error. I reviewed it a few times and I can't find my mistake. – João Pedro Sep 30 '16 at 2:10

1 Answer

Using your Integrating Factor (which is correct), we have:

$$\sin x~ e^{-\sec y} + (\cos x ~\sec y ~\tan y~e^{-\sec y} ) y' = 0$$

From this, we want to check if it is exact:

$$M = \sin x~e^{-\sec y} \implies M_y = -\sin x ~\sec y ~\tan y ~e^{-\sec y} \\ N = \cos x~ \sec y ~\tan y~ e^{-\sec y} \implies N_x = -\sin x ~\sec y~ \tan y ~e^{-\sec y}$$

We have $M_y = N_x$ as needed.