<s>[INST] Differential Equation by substitution How can I solve:
$$
yy'+x=\sqrt{x^2+y^2}
$$
I tried:
$$
y\frac{dy}{dx}+x=\sqrt{x^2+y^2}$$
let $v = x^2+y^2$,
$dv=2xdx+2ydy$
then I don't know what's next
I tried isolating the dy
$$dy=\dfrac {(dv-2xdx)}{2\sqrt {(v-x^2)}}$$
and substituting back to the equation
$$\sqrt {(v-x^2)}\dfrac {(dv-2xdx)}{2\sqrt {(v-x^2)}}+x=\sqrt v$$
which is I think wrong
 [/INST] Notice that the equation only requires that $y$ be differentiable for real numbers $x$ such that $y(x)\neq0.$ Therefore, $x^2+y(x)^2\gt0.$ Let $D=\{x\in\mathbb{R}:y(x)\neq0\}.$ Let $w:D\to\mathbb{R}$ with $w(x)=x^2+y(x)^2.$ Hence $y(x)y'(x)+x=\sqrt{x^2+y(x)^2}$ is equivalent to $w'(x)=2\sqrt{w(x)},$ where $w(x)\gt0.$ Thus $$\frac{w'(x)}{2w(x)}=1=(\sqrt{w})'(x),$$ which is equivalent to $$\sqrt{w(x)}=x+C,$$ which requires $x\gt-C.$ Thus $D_C=\{x\in\mathbb{R}:x\gt-C\}.$ Therefore, $w(x)=(x+C)^2,$ which means that $$x^2+y(x)^2=(x+C)^2=x^2+2Cx+C^2,$$ equivalent to $$y(x)^2=2Cx+C^2.$$ Now, $y(x)^2\gt0,$ so $2Cx+C^2=C(2x+C)\gt0,$ which means $C\gt0$ and $x\gt-\frac{C}2,$ or $C\lt0$ and $x\lt-\frac{C}2.$ The latter case is impossible, since $-C\gt0,$ and $x\gt-C,$ but in that case, $\frac{-C}2\lt-C.$ Therefore, it necessarily is the case that $C\gt0.$ Therefore, $$y(x)=\sqrt{2C}\sqrt{x+\frac{C}2},$$ implying $$y(x)y'(x)=\sqrt{2C}\sqrt{x+\frac{C}2}\frac1{2\sqrt{x+\frac{C}2}}=\sqrt{\frac{C}2}=\frac{\sqrt{C}}{\sqrt{2}},$$ and so $$y(x)y'(x)+x=x+\frac{\sqrt{C}}{\sqrt{2}}.$$ Meanwhile, $$\sqrt{x^2+y(x)^2}=x+C.$$ Therefore, $$C=\frac{\sqrt{C}}{\sqrt{2}},$$ equivalent to $$\sqrt{C}^2-\frac1{\sqrt{2}}\sqrt{C}=\sqrt{C}\left(\sqrt{C}-\frac1{\sqrt{2}}\right)=0,$$ meaning $$\sqrt{C}=\sqrt{\frac12},$$ hence $C=\frac12.$ It turns out that $C=0$ also works, but makes $y(x)=0$ and $y'(x)=0.$ As such, the two solutions are $y(x)=0$ and $y(x)=x+\frac14.$
</s>