Take the equation
\begin{equation*}
x''(t) + x(t) = \cos (2t), \quad x(0) = 0, \quad x'(0) = 1 .
\end{equation*}
We will take the Laplace transform of both sides. By \(X(s)\) we will, as usual, denote the Laplace transform of \(x(t)\text{.}\)
\begin{equation*}
\begin{aligned}
\mathcal{L} \bigl\{ x''(t) + x(t) \bigr\} & = \mathcal{L} \bigl\{ \cos (2t) \bigr\} , \\
s^2 X(s) -sx(0)-x'(0) + X(s) & = \frac{s}{s^2 + 4} .
\end{aligned}
\end{equation*}
We plug in the initial conditions now—this makes the computations more streamlined—to obtain
\begin{equation*}
s^2 X(s) -1 + X(s) = \frac{s}{s^2 + 4} .
\end{equation*}
We solve for \(X(s)\text{,}\)
\begin{equation*}
X(s) = \frac{s}{(s^2+1)(s^2 + 4)} + \frac{1}{s^2+1} .
\end{equation*}
We use partial fractions (exercise) to write
\begin{equation*}
X(s) =\frac{1}{3} \, \frac{s}{s^2+1} -
\frac{1}{3}\, \frac{s}{s^2+4} + \frac{1}{s^2+1} .
\end{equation*}
Now take the inverse Laplace transform to obtain
\begin{equation*}
x(t) =\frac{1}{3} \cos (t) -
\frac{1}{3} \cos (2t) + \sin (t) .
\end{equation*}