How to solve $(x^2 + 2xy)y' = 2(xy + y^2)$, with $y(1) = 1$ I've just started learning differential equations(so far I've learnt about separate variables and homogeneous equations) and I'm trying to solve an exercise that is listed as an example for a homogeneous equations. I substituted $\cfrac yx$ for $u$ and after I integrated the equation I still can't get the value of $u$. 
This is the exercise:

$(x^2  + 2xy)y' = 2(xy + y^2)$

$y(1) = 1$

$y' = 2(xy+y^2)/(x^2 + 2xy)$

$\cfrac yx = u =&gt; y = xu $

$u +xu' = 2(u + u^2)/(1+2u) $

$xu' = u/(1+2u)$

$u' = u/((1+2u)x)$

Knowing that u' = du/dx

$(1 + 2u)/u du = 1/x dx$

After integration I got the following:

$\ln(|u|) + 2u = \ln(|x|) + c$

$y(1) = 2 =&gt; c = \ln2 + 4$

I may have messed up somewhere. What is the easiest way to solve this problem?
$$(x^2  + 2xy)y' = 2(xy + y^2)$$
I cannot see an easier way that what you did. Your solution $\quad \ln|u|+2u=\ln|x|+c\quad$ is correct.

And with condition $y(1)=1\quad\implies\quad c=2\quad\implies\quad ue^{2u}=e^2x$

Nevertheless it is possible to go a bit further, thanks to the Lambert W function : http://mathworld.wolfram.com/LambertW-Function.html

$$2ue^{2u}=2e^2x \quad\implies\quad 2u=W\left(2e^2x  \right)\quad\implies\quad u=\frac12\: W\left(2e^2x  \right)$$
$$y(x)=\frac{x}{2}\: W\left(2e^2x  \right)$$
$$(x^2  + 2xy)y' = 2(xy + y^2)$$
I cannot see an easier way that what you did. Your solution $\quad \ln|u|+2u=\ln|x|+c\quad$ is correct.

And with condition $y(1)=1\quad\implies\quad c=2\quad\implies\quad ue^{2u}=e^2x$

Nevertheless it is possible to go a bit further, thanks to the Lambert W function : http://mathworld.wolfram.com/LambertW-Function.html

$$2ue^{2u}=2e^2x \quad\implies\quad 2u=W\left(2e^2x  \right)\quad\implies\quad u=\frac12\: W\left(2e^2x  \right)$$
$$y(x)=\frac{x}{2}\: W\left(2e^2x  \right)$$