Differential Equation

Please help. Been staring at it for a few hours now.

cosysin2xdx +(cos^2y - cos^2x)dy = 0

The equation is not exact, but can be made so by using a special integrating factor. If we write it as:

$$M(x,y) dx + N(x,y) dy=0$$

then...

$$\frac{dM}{dy} = -\sin (y) \sin (2x)$$

and...

$$\frac{dN}{dx}= -2(-\sin (x) \cos (x)) = \sin (2x)$$

So

$$\frac{N_x - M_y}{M} = \frac{1+\sin (y)}{\cos (y)}$$

which depends on $y$ alone. Setting $u(y) = e^{\int \frac{N_x - M_y}{M} dy}$ gives

$$u(y) = \frac{1+\sin (y)}{\cos^2(y)}$$

where we used some trigonometric identities to get this convenient form.

Multiplying through by $u(y)$ gives:

$$u(y)M(x,y) dx + u(y)N(x,y) dy = 0$$

If we call $u(y)M(x,y) = F(x,y)$ and $u(y)N(x,y)=G(x,y)$, then...

$$\frac{dF}{dy} =\frac{\sin (2x) +\sin (2x) \sin (y)}{\cos^2 (y)} = \frac{dG}{dx}$$

and the new equation is exact. So, there exists a function $f(x,y)$ such that...

$\frac{df}{dx} = F$ and $\frac{df}{dy} = G$ and all solutions are of the form

$$f(x,y)=C$$

Now...

$$f(x,y) = \int F(x,y) dx = -\cos^2(x) \frac{1+\sin(y)}{\cos(y)} +g(y)$$

where $g(y)$ is a constant of integration. Taking the partial of this with respect to $y$ and comparing it to $G(x,y)$ (which must also be the partial of $f$ with respect to $y$) gives...

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

so that $g ' (y) = 1+\sin(y)$. It follows that

$$g(y) = y-\cos(y)$$

We omit the constant of integration because we'll set our solution $f$ to a constant. Then

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

and all solutions are defined implicitly by

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

If you prefer, you can multiply through by $\cos (y)$ and write the solutions as

$$\color{green}{y \cos (y) - \cos^2 (y) - (1+sin(y)) cos^2(x) - C cos(y) = 0} $$

Alternate solutions are encouraged....