Example 2. Solve the equation $x e^{y} d x+\left(y+y x^{2}\right) d y=0$.
Solution. By factoring out, we transform the equation into a separable equation: $x e^{y} d x+y\left(1+x^{2}\right) d y=0$. We divide term by term by $\left(1+x^{2}\right) e^{y}$. We obtain the equation with separated variables: $\frac{x d x}{1+x^{2}}+y e^{-y} d y=0$. We integrate (the second term by parts): $\int \frac{d\left(1+x^{2}\right)}{2\left(1+x^{2}\right)}+\int y e^{-y} d y=C ; \ln \sqrt{1+x^{2}}-(y+1) e^{-y}=C$. We have obtained the general integral, or the general solution in implicit form.

Answer. $\ln \sqrt{1+x^{2}}-(y+1) e^{-y}=C$.