Solve $x^2 dy + (xy+y^2) dx = 0$ if $y=1$ when $x=1$. Using the given equation I arrived at the following expression:
$$\frac{dy}{dx} = - \left[\frac{y}{x} + \left(\frac{y}{x}\right)^2\right] \tag{1}$$
Since this is a homogenous equation, I assumed $\frac{y}{x}=v$ giving:
$$\frac{dy}{dx} = v + x \frac{dv}{dx}$$
Substituting this in equation $(1)$ and solving I arrived at the following expression:
$$\ln\left|\frac{v}{v+2}\right| = \ln\left(\frac{C}{x}\right)^2$$
where $C$ is an arbitrary constant. Substituting $v$ for $\frac{y}{x}$ and simplifying further I obtained:
$$\left|\frac{y}{y+2x}\right| = \frac{C^2}{x^2}$$
Using the fact that $y=1$ when $x=1$, I find that $C^2 = \frac{1}{3}$. Substituting this value in equation $(2)$, I arrived at the following expression:
$$\left|\frac{y}{y+2x}\right| = \frac{1}{3x^2}$$
This is how I solved it further:
$$\frac{y}{y+2x} = \pm \frac{1}{3x^2}$$
$$\implies y+2x = \pm 3 x^2 y$$
But my book gives the answer as $y + 2x = 3 x^2 y$. Am I missing something? I am not very familiar with solving equations with absolute values, so I'm not sure about my answer. Any help would be appreciated.


$$|\frac{y}{y+2x}| = \frac{C^2}{x^2} \tag{2}$$

In your Eq.$(2)$, if you remove the absolute value, you have
$$\frac{y}{y+2x} =\pm \frac{C^2}{x^2} $$
But your initial condition $x=1,y=1$ exculdes the "$-$" sign solution. So you only need to take the positive solution, hence
$$\frac{y}{y+2x} = \frac{C^2}{x^2} $$
