Learning Objectives
By the end of this section you will be able to:
- Recognize when a homogeneous linear ODE has complex conjugate roots just by checking the sign of .
- Derive the real-valued general solution from the complex form using Euler's formula.
- Interpret the real part as decay/growth rate and the imaginary part as angular frequency.
- Rewrite the solution in amplitude-phase form and read off period, half-life, and phase.
- Translate between coefficient form and physical form , then classify damping regimes.
- Implement a complex-root solver in plain Python and cross-check it against PyTorch's .
Where We Pick Up: A New Kind of Root
In section 22.1 we tried in and ended up with the characteristic equation:
The quadratic formula gave us three branches depending on . We handled the two easy cases — distinct real roots and the repeated real root. This section is the third and richest one:
The promise: negative discriminants do not break the method — they turn the boring exponential growth/decay into something far more interesting: oscillation. Every spring, every pendulum, every RLC circuit, every vibrating molecule lives here.
Two questions are about to dominate the whole section:
- We started in . How did sneak in, and what do we do with it?
- Why does an imaginary root manifest as a real oscillation? What is the bridge?
The bridge is Euler's formula. Once it is in place, the rest of the section is just careful bookkeeping.
The Imaginary Wall
Take the cleanest possible example: . The characteristic equation is , giving .
Naively plug into the "general solution" from section 22.1:
This looks complex-valued. But we are modelling a real physical thing — a frictionless mass on a spring, or an LC circuit. Voltages and positions are real numbers. We need a way to express in real terms.
The discomfort is the point
The complex form is not wrong. It is simply a coordinate system that is awkward for a real-valued physical observable. The job of this section is to translate the complex coordinates into a familiar real basis — sines and cosines — without losing any information.
Euler's Bridge — From to Sines and Cosines
The single most important identity in this whole chapter is Euler's formula:
Why does this hold?
Expand the Taylor series. The series for can be regrouped into the series for and :
The trick is that , so even powers of alternate sign — exactly matching the alternating signs in the cosine and sine series.
Apply it to :
Now stitch the decaying envelope back in. For a root :
The exponential has two parts: a real exponential that decays () or grows (), and a complex rotation that spins around the unit circle at angular speed . Multiplied together they trace out a spiral in the complex plane.
The Real-Valued General Solution
Our complex pair is , . By linearity,
solves the ODE for any complex . To make real for all , we choose (complex conjugate). With and , the imaginary parts cancel and you are left with this clean real form:
General solution — complex-roots case
where , , and are determined by the initial conditions.
Reading the formula
The in front is the envelope. Whatever happens inside the parentheses, its amplitude is bounded by . The inside is a weighted sum of a cosine and a sine, both with the SAME angular frequency .
Why two real constants, not four?
A second-order ODE has a two-dimensional solution space. and are linearly independent and span that space (after multiplying by the envelope). Two constants are exactly enough to match the two initial conditions and .
Applying the initial conditions
At :
- , so .
- , so .
Solving for :
The denominator is non-zero exactly because we are in the complex-roots branch.
Anatomy of and
These two numbers are everything. They live in different directions of the complex plane and they tell different physical stories.
| Quantity | Formula | Physical meaning | Geometric meaning |
|---|---|---|---|
| α (real part) | −b / (2a) | Decay rate of the envelope. α < 0 ⇒ amplitude shrinks; α > 0 ⇒ amplitude grows. | Horizontal position of the root in the complex plane. Left half-plane = stable. |
| β (imag part) | √(−Δ) / (2a) | Angular frequency in rad/s. Period T = 2π/β, frequency f = β/(2π). | Distance of the root from the real axis. Far from the axis = fast wiggle. |
| α² + β² | c / a | Distance² of the root from the origin (in the complex plane). | For a spring this equals ωₙ², the natural frequency squared. |
| 2α | −b / a | Sum of the two roots (Vieta's formula). | Twice the real part — used as the trace of the system matrix. |
A two-knob mental model
Imagine you are designing an instrument. The knob controls how quickly the note fades; the knob controls the pitch. Set and the note rings forever. Make more negative and the note dies sooner. Change and the same envelope holds a different musical pitch.
Amplitude–Phase Form: One Tilted Cosine
The form is algebraically convenient but visually awkward — it's a SUM of two wiggles. There is a beautiful alternative.
Use the identity with
Then the whole solution collapses to a single damped cosine:
Reading this off a measured oscilloscope trace is now trivial:
- Amplitude = the initial peak (before any decay).
- Envelope = the dashed curve touching every peak.
- Frequency = how fast it wiggles (rad/s).
- Phase = how far the first peak is shifted from .
Why atan2, not atan?
uses the signs of both arguments to return an angle in , distinguishing all four quadrants. Plain would collapse the second and fourth quadrants together (since dividing two negatives kills the sign info), giving you the wrong phase half the time.
Worked Example (Step-by-Step)
Take this concrete IVP:
We will derive every number on paper, then verify with the explorer and the Python solver below.
▸ Show full hand-derivation (recommended on first read)
Step 5 — Apply
Plug : . So .
Step 6 — Apply
From :
Interactive: Roots in the Complex Plane
Drag the upper red root anywhere in the complex plane and watch what happens to the time-domain plot and the phase-plane spiral. The envelope is drawn in dashed amber so you can see exactly which curve the oscillation lives inside.
Three experiments worth doing
- Pull the root all the way to the imaginary axis (). The envelope flattens to constant ±A, the phase-plane orbit closes into an ellipse. This is the undamped regime — perpetual motion.
- Cross into the right half-plane (). The envelope flips to a growing exponential, the spiral flies outward. This is an unstable system — think inverted pendulum, or a poorly tuned PID loop that oscillates more violently with every cycle.
- Increase with fixed. The envelope is unchanged but the wiggles get faster. The spiral makes more turns per inward step — high-frequency, low-damping.
Damping in Disguise: and
Engineers rarely speak in terms of . They use two physically meaningful parameters: the natural frequency and the damping ratio . They rewrite the ODE in the canonical form
which matches with and .
Computing the discriminant in this notation gives . So the three cases reorganise themselves into a single dimensionless story:
| ζ value | Δ sign | Regime | α (decay rate) | β (oscillation freq) |
|---|---|---|---|---|
| ζ = 0 | < 0 | Undamped | 0 | ωₙ |
| 0 < ζ < 1 | < 0 | Underdamped (complex roots) | −ζ·ωₙ | ωₙ·√(1 − ζ²) ≡ ωd |
| ζ = 1 | = 0 | Critically damped | −ωₙ | 0 (no oscillation) |
| ζ > 1 | > 0 | Overdamped | two real roots | 0 (no oscillation) |
The damped frequency ωd
When you measure a real oscillation you see , NOT the natural frequency . Damping slows the wiggle. For the difference is only 0.5%; for it's about 13%; at the wiggle disappears entirely.
Engineer's rule of thumb
is the industry-favourite damping ratio for control systems. It gives a fast response (small means snappy) with only a single tiny overshoot (large means well-behaved). The trade-off between speed and overshoot is exactly what parameterises.
Interactive: Four Regimes from One Spring
Same mass-spring system, four different dampers. The four ghost traces stay visible so you can compare them against the active curve. Move continuously through 0, 1, and above 1 and watch the regime change in real time.
Python: Closed-Form Solver from Scratch
We will build a single function that takes and returns along with the physical diagnostics — , period, half-life. Plain NumPy, no special-case libraries.
Why hand-derive when scipy.integrate.solve_ivp exists?
Closed-form solutions let you reason about a system before you simulate it. You can read off the period, the half-life, the steady-state behaviour, all without running a single step. A numerical solver tells you what happens; the closed form tells you why.
PyTorch: The Matrix-Exponential Picture
There is one routine that solves ALL three cases (real distinct, repeated, complex) without any branching on the discriminant: the matrix exponential. Convert the 2nd-order ODE into a first-order linear system with , and the solution is just .
The eigenvalues of are exactly the roots of the characteristic equation. For our worked example PyTorch will print — the same pair we derived by hand.
Eigenvalues = roots: the unifying view
The characteristic equation is, up to sign, exactly the characteristic polynomial of the 2×2 system matrix . So "find the roots of the characteristic equation" and "find the eigenvalues of " are the same computation. This connection scales perfectly: an -th order ODE becomes an first-order system, and the eigenvalues still classify the dynamics.
Where Complex Roots Show Up in the Real World
🪨 Car suspension
A shock absorber over a bump: . Designers pick so that — fast settle with only a barely-perceptible overshoot.
⚡ RLC circuit
. Same equation. plays the role of damping; a low-R resonator (e.g. a quartz crystal) has tiny and rings for millions of cycles.
🧬 Molecular vibrations
A diatomic molecule's stretching mode is a damped oscillator whose tells you the infrared-absorption frequency. Spectroscopy = measuring .
🤖 Gradient descent with momentum
Heavy-ball / momentum SGD near a quadratic minimum behaves exactly like an underdamped oscillator. Picking the momentum coefficient badly puts you in the underdamped regime — you see the loss oscillate. Pick it as if you were tuning for critical damping.
🏙️ Building sway in wind
Skyscrapers have tuned mass dampers (huge pendulums in the penthouse) sized to push the building's up to a comfortable level. Without them, residents feel underdamped sway for tens of seconds after a gust.
🎛️ Audio synthesizers
A plucked-string sound is a damped oscillator chosen to give a long ringing tail. The decay rate sets "sustain"; sets pitch.
Common Pitfalls
1. Confusing β with f (Hz)
is in radians per second. The ordinary frequency in Hz is . Period is . Mixing these up by a factor of is the most common numerical bug in textbook problems.
2. Forgetting that β is √(−Δ)/(2a), not √Δ/(2a)
In the complex branch , so is not real. The correct imaginary part uses . If you blindly type sqrt(disc) into Python and it returns a NaN, you have just rediscovered this trap.
3. Treating the envelope as the solution
bounds the solution but is not itself a solution. The actual touches the envelope only at the peaks of the cosine. Average behaviour: zero crossings every .
4. atan vs atan2 for the phase
alone can't tell from — both give ratio 1. Always use when computing phase, exactly as the Python code above does.
5. Numerical issues near ζ = 1
Right at the critical damping boundary the formulas split. Code that branches on vs needs a tolerance — pure equality almost never triggers. The matrix-exponential approach sidesteps this completely since it has no branches.
Summary
What to take away
- Complex roots happen iff .
- The roots are with and .
- Euler's formula turns the complex exponential into a sum of sines and cosines.
- The real general solution is , equivalently .
- is the decay rate of the envelope; is the angular frequency of the oscillation. Left half-plane = stable; imaginary axis = perpetual motion; right half-plane = unstable growth.
- Engineers reparameterise as . The damping ratio classifies all four regimes: undamped (0), underdamped (0–1), critical (1), overdamped (>1).
- The same equation is the textbook model for springs, RLC circuits, molecules, momentum-SGD, and skyscrapers in the wind. Master this section and you have mastered every linear oscillator in physics and engineering.
Looking ahead: next section we close the loop with the third case — the repeated root — and explain why the second independent solution suddenly grows a factor of . After that we leave the homogeneous world entirely and add a forcing term to the right-hand side.