Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|cite|improve this question
Would a sum of cosines be easier than a product of cosines? – Arturo Magidin Feb 28 '11 at 20:12
Sure! What are you thinking of? – aesede Feb 28 '11 at 20:23
$\cos(a+b) = \cos(a)\cos(b) - \sin(a)\sin(b)$; $\cos(a-b) = \cos(a)\cos(b) + \sin(a)\sin(b)$. So $\cos(a)\cos(b) = \frac{1}{2}(\cos(a+b) + \cos(a-b))$. In particular, $\cos(t)\cos(2t) = \frac{1}{2}(\cos(3t) + \cos(t))$. – Arturo Magidin Feb 28 '11 at 20:30
Do you now manage to solve it? – Fabian Feb 28 '11 at 21:56
Thanks, Arturo! That was really helpful. – aesede Mar 1 '11 at 13:54

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}$.

share|cite|improve this answer
Your approach is the variation of parameters method ($y_p=\nu_1y_1+\nu_2y_2$, solve for $\nu_1'$ and $\nu_2'$ and integrate), which works for any inhomogeneous equation. Arturo's re-writing of $\cos(t)\cos(2t)$ as $\frac{1}{2}(\cos(3t) + \cos(t))$ allows one to use the much simpler method of undetermined coefficients. – Eric Nitardy Mar 1 '11 at 0:12
@Eric, ah, ok. Thanks! That could have saved some work... – t.b. Mar 1 '11 at 0:52
@Eric, if you want to fill in the details in a separate answer, feel free to do so. I'm not going to do it. – t.b. Mar 1 '11 at 1:07

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).

share|cite|improve this answer
Thanks for giving this much easier solution and the general hint, I was about to add it now and I am glad not to have to do it. – t.b. Mar 1 '11 at 9:45
Thank you, Zarrax! – aesede Mar 3 '11 at 13:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.