<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] It seems that the solution $y(x)$ cannot be expressed on a closed form. But a closed form can be found for the inverse function $x(y)$ :
$$x^2 - y^2\frac{\mathrm dx}{\mathrm dy} + xy^2(x-y) = 0 \implies \frac{dx}{dy} = \frac{y^2 + 1}{y^2}x^2 - yx$$
Considering the function inverse function $x(y)$, this is a Riccati ODE which can be solved thanks to the classical method to solve this kind of ODEs.
But, in this case, it is easier to proceed with a convenient change of function:
$$\text{Let: } x(y) = e^{-y^2/2}F(y) \implies \frac{dx}{dy} = e^{-y^2/2}F' - ye^{-y^2/2}F = \frac{y^2 + 1}{y^2}e^{-y^2}F^2 - ye^{-y^2/2}F\\
\,\\
\text{Now, } \int{\frac{F'}{F^2}}\mathrm dy = \int{\frac{y^2 + 1}{y^2}e^{-y^2/2}}\mathrm dy \implies -\frac{1}{F} = -\frac{1}{y}e^{-y^2/2} + C\\
\implies F = \frac{y}{e^{-y^2/2} + Cy}\\ 
\implies x(y) = \frac{ye^{-y^2/2}}{e^{-y^2/2} + Cy}= \frac{y}{1 + Cye^{y^2/2}}
$$
:: Source :: 
</s>