Second-Order Linear Differential Equation I have the following differential equation:
$$y''+y=\cos(t)\cos(2t)$$
Maybe something can be done to $\cos(t)\cos(2t)$ to make it easier to solve. Any ideas?
Thanks in advance.
 A: I don't see an elegant solution (and I fail to see how Arturo's comment helps immediately), but it can be done by brute force using the method of variation of parameters.
The homogeneous differential equation $y''(t) + y(t) = 0$ has the two fundamental solutions $y_{1}(t) = \sin{(t)}$ and $y_{2}(t) = \cos(t)$.
We must solve
\[
\begin{pmatrix}
  0 \\
  \cos(t)\cos(2t)
\end{pmatrix} =
\begin{pmatrix}
  y_{1} & y_{2} \\
  y_{1}^{\prime} & y_{2}^{\prime}
\end{pmatrix}
\begin{pmatrix}
  u_{1} \\
  u_{2}
\end{pmatrix} =
\begin{pmatrix}
  \sin{t} & \cos{t} \\
  -\cos{t} & \sin{t}
\end{pmatrix}
\begin{pmatrix}
  u_{1} \\
  u_{2}
\end{pmatrix}
\]
for $u_{1}$ and $u_{2}$ and find $U_{1}$ and $U_{2}$ such that $U_{1}^{\prime} = u_{1}$ and $U_{2}^{\prime} = u_{2}$.

A particular solution will then be given by
  \[y_{0}(t) = U_{1} y_{1} + U_{2}y_{2}\qquad\text{and}
  \qquad y=y_{0} + c_{1} y_{1} + c_{2}y_{2}\]
  will be the general solution.

Since the matrix $A(t) = \begin{pmatrix}
  \sin{t} & \cos{t} \\\
  -\cos{t} & \sin{t}
\end{pmatrix}$ is orthogonal, its inverse is its transpose, so
\[
\begin{pmatrix}
  u_{1} \\
  u_{2}
\end{pmatrix}= 
\begin{pmatrix}
  \sin{t} & -\cos{t} \\
  \cos{t} & \sin{t}
\end{pmatrix}
\begin{pmatrix}
  0 \\
  \cos(t)\cos(2t)
\end{pmatrix} =
\begin{pmatrix}
\cos^2(t)\cos(2t) \\
\sin(t)\cos(t)\cos(2t)
\end{pmatrix}
\]
Note that $u_{2}(t) = \sin(t)\cos(t)\cos(2t) = \frac{1}{2}\sin{(2t)}\cos{(2t)} = \frac{1}{4}\sin{(4t)}$, so we can take

\[U_{2}(t) = -\frac{1}{16}\cos{(4t)}.\]

On the other hand, using Arturo's comment three times, we get
\begin{align*}
u_{1}(t) & = \cos^2(t)\cos(2t) = \cos(t)\frac{1}{2}(\cos(3t)+\cos(t)) \\
& = \frac{1}{2} \cos{(t)}\cos(3t) + \frac{1}{2} \cos(t)\cos(t) = \frac{1}{4}
(\cos{(4t)} + \cos{(2t)}) + \frac{1}{4}(\cos{(2t)} + 1) \\
& = \frac{1}{4}\cos{(4t)} + \frac{1}{2} \cos{(2t)} + \frac{1}{4}.
\end{align*}
Integrating this gives

\[U_{1}(t) = \frac{1}{16} \sin(4t) + \frac{1}{4}\sin{(2t)} + \frac{1}{4}t.\]

Now we can simplify the particular solution 

\begin{align*}
  y_{0} = U_{1} y_{1} + U_{2}y_{2} = \cdots = \frac{1}{4}t \sin(t) - \frac{1}{16} \cos(3t) + \frac{5}{16}\cos(t)
  \end{align*}

using some further trig identities (I'm really growing tired of this, sorry).
You should at least check yourself that $y_{0}^{\prime\prime} + y_{0} = \frac{1}{2}(\cos(t) + \cos(3t)) = \cos(t)\cos{(2t)}$ by Arturo's comment again.

Therefore the general solution is 
  \[
  y(t) = y_{0} + c_{1} y_{1} + c_{2} y_{2} = \frac{1}{4}t \sin(t) - \frac{1}{16} \cos(3t) + \frac{5}{16}\cos(t) + c_{1}\sin{(t)} + c_{2} \cos(t)
  \]
  for some real constants $c_{1}$ and $c_{2}$.

A: There's a general way of doing these things. You solve the homogeneous equation $y'' + y = 0$, giving $C_1\cos(t) + C_2\sin(t)$ for constants $C_1$ and $C_2$, then add to it a single solution $y_p(t)$ to the inhomogeneous equation $y'' + y = \cos(t)\cos(2t) = {1 \over 2}\cos(3t) + {1 \over 2}\cos(t)$. The result will be the general solution to your differential equation.
To find $y_p(t)$, you try $y_p(t) = a_1\cos(3t) + a_2\sin(3t) + b_1t\cos(t) + b_2t\sin(t)$. You plug it in and solve for $a_1,a_2,b_1,$ and $b_2$. Normally you just try combinations of $\cos(3t), \sin(3t), \cos(t),$ and $\sin(t)$, but since the latter two solve the homogeneous equation you have to stick a $t$ in front. I will trust Theo Buehler is right and that $a_1 = -{1 \over 16}$, $b_2 = {1 \over 4}$ and $a_2 = b_1 = 0$. Thus your general solution will be
$$y(t) = C_1\cos(t) + C_2\sin(t) -{1 \over 16}\cos(3t) + {1 \over 4}t\sin(t)$$
(The ${5 \over 16}\cos(t)$ term gets absorbed into the solution to the homogeneous equation).
