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$  
 A: Note: 
In view of @Mercy's comments, I interpret your question as: find all constant functions $F(x,y)$ such that
$$
dF=(x^2-2x+2y^2)dx+2xydy.
$$
Nervertheless, I think you maybe meant your question to be: solve the ODE
$$
x^2-2x+2y^2+2xyy'=0.
$$
Setting $z=y^2$, we have $z'=2yy'$ so the equation becomes
$$
xz'+2z=2x-x^2.
$$
This is linear of first order.
A general method for solving this is the integrating factor method: http://en.wikipedia.org/wiki/Integrating_factor.
As pointed out by David Mitra, in this case, this is very easy since this leads to
$$
x^2z'+2xz=2x^2-x^3\quad\Leftrightarrow\quad (x^2z)'=2x^2-x^3.
$$
Then integrate the latter.
Once you have $z$, take $\pm\sqrt{z}$ where it is nonnegative to find $y$.
A: 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. 
