Learning Objectives
By the end of this section you will be able to:
- Write the driven oscillator equation and identify which of its terms produce the transient and which produce the steady state.
- Derive the steady-state amplitude and phase lag using the complex-exponential (impedance) method.
- Explain resonance physically — what happens to a lightly damped system when the driving frequency approaches the natural frequency.
- Compute the resonant frequency, the maximum amplitude, and the quality factor .
- Recognize beats in the undamped limit and the unbounded resonance solution .
- Simulate a driven oscillator in Python (RK4) and sweep frequencies in PyTorch with one complex line.
The Driving Question
“A child on a swing weighs 20 kg. You weigh 80 kg. Why can the child push the swing higher than you can?”
Anyone who has watched a playground knows the answer: the child pushes at the right rhythm. Every nudge arrives just as the swing reaches its forward edge, adding energy stride for stride. An adult applying ten times the force at the wrong rhythm gets nowhere — the push sometimes accelerates, sometimes brakes, averaging out.
That intuition is resonance. A small, repeated, perfectly-timed input causes a huge response. The mathematics of this section is just the precise language to say it. By the end you'll know exactly which rhythm, exactly how big the response gets, and exactly why it grows.
🌉 Civil / structural
- Tacoma Narrows bridge (1940)
- Skyscraper sway in wind
- Footbridges & pedestrian sync
📡 Electronics
- AM/FM radio tuners
- LC bandpass filters
- Crystal & MEMS oscillators
🧲 Physics / medicine
- NMR / MRI spin precession
- LIGO mirror suspension
- Microwave ovens (H₂O dipole)
The Equation of a Driven Oscillator
Take the mass–spring–damper from Section 22.06 and add an external force pushing the mass. Newton's second law says
The most important and most studied case is a sinusoidal force at a single frequency :
| Symbol | Meaning | Units |
|---|---|---|
| m | Mass | kg |
| c | Viscous damping coefficient | Ns/m |
| k | Spring stiffness | N/m |
| F₀ | Amplitude of the driving force | N |
| ω | Angular frequency of the driving force | rad/s |
| ω₀ = √(k/m) | Natural angular frequency of the undamped system | rad/s |
| ζ = c / (2√(mk)) | Damping ratio (dimensionless) | — |
Why one frequency is enough
Any reasonable periodic force can be written as a sum of sinusoids (Fourier series). Because the equation is linear, the response to a sum is the sum of the responses. So if you understand the steady state for a single cosine, you can build the response to any forcing by superposition. The single-cosine problem is the atom of the whole subject.
Transient + Steady State
Because the equation is linear, its general solution splits into two pieces:
| Piece | Solves | Long-time behavior |
|---|---|---|
| Homogeneous xₕ(t) | m x″ + c x′ + k x = 0 | Decays to 0 whenever c > 0 (every real system has friction). Carries the initial conditions. |
| Particular xₚ(t) | m x″ + c x′ + k x = F₀ cos(ωt) | A sustained oscillation at the DRIVING frequency ω, NOT the natural frequency. |
Two punchlines about damped, driven systems
- After a few damping times (a few times ) only the steady state remains. The system forgets its initial conditions.
- The steady state oscillates at the driving frequency , not at the natural frequency . The natural frequency only controls how big the response is, not how fast it wiggles.
Finding the Steady-State Solution
We need a particular solution. The classical guess is , but the clean way to derive it uses complex exponentials. Replace the real forcing with (we'll take the real part at the end) and guess
Differentiating twice multiplies by , so and . Plugging in:
Cancel the common factor and solve for :
The denominator is called the (mechanical) impedance , in direct analogy with the electrical impedance of an RLC circuit. One complex number per frequency contains everything: take its modulus to get the amplitude, its argument to get the phase.
Why this complex trick works
Differentiation is — multiplication by . So the differential operator becomes the scalar when acting on . Differential equations collapse into algebra. This is the seed of the Laplace and Fourier transforms.
Amplitude and Phase Lag — The Core Formulas
Write in polar form (negative sign so is the phase the mass lags the force by). Taking the real part of recovers the real steady state:
where the amplitude and phase are obtained from and :
These two formulas are the heart of every vibration textbook in existence. Memorize them — or better, learn to re-derive them in 30 seconds with the impedance trick above.
Three regimes of phase lag
- Below resonance : denominator is positive, . Mass moves in phase with the force — it follows the push almost instantly.
- At resonance : , so . Mass moves a quarter cycle behind the force. The force is doing maximum positive work because it's aligned with the velocity, not the displacement.
- Above resonance : denominator becomes negative, . Mass moves opposite the force — inertia dominates.
Resonance: Why a Small Push Can Become Huge
Look at the amplitude formula and pretend you can pick . You want to be as large as possible, so you want the denominator to be as small as possible.
The first term can be made exactly zero by choosing . Then only the damping term is left, and
If , this blows up. That is the mathematical story behind every “a bridge fell down because the wind oscillated at the bridge's natural frequency” anecdote.
Resonance peak vs natural frequency — a subtlety
If you set carefully, the actual maximum of occurs at the slightly lower , not exactly at . For light damping the difference vanishes. The peak even disappears entirely once : the system is so over-damped that no resonance is visible.
The quality factor packages the “sharpness” of the peak into one number:
At resonance : the static deflection is amplified by Q. A car tire (), a guitar string (), a crystal oscillator () and a LIGO mirror () span twelve orders of magnitude on the same single equation.
Interactive: The Universal Resonance Curve
Below is the dimensionless resonance curve with . Slide from 0.05 (sharp peak) toward 1 (peak disappears) and watch the bandwidth widen as the peak shrinks. The phase plot beneath it always crosses at — that is the universal signature of resonance.
Interactive: Live Driven Oscillator
Now watch the whole story unfold in time. Start with the default values () — the system is being driven exactly at its natural frequency . The amber curve starts at zero and builds toward the cyan steady-state envelope at . Then try sliding off the resonance — the amplitude collapses almost immediately.
Things to try in the explorer
- Drop to and click Snap ω = ω₀. Resonance becomes spectacular.
- Push to (well above ). Notice the phase lag plot — the mass barely moves and lags by nearly 180°.
- Turn off the steady-state overlay and watch only the amber curve. See how it transitions from an “ugly” combination of two frequencies (transient + drive) into a clean single-frequency oscillation as the transient dies.
Worked Example (Step-by-Step)
Let's do every step by hand for the system in the simulator: , , , , , , .
Click to expand the full hand calculation
Step 1 — Natural frequency and damping ratio
The system is being driven at exactly . The damping ratio is — lightly damped. We expect a clear, sharp resonance.
Step 2 — Steady-state amplitude
The steady-state amplitude is meters per Newton of force — 2.5× larger than the static deflection . The amplification factor is exactly the quality factor . Wait — 2.5/0.5 = 5. Confirmed.
Step 4 — Transient
The homogeneous problem is . Characteristic equation: . Discriminant (underdamped). Roots: with and .
General homogeneous solution:
Step 7 — Sanity checks
- . ✅
- . ✅
- At late times : , so the transient is — completely negligible next to the 2.5 amplitude steady state. ✅
The amber curve in the simulator above is exactly this function. Slide away from 2 and the amplitude crashes from 2.5 to a fraction of an inch — verifying that the resonance peak is the entire show.
The Undamped Case: Beats and Pure Resonance
Set . The amplitude formula becomes , which is finite for every but blows up at . What actually happens?
Off-resonance: beats
When is close to but not equal to , with initial conditions zero:
Using the sum-to-product identity ,
The fast factor at frequency looks like a normal oscillation, but it's amplitude-modulated by the slow factor at frequency — that's a beat. You hear beats when you tune a guitar string near a reference pitch: the volume swells and fades at the difference frequency.
On resonance: secular (linear-in-t) growth
The above formula has a 0/0 problem at . Take the limit carefully (L'Hôpital, or use the method of undetermined coefficients with ) and you find
The amplitude grows linearly forever. In an ideal undamped system, a perfectly tuned force pumps unlimited energy into the oscillator. Real systems are saved by either nonzero damping (the system never quite gets there) or by nonlinearity (the spring stops being Hookean at large displacements).
Tacoma Narrows, in one sentence
The 1940 Tacoma Narrows bridge collapse was not simple linear resonance from steady wind. It was a self-excited aeroelastic flutter in which the bridge's motion changed the airflow, which then re-fed the motion — a fundamentally nonlinear feedback loop. The intuition you build from this section still helps: a small input at the right frequency was dramatically amplified. The full mechanism is a nonlinear extension covered in aerodynamics courses.
Computation in Python
Two ingredients: the algebraic formulas, and a plain RK4 integrator that solves the full ODE. We check that the integrator's late-time output matches the algebra.
PyTorch: Complex-Impedance Sweep
The complex form is one line of vectorized math. PyTorch's native complex tensors let us sweep hundreds of frequencies at once, then pull out amplitude, phase, and quality factor with a few more lines. This is exactly how vibration engineers compute “frequency-response functions” in production tools.
Why PyTorch and not just NumPy?
For this scalar example, NumPy would work identically (it also has complex arrays). PyTorch matters once you want to differentiate through the resonance curve — e.g. optimize a vibration absorber by gradient descent on the peak amplitude, or include this physics inside a neural-network controller. Then having every quantity as a torch.Tensor with means PyTorch's autograd computes for free.
Where Resonance Shows Up
| System | Driving force | What ω₀ corresponds to | Q typical |
|---|---|---|---|
| Car suspension | Bumps in the road at speed v / λ | ≈ 1 Hz (designed soft) | 5–10 |
| Tall building under wind | Vortex shedding behind the structure | 0.1–1 Hz (mass dampers detune it) | 20–50 |
| Quartz watch crystal | Electronic feedback oscillator | 32 768 Hz (= 2¹⁵) | 10⁵–10⁶ |
| MRI 1H nuclei | RF pulse | γ B₀ / 2π ≈ 64 MHz at 1.5 T | 10³ in tissue |
| LC radio tuner | Antenna voltage at every broadcast frequency | 1/√(LC) | 50–200 |
| Microwave oven | 2.45 GHz EM wave | Rotational mode of H₂O dipole | low — by design (broad heating band) |
| LIGO test mass | Seismic noise + radiation pressure | ≈ 0.5 Hz pendulum mode | 10⁷ |
Every row uses the same equation. The only thing changing is the units of . That is the power of having one canonical form: solve it once, recognize it everywhere.
Common Pitfalls
Confusing ω₀, ω_d, and ω_peak
Three frequencies all live near each other and get mixed up. Keep them straight:
- — the undamped natural frequency. Depends only on and .
- — the damped natural frequency. The frequency you actually see in the transient ringing.
- — the frequency that maximizes the driven amplitude .
For tiny all three collapse to the same number. For larger damping they spread out, and confusing them leads to wrong predictions of where the peak sits.
Forgetting to add the transient
The steady state alone is NOT the full solution. It almost never satisfies your initial conditions. Always write and use BOTH and to pin down the two constants in .
Dividing by zero in the undamped resonance
For and , the formula is undefined. Don't just “assume it's infinite” — the actual particular solution is the secular form we derived in the undamped section. Numerical solvers that step too far without damping will accumulate spurious energy and explode.
Sign of the phase
Textbooks differ on whether means the angle by which the response lags the input or leads the input. Our convention here: with a non-negative lag. Always check the convention before reading someone else's Bode plot.
Summary
| Concept | Formula | Meaning |
|---|---|---|
| Driven oscillator equation | m x″ + c x′ + k x = F₀ cos(ωt) | Linear, constant-coefficient, sinusoidally forced second-order ODE. |
| Steady-state ansatz (complex) | x_p = X e^{iωt}, X = F₀ / Z(ω) | Differential equation collapses into algebra by exp ansatz. |
| Impedance | Z(ω) = (k − mω²) + i c ω | Single complex number per frequency. Mechanical analogue of electrical impedance. |
| Amplitude | A(ω) = F₀ / √((k − mω²)² + (cω)²) | Gain. Peaks near ω = ω₀; height controlled by damping. |
| Phase lag | tan φ(ω) = cω / (k − mω²) | Crosses π/2 exactly at ω = ω₀ — universal signature of resonance. |
| Resonance peak | ω_p = ω₀√(1 − 2ζ²); A_max = (F₀/k)·Q | Slightly below ω₀ for damped systems. Peak vanishes for ζ ≥ 1/√2. |
| Quality factor | Q = 1/(2ζ) = √(mk)/c = ω₀/Δω | Sharpness of the resonance peak; ratio of stored to dissipated energy per cycle. |
| Undamped on-resonance solution | x_p = (F₀ / 2mω₀) · t · sin(ω₀ t) | Linear (secular) growth — the source of every Tacoma-Narrows story. |
| Beats | x = (2F₀ / m(ω₀² − ω²)) · sin(½(ω₀+ω)t) · sin(½(ω₀−ω)t) | Slow envelope modulating a fast carrier when ω is close to but not equal to ω₀. |
The one-line takeaway
A linear second-order system, driven at frequency , responds at the same frequency, with amplitude and lag . The impedance dips closest to zero near , and that dip — the resonance — is responsible for every story in this section, from a child on a swing to a quartz crystal vibrating thirty thousand times a second inside your wristwatch.