<s>[INST] Solving a first order homogenous differential equation Problem:
Solve the following differential equation.
$$ x^2 \, dy + (y^2 -xy) \, dx = 0 $$
Answer:
$$ \left( \dfrac{x^2}{y^2} \right) \, dy
 + \left( \dfrac{y^2}{x^2} - \dfrac{y}{x} \right) \, dx = 0 $$
Hence we have a homogeneous differential equation. Let $y = vx$.
\begin{align*}
\dfrac{dy}{dx} &= v + x\dfrac{dv}{dx} \\
v^2 \left( v + x\dfrac{dv}{dx} \right)  &= v^2 - v \\
v^3 + v^2 x \dfrac{dv}{dx}  &= v^2 - v  \\
v^2 x \dfrac{dv}{dx}  &= -v^3 + v^2 - v  \\
x \dfrac{dv}{dx}  &= -v + 1 - v^{-1}  \\
\dfrac{dv}{-v + 1 - v^{-1}} &= \dfrac{dx}{x}
\end{align*}
Using an online integral calculator, we find:
$$ \int \dfrac{1}{-v + 1 - v^{-1}} \, dv =       
 -\dfrac{\ln\left(v^2-v+1\right)}{2} 
 - \dfrac{\arctan\left(\frac{2v-1}{\sqrt{3}}\right)}{\sqrt{3}} $$
\begin{align*}
 -\dfrac{\ln\left(v^2-v+1\right)}{2} 
 - \dfrac{\arctan\left(\frac{2v-1}{\sqrt{3}}\right)}{\sqrt{3}}
 &=  \ln{|x|} + C
\end{align*}
However, the book gets:
$$ y = \dfrac{x}{\ln{|x|}+C} $$
My answer is not going to match the book's answer. Where did I go wrong?
 [/INST] Let $y = vx$
$\cfrac{dy}{dx} = v + x\dfrac{dv}{dx}$
$x^2 \, dy + (y^2 -xy) \, dx = 0$
$ \cfrac{dy}{dx} + \left(\cfrac{y^2}{x^2} - \cfrac{y}{x}\right) = 0 \ $ (this is where you have a mistake)
$v + x\dfrac{dv}{dx} = v - v^2$
$\cfrac{dx}{x} = - \cfrac{dv}{v^2}$
$ \ln |x| + C = \cfrac{1}{v} = \cfrac{x}{y}$
$y = \cfrac{x}{\ln |x| + C}$
</s>