Another differential equation with absolute value How can I solve the following Cauchy problem?
$x''=\left|x\right|+t$ 
where $x(0)=0$  and  $x'(0)=1$.
How do I know $x>0$  and $x<0$? On which interval of $t$ and why? 
 A: I am going to assume that, without the absolute value, you are able to solve the differential equation. Notes on how to do so can be found here. Let's look at what happens near $t=0$. We are given the initial conditions $x(0)=0$ and $x'(0)=1$. That means that $x(\epsilon)>0$ and $x(-\epsilon)<0$ for small $\epsilon>0$. Thus, at least in some neighborhood of the origin, we know whether $x$ is positive or negative. Now, let's solve the differential equation without the absolute value.
$x''=x+t$ with $x(0)=0$ and $x'(0)=1$ is solved uniquely by $x(t)=e^t-e^{-t}-t$. Since $x>0$ in some small interval $(0,\epsilon)$, we may conclude that $x(t)=e^t-e^{-t}-t$ for $t\in (0,\epsilon).$ But you can also check that $e^t-e^{-t}-t>0$ for all $t>0$, so $x(t)$ does not change sign and we get a solution on all of $(0,\infty)$. 
$x''=-x+t$ with $x(0)=0$ and $x'(0)=1$ is solved uniquely by $x(t)=t$. Since $x<0$ in some small interval $(-\epsilon,0)$, we may conclude that $x(t)=t$ for $t\in (-\epsilon,0).$ We of course have $t<0$ for all $t<0$, so $x(t)$ does not change sign and we get a solution on all of $(-\infty,0$).
Putting this together, the general solution will be:
$$x(t)=\left\{\begin{array}{cc}e^{t}-e^{-t}-t, & t>0\\t,&t<0\end{array}\right.$$
You should check that this piecewise function is twice-differentiable at $0$. If you're not a fan of the piecewise definition, notice that we can write this function more compactly as $x(t)=e^t-e^{-|t|}-|t|.$
In the future, when approaching a problem like this, I would recommend following a similar method. Namely, first solve near your initial values, using the givens to tell you about the sign occuring in the absolute value. If things stay the same sign, then you're all good and you can extend your solution to all of $\mathbb R$. If things start switching sign, you will have to deal with more piecewise components, but this will hopefully either terminate or follow a regular pattern. As an example, try to solve $x''=|x|$ with $x(0)=0$ and $x'(0)=1$.
