<s>[INST] Solve $y\frac{dy}{dx}+x=\sqrt{x^2+y^2}$ using line integrals I'm aware of the fact that the ODE
\begin{align}y\frac{dy}{dx}+x=\sqrt{x^2+y^2},\end{align}
can be solved using substitution methods. I've worked out the solution quite easily by setting $u=\sqrt{x^2+y^2}$ and everything works out. But what if I rewrite the equation as
\begin{align}\frac{dy}{dx}+\left(\frac{y}{x}\right)^{-1}&=\sqrt{\frac{x^2+y^2}{y^2}}\\\implies \frac{dy}{dx}+\left(\frac{y}{x}\right)^{-1} &=\sqrt{\left(\frac{y}{x}\right)^{-2}+1}.\end{align}
Now let $u=\displaystyle\frac{y}{x}\implies \displaystyle\frac{dy}{dx}=\frac{d\left(ux\right)}{dx}$, obtaining
\begin{align}\frac{d\left(ux\right)}{dx}&=\sqrt{\frac{1}{u^2}+1}-\frac{1}{u}\\\implies \int\left(\sqrt{\frac{1}{u^2}+1}-\frac{1}{u}\right)^{-1}\:d\left(ux\right)&=\int\:dx\\\implies \int\frac{u\:dx+x\:du}{\sqrt{\frac{1}{u^2}+1}-\frac{1}{u}}&=x+C_0.\end{align}
Assuming I haven't messed anything up (I feel like I've made a mistake here), how do I evaluate the integral on the LHS? The RHS looks familiar, however, because the answers I've found have all taken the form $y=\sqrt{\left(x+C\right)^2-x^2}$.
 [/INST] Another simplest way :
From your given equation we have ,
$$2(y\,dy+x\,dx)=2\sqrt{x^2+y^2}\,dx$$
$$\implies \frac{d(x^2+y^2)}{\sqrt{x^2+y^2}}=2\,dx$$
$$\implies 2\sqrt{x^2+y^2}=2x+2C \implies \sqrt{x^2+y^2}=x+C$$
</s>