Push a spring periodically with a force $F_0\cos\omega t$ and you get $mx'' + cx' + kx = F_0\cos\omega t$, a job for undetermined coefficients. The interesting question is how the response depends on the driving frequency $\omega$ compared with the natural frequency $\omega_0 = \sqrt{k/m}$ from free vibrations.
Key idea
Undamped, $\omega \ne \omega_0$: $x_p = \dfrac{F_0}{m(\omega_0^{2} - \omega^{2})}\cos\omega t$; the amplitude grows as $\omega \to \omega_0$.
Resonance, $\omega = \omega_0$: $x_p = \dfrac{F_0}{2m\omega_0}\,t\sin\omega_0t$, which grows without bound.
Damped: the steady response has amplitude $\dfrac{F_0}{\sqrt{(k - m\omega^{2})^{2} + (c\omega)^{2}}}$, largest near $\omega_0$ when $c$ is small.
Resonance, $\omega = \omega_0$: $x_p = \dfrac{F_0}{2m\omega_0}\,t\sin\omega_0t$, which grows without bound.
Damped: the steady response has amplitude $\dfrac{F_0}{\sqrt{(k - m\omega^{2})^{2} + (c\omega)^{2}}}$, largest near $\omega_0$ when $c$ is small.
Why it works
Try $x_p = A\cos\omega t$ in $mx'' + kx = F_0\cos\omega t$: $(k - m\omega^{2})A = F_0$. This works unless $k = m\omega^{2}$, that is, $\omega = \omega_0$, when $\cos\omega t$ already solves the homogeneous equation; then the guess needs a factor $t$, and the amplitude grows linearly. Starting from rest near resonance, $x$ $= \frac{F_0}{m(\omega_0^{2} - \omega^{2})}(\cos\omega t$ $- \cos\omega_0t)$, and the identity $\cos A - \cos B$ $= 2\sin\frac{B - A}{2}\sin\frac{A + B}{2}$ shows a fast oscillation inside a slow envelope: beats.
Worked example: Beats from rest
Solve $x'' + 4x = 3\cos t$, $x(0) = 0$, $x'(0) = 0$.
- $\omega_0 = 2$, $\omega = 1$. Try $A\cos t$: $(4 - 1)A = 3$, so $A = 1$.
- $x = c_1\cos 2t + c_2\sin 2t + \cos t$; $x(0) = c_1 + 1 = 0$ and $x'(0) = 2c_2 = 0$.
Answer: $x = \cos t - \cos 2t$
Worked example: Resonance
Solve $x'' + 4x = 8\cos 2t$, $x(0) = 0$, $x'(0) = 0$.
- $\omega = \omega_0 = 2$: try $x_p = t(A\cos 2t + B\sin 2t)$.
- Substituting leaves $4(-A\sin 2t + B\cos 2t)$ $= 8\cos 2t$, so $A = 0$, $B = 2$.
- With $x(0) = x'(0) = 0$ the homogeneous constants are 0.
Answer: $x = 2t\sin 2t$, swings that grow like $t$
Worked example: Damped steady amplitude
Find the steady amplitude for $x'' + 4x' + 4x = 10\cos t$.
- $k - m\omega^{2} = 4 - 1 = 3$ and $c\omega = 4$.
- Amplitude $= \frac{10}{\sqrt{9 + 16}} = \frac{10}{5}$.
Answer: 2
Common mistake
Locating resonance at $\omega = k$ or $\omega^{2} = k$ when $m \ne 1$. Resonance happens at $\omega = \sqrt{k/m}$. Another slip is keeping the guess $A\cos\omega_0t$ at resonance; it gives $0 = F_0\cos\omega_0t$, the sign that a factor $t$ is needed.