How do I solve the following differential equation: $2xy + 1 + (x^2 + 2y)y' = 0$ I am struggling to solve the following differential equation. We are given the following: $$2xy + 1 + (x^2 + 2y)y' = 0,\;\;\;y(1) = -1.$$
So far, I tried moving the third term to the right side but I do not see how I could possibly use Separable Equation method to solve it. Perhaps, there is another method that I may be missing and I would appreciate any hint on how to move forward with this equation. Thank you.
 A: Note that
$$2xy+x^2y'+2yy'=\frac{d}{dx}(x^2y+y^2).$$
So the equation is equivalent to:
$$\frac{d}{dx}(x^2y+y^2)=-1$$
$$\implies x^2y+y^2=-x+C$$
$$\implies y=\frac{-x^2\pm \sqrt{x^4-4x+4C}}{2}$$
$$y(1)=\frac{-1\pm\sqrt{4C-3}}{2}=-1 \implies C=1$$
Since at $x=1$ the $\pm$ is $-$, and $y$ is differentiable at any point, the $\pm$ will always be $-$ at any point.
$$\therefore y=\frac{-x^2 - \sqrt{x^4-4x+4}}{2}$$
A: Your differential equation is an exact differential equation. Indeed, you can check that $I(x, y) = 2xy + 1$ and $J(x, y) = x^2 + 2y$ are both continuously differentiable everywhere and
$$ \frac{\partial I}{\partial y} = 2x = \frac{\partial J}{\partial x}. $$
A general solution to an exact differential equation is $F(x, y) = C$ for constants $C$ (i.e., level curves of $F(x, y)$), where $F(x, y)$ is a potential function satisfying $\dfrac{\partial F}{\partial x} = I(x, y)$ and $\dfrac{\partial F}{\partial y} = J(x, y)$. Integrating $I(x, y)$ with respect to $x$, we obtain
$$ F(x, y) = x^2y + x + m(y). $$
Integrating $J(x, y)$ with respect to $y$, we obtain
$$ F(x, y) = x^2y + y^2 + n(x). $$
Equating the two expressions for $F(x, y)$, we see that
$$ x^2y + x + m(y) = x^2y + y^2 + n(x) \implies m(y) = y^2 \ \ \textrm{ and } \ \ n(x) = x. $$
Thus, a general solution to your differential equation is
$$ F(x, y) = x^2y + x + y^2 = C. $$
To find $C$, we impose the given initial condition $y(1) = -1$:
$$ -1 + 1 + 1 = 1 = C. $$
Thus, an implicit solution to your exact differential equation is
$$ x^2y + x + y^2 = 1. $$
