Why is my integrating factor wrong? Hello i have been trying to solve the differential equation :
$$xdx+ydy=\left(\sqrt{x^2+y^2}\right)dx$$
By integrating factors i supose that:
$$\frac{\partial\mu(x,y)}{\partial y}=0$$
so that i get 
$$\frac{y\mu}{\sqrt{x^2+y^2}}=\frac{\partial\mu(x,y)}{\partial x}$$
but then solving this i get:
$$\mu=\frac{\sqrt{x^2+y^2}+x}{y}$$
and the ODE becomes:
$$-ydx+(\sqrt{x^2+y^2}+x)dy=0$$
with $$M(x,y) = -y$$  and $$N(x,y) = \sqrt{x^2+y^2}+x  $$
But 
$$\frac{\partial M}{\partial y} = -1$$
$$\frac{\partial N}{\partial x} = 1+\frac{x}{\sqrt{x^2+y^2}}$$
and $$ \frac{\partial M}{\partial y} \not= \frac{\partial N}{\partial x} $$ 
so can anybody say to me where i did a mistake ?
 A: $$xdx+ydy=\sqrt{x^2+y^2}\:dx$$
From simple inspection,  an integrating factor is :
$$\mu(x,y)=\frac{1}{\sqrt{x^2+y^2}}$$
This can also be seen with the change of variable $\quad Y(x)=x^2+(y(x))^2\quad$ which leads to the separable ODE : $\quad\frac12\frac{dY}{dx}=\sqrt{Y(x)}dx$
$$\mu(xdx+ydy)=\mu\sqrt{x^2+y^2}\:dx=\frac{xdx+ydy}{\sqrt{x^2+y^2}}=dx$$
$$\frac{d(x^2+y^2)}{2\sqrt{x^2+y^2}}=dx$$
$$\sqrt{x^2+y^2}=x+c$$
$$y^2=(x+c)^2-x^2$$
$$y=\pm\sqrt{c^2+2cx}$$
In fact, the mistake is at the very beginning, when you supposed $\frac{\partial\mu(x,y)}{\partial y}=0$.
This supposition implies that $\mu$ is not function of $y$, which is false since $\mu$ is function of $(x^2+y^2)$. So, it is not surprising that the false supposition leads to the impossibility to find $\mu$ as a function of $x$ only.
Of course, it is common to make a supposition at the beginning. If we see that the calculus fails, the supposition is false. Then one have to try another supposition. For example supposing that $\mu$ is function of $y$ only. Or that $\mu$ is function of $xy$, etc.
If we do not want to make suppositions at the beginning, the integrating factor is solution of a PDE, which leads to even more difficult calculus.  The academic exercises are chosen so that it is easy to guess a convenient simple form for $\mu(x,y)$ without too many trials.
A: Another way to find the integrating factor is to consider the polar coordinate conversion
$r=\sqrt{x^2 + y^2}, r^2=x^2+y^2$
Differentiating the squared form of the equation and dividing by two gives
$rdr=xdx+ydy$
So
$rdr=rdx$ therefore $dr=dx$ for nonzero $r$.
The integrating factor is immediately rendered as $\frac{1}{r}=\frac{1}{\sqrt(x^2+y^2)}$.
As JJacquelin points out, the answer is then
$r=x+C$ or $\sqrt(x^2+y^2)=x+C$
The $r=x+C$ form makes it clear that $C$ must be nonnegative:  the magnitude of the vector from $(x,y)$ to the origin cannot be less than one component.
The form $r=x+C$ also immediately implies that the curve for any positive $C$ is a parabola with the focus at the origin; the distance $r$ to the origin is equal to the distance $x+C$ to the directrix $x=-C$.  For $C=0$ the intended directrix passes through the intended focus and the parabola degenerates to a doubled-back line, which is the positive $x$ axis.  This degeneration implies that the origin, which we had to exclude in order to set up the integrating factor, is actually a point of nondifferentiability.
