I solved a nonlinear differential equation (d'Alembert one) by hand. Mathematica gives the same answer.

But I am not able to get Mathematica to verify the solution due to branch cuts.

Any one knows of a trick to verify the solution?

I tried different assumptions but can't find the right set. I know the solution is correct, well, at least I get same solution, but wanted to see if there is a trick to verify the solution back into the ODE, that is all.

 ode = y'[x] == Sqrt[1 + x + y[x]]
 sol = DSolve[ode, y, x]

Mathematica graphics

enter image description here


  Simplify[ode /. sol]
  Assuming[Element[x, Reals] && x > 0, FullSimplify[ode /. sol]]

and so on. Not able to get True.


hand solution

Solve \begin{align*} {\frac {\rm d}{{\rm d}x}}y \left( x \right) &=\sqrt {1+x+y \left( x \right) } \end{align*}

This is d'Alembert ODE. It has the form $y \left( x \right) =x g(y'(x)) + f(y'(x))$. where $g$ and $f$ are functions of $y'(x)$.

Solving for $y \left( x \right) $ from the above and keeping only real solutions for $y \left( x \right) $ and letting $p=y'(x)$ gives \begin{align*} y \left( x \right) &= {p}^{2}-x-1 \tag{1} \\ \end{align*} ODE (1) is now solved.

In this ODE $g(y'(x)) = -1$ and $f(y'(x))={p}^{2}-1$. Taking derivatives of (1) w.r.t. $x$ and remembering that $p$ is a function of $x$ results in \begin{align*} p &= -1+ \left(2\,p\right) \frac{ \mathop{\mathrm{d}p}}{\mathop{\mathrm{d}x}}\\ p+1 &= \left(2\,p\right) \frac{ \mathop{\mathrm{d}p}}{\mathop{\mathrm{d}x}}\tag{2}\\ \end{align*} The singular solution is found by setting $ \frac{ \mathop{\mathrm{d}p}}{\mathop{\mathrm{d}x}}=0$, which implies that $p$ is a constant. From the above, this results in \begin{align*} p+1&=0\\ \end{align*}
Solving the above for $p$ gives \begin{align*} p&=-1\\ \end{align*}

Substituting $-1$ values in (1) gives the singular solution $$ y \left( x \right) =-x $$ But this solution does not satisfy the ODE, hence will not be used

The general solution is found when $ \frac{ \mathop{\mathrm{d}p}}{\mathop{\mathrm{d}x}}\neq 0$. Rewriting (2) as \begin{align*} \frac{ \mathop{\mathrm{d}p}}{\mathop{\mathrm{d}x}} &={\frac {p+1}{2\,p}}\\ \end{align*} Inverting the above gives \begin{align*} \frac{ \mathop{\mathrm{d}x}}{\mathop{\mathrm{d}p}} &=2\,{\frac {p}{p+1}} \end{align*}
$x \left( p \right) $ is now the dependent variable and $p$ as the independent variable. Now this ODE is solved for $x \left( p \right) $. Since ${\frac {\rm d}{{\rm d}p}}x \left( p \right) = 2\,{\frac {p}{p+1}}$ then $$ x \left( p \right) = \int{2\,{\frac {p}{p+1}} \mathop{\mathrm{d}p}} = 2\,p-2\,\ln \left( p+1 \right) + C $$ Solving (using the computer) for $p$ from the above in terms of $x$ gives \begin{align*} p &= - \mathrm{LambertW} \left( -{{\rm e}^{-{\frac {x}{2}}-1+{\frac {C_{{1}}}{2}}}} \right) -1\\ \end{align*} Substituting the above solution for $p$ in Eq (1) gives the general solution.

$$ y \left( x \right) = \left( \mathrm{LambertW} \left( -{{\rm e}^{-{\frac {x}{2}}-1+{\frac {C_{{1}}}{2}}}} \right) \right) ^{2}+2\, \mathrm {LambertW} \left( -{{\rm e}^{-x/2-1+1/2\,C_{{1}}}} \right) -x $$

ps. LambertW is ProductLog

  • $\begingroup$ As an aside, you can substitute y[x] == v[x] - x which turns the ODE into a separable equation. $\endgroup$
    – Greg Hurst
    Commented Jun 24, 2020 at 22:53

1 Answer 1


There are a few issues to be clarified: appropriate form of our differential equation and appropriate domain of the solution. Both issues are not independent and they arise due to playing with a general form of DSolve without specification of apropriate initial conditions. In order to demonstrate that the equation is satisfied we define:

ode = y'[x]^2 == 1 + x + y[x]
sol = DSolveValue[ode, y, x] // Quiet

We have chosen this way of defining ode in order to avoid checking whether y'[x] == Sqrt[1 + x + y[x]] or y'[x] == -Sqrt[1 + x + y[x]]. (it is a simple exercise to observe that this issue comes out when an integration constant is specified). The solution depends on its variable x and its parameter c (which could be determined with the initial conditions given).

f[x_, c_] := -x + 2 ProductLog[-E^(-1 - x/2 - c/2)] + ProductLog[-E^(-1 - x/2 - c/2)]^2
f[x,c] // TraditionalForm

enter image description here

and now with appropriate domain of definiton (x > -c we assume that the solution is real like the original question seemed to assume, although this point in unnecessary) we have

Simplify[ ode /. {y[x] -> f[x, c], y'[x] -> Derivative[1, 0][f][x, c]}, x > -c]

When we deal with special functions like the Lambert W function (ProductLog) we should use FullSimplify rather than Simplify, nonetheless we chose the latter to show that it is straightforward checking whether this differential equation is satisfied. QED

Example c=1

With[{c = 1}, 
  Plot[ ReIm @ f[x, c], {x, -3/2, 1/2}, PlotStyle -> Thickness[0.008], 
        AxesOrigin -> {0, 0}, Evaluated -> True]]

enter image description here

We can see that the solution is real for $x\geq-c=-1$ and its derivative is negative as mentioned above.

For quite a similar problem consider examining How to plot an implicit solution of a differential equation? where we had to change the variables in order to go ahead with reasonable analysis.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.