Solution of an ODE in sections

The ODE $x'(t)=-\sqrt{x(t)}$ with $x(0)=1$ is given.

My solution I found is $x(t)=\frac{1}{4}t^2-t+1$.

I know that $x(t)=0$ is also a solution.

The book says the solution is given by

$x(t) = \begin{cases} (1-\frac{1}{2}t)^2 & \text{if } t \leq 2\\ 0 & \text{if } t > 2\\ \end{cases}$

My question is:

Why is the solution $x(t)=\frac{1}{4}x^2-x+1$ true only for $t\leq2$? And why $x(t)=0$ only for $t>2$?


Solution 1:

If one goes about naively solving the equation, then notice that $x=\sqrt{x}^2\implies{x'=2\sqrt{x}[\sqrt{x}]'}.$ So one has that $2\sqrt{x}[\sqrt{x}]'=-\sqrt{x},$ implying that $\sqrt{x}=0$ on some subset of the domain of $x,$ while $[\sqrt{x}]'=-\frac12$ everywhere else. The latter implies $$\int_0^t[\sqrt{x}]'\,\mathrm{d}s=\int_0^t-\frac12\,\mathrm{d}s\implies\sqrt{x(t)}-\sqrt{x(0)}=-\frac{t}2.$$ Since $x(0)=1,$ we have that $x(t)=\left(1-\frac{t}2\right)^2.$ But remember that this is only true on some subset of the domain, and on the complement of that subset we have $x(t)=0.$ So we do not know what exactly $x$ is yet in terms of a piecewise description. Instead, let us go back to the original equation. Notice that because $x'=-\sqrt{x}$, and because $\sqrt{x}\geq0$, we must have that $x'\leq0.$ Also, given $x(t)=\left(1-\frac{t}2\right)^2,$ we have $x'(t)=-\left(1-\frac{t}2\right)=\frac{t}2-1.$ Meanwhile, $-\sqrt{x(t)}=-\sqrt{\left(1-\frac{t}2\right)^2}=-\left|1-\frac{t}2\right|.$ The issue is that $\frac{t}2-1=-\left|1-\frac{t}2\right|$ is true if and only if $\left|1-\frac{t}2\right|=1-\frac{t}2,$ which is only true when $1-\frac{t}2\geq0$, which is equivalent to $t\leq2.$ Thus, it is only when $t\leq2$ that $x(t)=\left(1-\frac{t}2\right)^2$ holds, and in order for the differential equation to be satisfied everywhere in $\mathbb{R},$ it can only be the case that for $t\gt2,$ $x(t)=0,$ as suspected.