<s>[INST] how to solve, $(x^2-2x+2y^2)dx+2xydy=0$? solve the following differential equation.
$\tag 1(x^2-2x+2y^2)\,dx+2xy\,dy=0$ 
$\frac{dy}{dx}=\frac{2x-x^2-2y^2}{2xy}$
dividing (1) throughout by $y^2$ we have,
$\tag 2 \left(\frac{x^2}{y^2}+2-2\frac{x}{y^2}\right)dx+2(\frac{x}{y})dy=0$  
 [/INST] Illustrating @DavidMitra's idea: multiply through by $x$:
$$(x^3-2x^2+2xy^2)\,dx+2x^2y\,dy=0$$
We want to find a function $F(x,y)$ such that
$$\frac{\partial F}{\partial x} = x^3-2x^2+2xy^2$$
$$\frac{\partial F}{\partial y} = 2x^2y$$
From the former equation, we integrate with respect to $x$ and get
$$F(x,y) = \frac{1}{4} x^4 - \frac{2}{3} x^3 + x^2 y^2 + g(y)$$
From the latter, integrate with respect to $y$ and get:
$$F(x,y) = x^2 y^2 + f(x)$$
Comparing the two equations, we see that $f(x) = \frac{1}{4} x^4 - \frac{2}{3} x^3 $ and $g(y)=0$.  Therefore
$$F(x,y) = \frac{1}{4} x^4 - \frac{2}{3} x^3 + x^2 y^2$$
Solutions of your differential equation satisfy $F(x,y) = C$, a constant. 
</s>