<s>[INST] How to solve this differential equation: $x^2dy-y^2dx+xy^2(x-y)dy=0$ 
$$x^2dy-y^2dx+xy^2(x-y)dy=0$$


What I tried:
$$\frac{x^2}{y^2} \frac{dy}{dx}+x(x-y)\frac{dy}{dx}=1\\$$
Let $h=-1/x, \; k=-1/y,\; dh=1/x^2 \,  dx, \; dk=1/y^2 \,dy$
$$\frac{dk}{dh}+\frac{(k-h)}{k^2} \frac{dk}{dh}=1\\
\frac{dk}{dh}+\frac hk=1+\frac1k\\
he^{\int-1/k^2\; dk}=\int\left(1+\frac1k\right)e^{\int-1/k^2\; dk}dk\\
he^{-y}=\int\frac{1-y}{y^2}e^{-y}dy=\int\left(\frac 1{y^2}-\frac1y\right)e^{-y}dy$$
Which probably is unsolvable?I tried using IBP on RHS.Dont use Ricatti Eqn(Not in my course)
Answer is:

 $$\large\ln\left|\frac{x-y}{xy}\right|=\frac{y^2}2+\mathcal C$$

 [/INST] $\left(\dfrac{x^2}{y^2} +x(x-y)\right)=\dfrac{dx}{dy}$
$x=vy\implies \dfrac{dx}{dy}=v+y\dfrac{dv}{dy}$
$\therefore \left(\dfrac{x^2}{y^2} +x(x-y)\right)=\dfrac{dx}{dy} \\\implies v+y\dfrac{dv}{dy}=v^2+v^2y^2-vy^2 \\ \implies y\dfrac{dv}{dy}=v^2+v^2y^2-vy^2-v\\ \implies y\dfrac{dv}{dy}=(1+y^2)v(v-1) \\\implies \displaystyle \int\dfrac{dv}{v(v-1)}=\displaystyle \int\left(y+\dfrac{1}{y}\right)dy \\ \implies \displaystyle \int\dfrac{v-(v-1)}{v(v-1)} dv=\displaystyle \int\left(y+\dfrac{1}{y}\right)dy\\\implies \displaystyle\int\dfrac{dv}{v-1}-\displaystyle\int\dfrac{dv}{v}=\displaystyle\int y\ dy + \displaystyle\int\dfrac{dy}{y} \\\implies \ln \left(1-\dfrac{1}{v}\right)=\dfrac{y^2}{2}+\ln y+ c \\\implies \ln \left(\dfrac{x-y}{xy}\right)= \dfrac{y^2}{2}+c$ 
</s>