Why two solutions to this simple ODE?

Hello all,
I attach a very small notebook consisting of only one line.
Why does Mathematica returns 2 solutions, clearly the first “solution” is not a solution.
Best,

JMC

It is a solution if you take both possible signs of square root.

sln = DSolve[{x'[t] == Sqrt[x[t]], x[0] == x0}, x[t], t] // 
  FullSimplify

{{x[t] -> 1/4 (t - 2 Sqrt[x0])^2}, {x[t] -> 
   1/4 (t + 2 Sqrt[x0])^2}}

 f[t_] = x[t] /. sln[[1]]

1/4 (t - 2 Sqrt[x0])^2

f[0]
x0

 f'[t] - Sqrt[f[t]] // PowerExpand // Simplify
0

Hello Frank,

Thank you for your reply.
I think I will stop teaching my young nephew differential equations AND Mathematica :slight_smile:
Nothing wrong with what you write/code but I taught him (and his prof. too) the theorem of existence and uniqueness.
By the way I have to admit that I used another CAS for this ODE and it returned one solution (the second one with the + sign).
Best to you,
Jean-Michel

chacun a son gout

eqn = x’[t] == Sqrt[x[t]];

soln = DSolve[{eqn, x[0] == x0}, x[t], t] // FullSimplify

{{x[t] → 1/4 (t - 2 Sqrt[x0])^2}, {x[t] → 1/4 (t + 2 Sqrt[x0])^2}}

both solutions satisfy the initial condition

soln /. t -> 0

{{x[0] → x0}, {x[0] → x0}}

rules = Flatten[NestList[D[#, t] &, #, 1]] & /@ soln

{{x[t] → 1/4 (t - 2 Sqrt[x0])^2, Derivative[1][x][t] → 1/2 (t - 2
Sqrt[x0])}, {x[t] → 1/4 (t + 2 Sqrt[x0])^2, Derivative[1][x][t]
→ 1/2 (t + 2 Sqrt[x0])}}

The second solution is valid for (x0 >= 0) and (t >= -2 Sqrt[x0])

Simplify[eqn /. rules, {x0 >= 0, t >= -2 Sqrt[x0]}]

{t >= 2 Sqrt[x0], True}

Both solutions are valid for (x0 >= 0) and (t >= 2 Sqrt[x0])

Simplify[eqn /. rules, {x0 >= 0, t >= 2 Sqrt[x0]}]

{True, True}

For many situations, you might want to use Surd instead of Sqrt. Although in this case, Surd doesn’t have the algebraic properties that allow you to solve the system.

In real life, some of the major theorems of math don’t always seem to hold because of branch cuts. For example:

Integrate[D[Log[-x], x], x] 

gives

Log[x]

How did Log[-x] turn into Log[x]? Is this a contradition of the fundamental theorem of calculus?

You can prevent students from seeing this stuff for a while (until they get into the real world), but I honestly think it’s more instructive to show them sometimes even small things can be confusing. Even really brilliant proffesors of engineering and science get stumped on simple stuff like this all the time.

but I honestly think it’s more instructive to show them sometimes even
small things can be confusing.

Prof. Grothendieck (snipped from F. W. Lawvere Aurelio Carboni) expressed a similiar view:

But, on the other hand, to keep the errors man invented informatics.