# How to solve $\dot{x}=|x|$

How to solve this differential equation $$\dot{x}=|x|$$?

• @Rahul because initial condition is not given. – bellcircle Nov 19 '18 at 11:10

One observes that $$x=0$$ is the trivial solution of the given ODE.

Now find nontrivial solutions of the equation.

Using separation of variables, one gets $$\frac{\dot{x}}{|x|}=1.$$

Integrating both sides gives

\begin{align}\text{sgn}(x)\log|x|=t+C\quad\cdots\quad\text{(a)}\end{align} for some constant $$C$$, where $$\text{sgn}(x)=\begin{cases}1,&x> 0\\-1,&x<0.\end{cases}$$

Therefore, $$x(t)=\begin{cases}C_1e^t,&x>0\\C_2e^{-t},&x<0.\end{cases}$$

Now find the solution of explicit form.

From the equation, $$\dot{x}$$ is always nonnegative, so $$x$$ is a continuously differentiable and nondecreasing function of $$t$$. This shows that $$C_1$$ must be positive and $$C_2$$ must be negative.

Since $$x$$ is a continuous function of $$t$$ and a nontrivial solution of $$x$$ cannot take 0 by the above observation, it follows that $$x(t)=C_1e^t,C_1>0$$ for all $$t$$ or $$x(t)=C_2e^{-t},C_2<0$$ for all $$t$$.

• You first divided both sides by $|x|$ to get the following results. But how can you guarantee that you are not dividing by $0$. In other words, if you cannot guarantee that once the solution starts from a non-zero value, it will not reach $0$, then you cannot divide it by $|x|$. – winston Nov 19 '18 at 12:30
• @winston Good question. If $\dot{x}=0$, then $x=0$ at such point. Now it is obvious that there is no way to combine the distinct (local) solutions $C_1e^t,C_2e^{-t},0$ to make a continuous global solution because the first is always positive, the second always negative, the last always zero. Therefore the global solution must be one of the three. – bellcircle Nov 19 '18 at 12:47

bellcircle has provided a solution to the problem. However, I would like to express the solution in a more compact form and also provide an answer using a proposition-proof style.

$$(Dx)(t) = |x(t)|$$ (1)

Proposition. If $$I$$ is an open interval in $$\mathbb{R}$$ and $$C \in \mathbb{R}$$, then $$x(t)=Ce^{\mathsf{sgn}(C) t}$$ is a solution of the differential equation (1) on $$I$$. If $$x(t)$$ is a solution of the differential equation (1) on an open interval $$I$$ in $$\mathbb{R}$$, then there exists $$C \in \mathbb{R}$$ such that $$x(t)=Ce^{\mathsf{sgn}(C) t}$$ for all $$t \in I$$.

Suppose $$I$$ is an open interval in $$\mathbb{R}$$. Suppose $$C \in \mathbb{R}$$ and $$x$$ is such that $$x(t)=Ce^{\mathsf{sgn}(C) t}$$ for all $$t \in I$$. Then $$(Dx)(t)=\mathsf{sgn}(C)Ce^{\mathsf{sgn}(C) t}$$. Also, $$|x(t)|=\mathsf{sgn}(C)Ce^{\mathsf{sgn}(C) t}$$ for all $$t \in I$$. Therefore, indeed $$x(t)=Ce^{\mathsf{sgn}(C) t}$$ is a solution of (1) on $$I$$.

Suppose there is a solution $$x_2(t)$$ of (1) on $$I$$ such that there is no $$C \in \mathbb{R}$$ such that $$x_2(t) = Ce^{\mathsf{sgn}(C) t}$$ for all $$t \in I$$. Then take $$T \in I$$. Define $$A=\frac{x_2(T)}{e^{\mathsf{sgn}(x_2(T)) T}}$$. Then $$x(t) = A e^{\mathsf{sgn}(A)t}$$ is a solution of (1) on $$I$$ with $$x(T)=x_2(T)$$. The uniqueness of the solution of (1) on $$I$$ with $$x(T)=x_2(T)$$ follows from the Lipschitz continuity of $$|\cdot|$$ by the Picard–Lindelöf theorem (link) and the global uniqueness theorem (e.g. link). Therefore $$x_2(t) = A e^{\mathsf{sgn}(A)t}$$ for all $$t \in I$$ and, thus, by contradiction, if $$x(t)$$ is a solution of the differential equation (1) on an open interval $$I$$ in $$\mathbb{R}$$, then there exists $$C \in \mathbb{R}$$ such that $$x(t)=Ce^{\mathsf{sgn}(C) t}$$ for all $$t \in I$$