$u''(t)+u(t) = |t|$ Solve the Cauchy problem, $\forall t \in \mathbb{R}$,
$$ \begin{cases}
u''(t) + u(t) = |t|\\
u(0)=1, \quad u'(0) = -1
\end{cases} $$
The solution to the homogeneous equation is $A\cos(t) + B \sin(t)$. Empirically, $|t|$ is "more or less" a particular solution, however it is not differentiable in $0$... What is the fastest way to find a particular solution two times differentiable?
 A: As mentioned in the comments, you can solve the system for $t \ge 0$ and $t \lt 0$.
However, you can use Laplace Transforms to solve the problem, and will arrive at:


*

*$t \ge 0, u(t) = t - 2 \sin t + \cos t$

*$t \lt 0, u(t) = \cos t - t$


If we check the initial conditions, they match as does the solution with continuity.
A piecewise plot shows:

A: $\displaystyle{\xi = {\rm u}' + {\rm iu}
\Longrightarrow
\xi' = {\rm u}'' + {\rm iu}'
\Longrightarrow
\xi' - {\rm i}\xi = \left\vert t\right\vert\,;
\qquad
{\rm u} = \Im\xi}$
$$
{{\rm d}\left({\rm e}^{-{\rm i}t}\xi\right) \over {\rm d}t}
=
{\rm e}^{-{\rm i}t}\,\left\vert t\right\vert
\Longrightarrow
{\rm e}^{-{\rm i}t}\xi - \left(-1 + {\rm i}\right)
=
\int_{0}^{t}{\rm e}^{-{\rm i}t'}\,\left\vert t'\right\vert\,{\rm d}t'
$$
$$
\xi
=
-{\rm e}^{{\rm i}t} + {\rm i}{\rm e}^{{\rm i}t}
+
\int_{0}^{t}
{\rm e}^{{\rm i}\left(t - t'\right)}\,\left\vert t'\right\vert\,{\rm d}t'
$$
$$
\begin{array}{|c|}\hline\\ \\
\color{#ff0000}{\large\quad{\rm u}\left(t\right)
=
-\sin\left(t\right) + \cos\left(t\right)
+
\int_{0}^{t}\sin\left(t - t'\right)\left\vert t'\right\vert\,{\rm d}t'\quad}
\\ \\ \hline
\end{array}
$$
${\bf ADDENDUM:}$
\begin{align}
\int_{0}^{t}\sin\left(t - t'\right)\left\vert t'\right\vert\,{\rm d}t'
&=
\left.\vphantom{\LARGE A}
\cos\left(t - t'\right)\left\vert t'\right\vert\,
\right\vert_{t'\ =\ 0}^{t'\ = t}
-
\int_{0}^{t}\cos\left(t - t'\right){\rm sgn}\left(t'\right),{\rm d}t'
\\[3mm]&=
\left\vert t\right\vert
+
\left.\vphantom{\LARGE A}
\sin\left(t - t'\right){\rm sgn}\left(t'\right)
\right\vert_{t'\ =\ 0}^{t'\ = t}
-
\int_{0}^{t}\sin\left(t - t'\right)
\left\lbrack 2\delta\left(t'\right)\right\rbrack\,{\rm d}t'
\\[3mm]&=
\left\vert t\right\vert
-
2\sin\left(t\right)\Theta\left(t\right)
\end{align}
$$
\begin{array}{|rcl|}\hline\\ \\
\color{#ff0000}{\large\quad{\rm u}\left(t\right)}
& = &
\color{#ff0000}{\large-\left\lbrack 2\Theta\left(t\right) + 1\right\rbrack\sin\left(t\right) + \cos\left(t\right)
+
\left\vert t\right\vert}
\\[3mm]
\color{#ff0000}{\large\quad{\rm u}'\left(t\right)}
& = &
\color{#ff0000}{\large-\left\lbrack 2\Theta\left(t\right) + 1\right\rbrack\cos\left(t\right)
-
\sin\left(t\right)
+
{\rm sgn}\left(t\right)\quad}
\\[3mm]
\color{#ff0000}{\large\quad{\rm u}''\left(t\right)}
& = &
\color{#ff0000}{\large\phantom{-}\left\lbrack 2\Theta\left(t\right) + 1\right\rbrack\sin\left(t\right)
-
\cos\left(t\right)}
\\ \\ \hline
\end{array}
$$
A: If $t\in 0^+\cup\{0\}$ then we have $u''+u=t$. Here, you can use any appropriate methods to get the general solution for this ODE. For example by using undetermined coefficients you get: $$u(t)=C_1\sin t+C_2\cos t+t$$ Remember the  part $C_1\sin t+C_2\cos t$ is really the solution of the associated homogenous OE, $u''+u=0$. Similarly, if $t<0$, then we have $u''+u=-t$ and so we get $u(t)=C_3\sin t+C_4\cos t-t$. Therefore: $$u(t)=\left\{
        \begin{array}{ll}
            C_1\sin t+C_2\cos t+t & \quad t \geq 0 \\
            C_3\sin t+C_4\cos t-t & \quad t < 0
        \end{array}
    \right.$$ Now use other given conditions to find the unknown coefficients $C_i$. Note that the solution should be continuous at the origin,i.e; $\lim_{t\to 0}u(t)=u(0)$.
A: This isn't the easiest or most systematic way to get a solution, but I had a bit of fun finding it so I'll post it anyway. 
Let's look for solutions of the form $u(t) = |t|f(t)$ where $f$ is twice differentiable with $f(0)=0$. Such a function is twice differentiable everywhere, with second derivative $$ u''(t) = \operatorname{sign}(t)(2 f'(t) + tf''(t))$$ where we use the convention that the sign of 0 is 0. The differential equation is then 
$$\operatorname{sign}(t)(2 f'(t) + tf''(t) + tf(t)) = \operatorname{sign}(t) t,$$ so a solution of $2 f'(t) + tf''(t) + tf(t)=t$ would suffice. The substitution $a(t) = t(f(t)-1)$ transforms this to $$a''(t) + a(t) = 0$$ with initial conditions $a(0) = 0, a'(0) = -1$; which has solution $a(t) = -\sin(t)$. Thus we have $f(t) = 1 - \operatorname{sinc}(t)$, giving a particular solution $$u(t) = |t| - \operatorname{sign}(t)\sin(t).$$
