Example 2. Solve the equation $\left(x+y^{2}\right) d x-2 x y d y=0$.
Solution. We have $P=x+y^{2}, Q=-2 x y, \frac{\partial P}{\partial y}=2 y, \frac{\partial Q}{\partial x}=-2 y$.

The equation is not an exact differential equation. The expression $\left(\frac{\partial P}{\partial y}-\frac{\partial Q}{\partial x}\right) \frac{1}{Q}=-\frac{2}{x}$ depends only on the variable $x$, so according to point $2^{\circ}$ (case 1), the equation admits an integrating factor $\mu(x)$, which depends on $x: \ln \mu(x)=-\int \frac{2}{x} d x=-2 \ln x, \mu(x)=\frac{1}{x^{2}}$. Multiply the original equation term by term by the factor $\mu=x^{-2}$. We obtain the new equation $\left(x+y^{2}\right) x^{-2} d x-2 y x^{-1} d y=0$. Now we have $P=\left(x+y^{2}\right) x^{-2}, Q=-2 y x^{-1}, \frac{\partial P}{\partial y}=\frac{\partial Q}{\partial x}=2 y x^{-2}$, i.e., the equation is an exact differential equation.

We find the function $u(x, y)$ such that $\frac{\partial u}{\partial x}=P=\frac{x+y^{2}}{x^{2}}, \frac{\partial u}{\partial y}=Q=$ $=-\frac{2 y}{x}$. From the first equality, we find $u=\int \frac{x+y^{2}}{x^{2}} d x=\ln |x|-\frac{y^{2}}{x}+$ $+\varphi(y)$

Differentiate this function with respect to $y$ and equate it to $Q: \frac{\partial u}{\partial y}=$ $=-\frac{2 y}{x}+\varphi^{\prime}(y)=-\frac{2 y}{x}$. Hence $\varphi^{\prime}(y)=0$, i.e., $\varphi(y)$ does not depend on $y$. We can take $\varphi(y)=0$. Then $u(x, y)=\ln |x|-\frac{y^{2}}{x}$.

Answer. $\ln |x|-\frac{y^{2}}{x}=C$.