Solution to an inexact differential equation with the difference between partial derivatives not single variable How can I find the general solution to the equation $$\left(x^2+xy+\frac{y^2}{x}\right)dx+(x^2+xy-y)dy=0$$
Note that, by using exact differentials, I could reduce it to $(x+y)d(x+y)=yd\left(\frac{y}{x}\right)$, but could not solve it. The difference between $M_y-N_x=\frac{2y}{x}-x-y$, where $M=x^2+xy+\frac{y^2}{x}$, $N=x^2+xy-y$. Any hints? Thanks beforehand.

You already reduced it to $(x+y) \,d(x+y) = y \,d(\frac{y}{x})$.
Now you can just use change of variable -
$\displaystyle x + y = u, \frac{y}{x} = v$
$ \displaystyle \implies x = \frac{u}{v+1}, y = \frac{uv}{v+1}$
So $d(x+y) = \frac{y}{(x+y)} \,d(\frac{y}{x})$ becomes
$\displaystyle du = \frac{v}{v+1} dv \,$.
