How to solve the following ordinary differential equation? Consider the ODE $$y' + x = \sqrt{x^2+y}.$$
I have no idea how to solve this equation. I have tried several ways but neither of them worked. Can anybody help me? Many thanks.
I have tried substituting $u=\sqrt{x^2+y}$, as well as squaring both sides of the ODE.
 A: Let us assume $g(x)\geq 0$ and  $y=x^2 g(x)^2-x^2$. We have $y'=2x g(x)^2+2x^2 g'(x)g(x)-2x$ and $\sqrt{x^2+y}=x g(x)$,
hence:
$$2 g(x)^2+2x g'(x)g(x)-1 = g(x), $$
$$x g'(x) = \frac{1}{2}+\frac{1}{2 g(x)}-g(x). $$
Now let $h(t)=g(e^t)$. We have $h'(t) = e^{t} g'(e^t)$, so $g'(e^t)=h'(t)e^{-t}$ and by letting $x=e^t$ in the previous line
$$ h'(t) = \frac{1}{2}+\frac{1}{2 h(t)}-h(t). $$
This is a separable DE, which can be solved by finding the inverse function of $\int \frac{du}{\frac{1}{2}+\frac{1}{2u}-u}.$
The explicit solutions are a bit convoluted, since they depend on the roots of a cubic. One of them is 
$$ y(x) = \frac{x^2}{4}\left[-4+\left(1+\frac{x}{\sqrt[3]{2-x^3+2\sqrt{1-x^3}}}+\frac{\sqrt[3]{2-x^3+2\sqrt{1-x^3}}}{x}\right)^2\right].$$
A: This is a heuristic derivation of the complete solution showing a possible motivation chain. Notice that Jack D'Aurizio has given a special solution before.
How can we simplify the ODE?
$$y' + x = \sqrt{x^2+y}\tag{1}$$
The first thing to do would be to get rid the square root.
Hence the set $v^2 = x^2+y$ so that the r.h.s becomes just $v$.
But this means that $y=v^2-x^2$ and $y'(x) = 2 v v'(x) - 2 x$ so that the the ODE becomes
$$2 v v' - x = v \tag{2}$$
Here we would like to get rid of $x$, hopefully by cancelling a factor $x$. To this end we try the natural substitution $v\to u x$ which gives
$$ 2 u x (u x)' -x = u x \implies 2 u (u x)' -1 = u \implies 2 u^2 +2 x u u' = u+1 \\\implies  x  u' = -u +\frac{1}{2}+\frac{1}{2u} $$
Now we can separate variables:
$$ x  \frac{du}{dx} = -u +\frac{1}{2}+\frac{1}{2u} \implies \frac{du}{-u +\frac{1}{2}+\frac{1}{2u}} =\frac{dx}{x} $$
Integrating is elementary on both sides. Hence we find the following relation betwee $x$ and $u$
$$2 \left(-\frac{1}{3} \log (1-u)-\frac{1}{6} \log (2 u+1)\right)=\log (x) + const\tag{3}$$
Multiplying by $-3$ and simplifying the $\log$ gives the cubic equation for $u$
$$(1-u)^2(1+2u) = \frac{c^3}{x^3} \tag{4}$$
Here $c$ is a constant of integration.
Now $(4)$ can be solved by standard methods giving three solution for $u(x)$. We skip the explicit expression here for the time being as Jack has already given a special solution.
Finally, we have found that the ODE $(1)$ has three solutions given by
$$y(x) = x^2(u(x)^2-1)$$
explicitly
$$y(x,c) = \left\{x^2 \left(\frac{1}{4} \left(-\frac{g}{c x}-\frac{c x}{g}+1\right)^2-1\right),\\x^2 \left(\frac{1}{4} \left(\frac{g}{c x}+\frac{c x}{g}+1\right)^2-1\right),\\x^2 \left(-1+\frac{1}{16} \left(\frac{2 (-1)^{2/3} g}{c x}+\frac{c \left(x-i \sqrt{3} x\right)}{g}+2\right)^2\right)\right\}
\tag{5a}$$
here
$$g = \sqrt[3]{c^3 x^3+2 \sqrt{1-c^3 x^3}-2}\tag{5b}$$
Here is a plot of the three solutions with  three different parameters $c$

Notice the interesting cusp structure from which two of the three solutions emerge. The position of the cusp is given by $(x,y) = (\frac{1}{c} ,-\frac{1}{c^2})$
Discussion


*

*CAS


Mathematica solves the ODE with the command DSolve immediately, but it returns 6 solutions instead of 3. Three of these do not solve the ODE after explicit insertion. This confused my at first so I did not submit that solution. The reason is that Mathematica takes a an additional negative value of the square root into account, i.e. it simultaneously solves the ODE $y'+x = - \sqrt{x^2+y}$. The latter is obtained from $(1)$ by the substitution $x\to -x$.


*Modifications


We could simplify the ODE $(1)$ by subsequently modifying terms, as for instance
$$y'(x)=\sqrt{y(x)}\tag{m1}$$
$$y'(x)=\sqrt{y(x)+x}\tag{m2}$$
$$y'(x)=\sqrt{y(x)+x^2}\tag{m3}$$
$$y'(x)+x=\sqrt{y(x)}\tag{m4}$$
$$y'(x)+x=\sqrt{y(x)+x}\tag{m5}$$
All these ODEs can be transformed to a separable ODE which even can be integrated but the resulting implicit equations cannot be solved explicitly.
For example, the integral of $(m4)$ is
$$\frac{1}{2} \log \left(\frac{2 y(x)}{x^2}+\sqrt{\frac{y(x)}{x^2}}+1\right)-\frac{1}{\sqrt{7}}\text{arctan}\left(\frac{1+4 \sqrt{\frac{y(x)}{x^2}}}{\sqrt{7}}\right)=\log \left(\frac{c}{x}\right)\tag{i4}$$
