# How to solve $y' + y^2 - 2y\sin x + \sin^2x = \cos x$

How to solve the following equation? $$y' + y^2 - 2y\sin x + \sin^2x = \cos x$$

It is necessary to determine the type and total solution. Help me please.

## 1 Answer

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

Say $z=y- \sin x$
Then $\frac{dz}{dx}= y'-\cos x$

So we have $$\frac{dz}{dx}+z^2=0$$ $$\int z^{-2} dz = -\int dx$$ $$\frac{1}{z}=x+c$$ $$\frac{1}{y- \sin x}=x+c$$ $$y = \sin x + \frac{1}{x+c}$$

This is the required solution.