Skip to content
Tutorials Center
My learning

Topics

Lesson 34 of 68 ยท Differential Equations

Second-Order Linear ODEs

Solve second-order linear ODEs with the characteristic equation, classify damping regimes, model spring-mass and RLC systems, and explore resonance in Python.

Whenever acceleration appears in a model, you get a second derivative. A mass on a spring, a pendulum at small angles, a car suspension, a building swaying in wind, and an electrical circuit with a resistor, inductor and capacitor all obey the same kind of equation: a second-order linear ODE with constant coefficients. Learn it once and you have learned vibration, oscillating circuits and the core of control theory.

The equation has the form a*y'' + b*y' + c*y = f(t). When f(t) = 0 it is homogeneous (free motion, no outside push); when f(t) is non-zero it is forced. This lesson builds on first-order ODEs and on exponentials, and prepares the ground for the Laplace transform.

The characteristic equation

For a*y'' + b*y' + c*y = 0, try the guess y = exp(m*t). Since y' = m*exp(m*t) and y'' = m**2 * exp(m*t), substituting and dividing by the never-zero exp(m*t) leaves the characteristic equation:

a*m**2 + b*m + c = 0.

It is an ordinary quadratic, so there are three cases, depending on the discriminant b**2 - 4*a*c:

Roots General solution Behaviour
two distinct real m1, m2 C1*exp(m1*t) + C2*exp(m2*t) pure exponentials, no oscillation
one repeated real m (C1 + C2*t)*exp(m*t) fastest return without overshoot
complex p ยฑ q*i exp(p*t)*(C1*cos(q*t) + C2*sin(q*t)) oscillation with envelope exp(p*t)

Two constants appear because the order is two, so an initial value problem needs two conditions: typically the starting position y(0) and velocity y'(0). The complex case uses Euler's formula to turn exp(i*q*t) into sines and cosines.

flowchart TD
    A["a m^2 + b m + c = 0"] --> B{"discriminant"}
    B -- "greater than 0" --> C["overdamped: two real roots"]
    B -- "equal to 0" --> D["critically damped: one repeated root"]
    B -- "less than 0" --> E["underdamped: complex roots, oscillation"]

The sign of the discriminant decides the character of the motion.

Spring-mass systems

A mass m on a spring with stiffness k and a damper with coefficient c follows Newton's second law, giving

m*x'' + c*x' + k*x = F(t)

where x is the displacement from rest. The three terms are inertia, damping force and spring force. Without damping (c = 0) the motion is a pure oscillation with natural frequency w0 = sqrt(k/m) radians per second. It is convenient to use the damping ratio zeta = c / (2*sqrt(k*m)). Then:

  • zeta < 1: underdamped (oscillates while fading),
  • zeta = 1: critically damped (no overshoot, fastest settling),
  • zeta > 1: overdamped (sluggish, no oscillation).

Car shock absorbers are tuned near critical damping so the car does not bounce after a bump, and a door closer is deliberately close to critical so the door shuts without slamming.

Python Classify roots and compare damping

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

You will see the underdamped curve cross zero repeatedly while shrinking, the critically damped one reach zero fastest without crossing, and the overdamped one creep back slowly. For x'' + 3x' + 2x = 0 the roots are -1 and -2 and the solution that starts at rest from 1 is 2*exp(-t) - exp(-2*t).

RLC circuits

Kirchhoff's voltage law for a series circuit with inductance L, resistance R, capacitance C and source voltage V(t) gives, for the capacitor charge q:

L*q'' + R*q' + q/C = V(t).

This is the same equation as the spring-mass system with a dictionary: mass m is inductance L, damping c is resistance R, stiffness k is 1/C, and displacement is charge. Currents are i = q'. So the natural frequency is w0 = 1/sqrt(L*C) and the circuit is critically damped when R = 2*sqrt(L/C). A radio tuner exploits a lightly damped RLC loop: it responds strongly to one frequency, which brings us to resonance.

Forced response and resonance

When a periodic force F0*cos(w*t) drives the system, the solution is the free (transient) response, which dies out when there is damping, plus a steady-state response at the driving frequency w. The steady-state amplitude is

A(w) = F0 / sqrt((k - m*w**2)**2 + (c*w)**2).

The denominator is smallest, so the amplitude is largest, when w is close to the natural frequency. This is resonance. With light damping the peak is tall and narrow; with heavy damping it flattens. In the damping-free limit the amplitude would be infinite: if y'' + w0**2 * y = cos(w0*t), the solution grows like t*sin(w0*t)/(2*w0), linearly without bound. Real systems fail or saturate instead, which is why soldiers break step on bridges and why engineers check structural natural frequencies against engine or wind frequencies.

When the driving frequency is close to but not equal to w0 in an undamped system, you get beats: a fast oscillation whose amplitude slowly swells and shrinks, familiar from tuning two guitar strings.

Python Resonance curves and a growing response

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The printed peaks show the pattern: the lighter the damping, the larger the peak, and the peak sits at or just below the natural frequency of 2 (at w0*sqrt(1 - 2*zeta**2) for the amplitude of displacement). The final line gives the growing solution t*sin(2t)/4, whose amplitude increases linearly with t.

To check a hand-derived second-order solution, differentiate it twice and substitute it back, or call sp.checkodesol. Also test the initial conditions: values at t = 0 for both y and y'.

Particular solutions for forced systems

For a*y'' + b*y' + c*y = f(t) the general solution is y = y_h + y_p: the homogeneous solution plus one particular solution that handles the forcing. The method of undetermined coefficients guesses y_p with the same form as f: a polynomial for a polynomial forcing, A*cos(w*t) + B*sin(w*t) for a sinusoid, A*exp(r*t) for an exponential. Substitute, then solve for A and B. If the guess already solves the homogeneous equation (the resonance case), multiply it by t. For anything messier, dsolve or the Laplace transform does the bookkeeping for you.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. The characteristic equation of y'' - 5y' + 6y = 0 has roots:

    m**2 - 5m + 6 = (m - 2)(m - 3), so the roots are 2 and 3 and the solution is C1exp(2t) + C2exp(3t).
  2. 2. An oscillator has complex roots -2 ยฑ 3i. What does its motion look like?

    The real part -2 gives the decaying envelope exp(-2t); the imaginary part 3 is the angular frequency.
  3. 3. For m = 1 and k = 9, what damping coefficient c makes the system critically damped?

    Critical damping needs c = 2sqrt(km) = 2*sqrt(9) = 6, where the discriminant c**2 - 4mk is zero.
  4. 4. In the analogy between a spring-mass system and a series RLC circuit, resistance R corresponds to:

    R dissipates energy like a damper. L plays the role of mass and 1/C the role of stiffness.
  5. 5. What happens to the steady-state amplitude at resonance when damping is reduced?

    At resonance the amplitude is roughly F0 divided by c times w0, so less damping gives a taller peak.

Summary

  • a*y'' + b*y' + c*y = 0 is solved by trying exp(m*t), which leads to the characteristic equation a*m**2 + b*m + c = 0.
  • Distinct real roots give exponentials, a repeated root adds a factor t, and complex roots p ยฑ q*i give an oscillation inside exp(p*t).
  • Spring-mass and RLC systems share one equation; the damping ratio zeta classifies them as under-, critically or overdamped.
  • A sinusoidal force produces a steady-state response whose amplitude peaks near the natural frequency: resonance.
  • The general forced solution is homogeneous plus particular; undetermined coefficients finds the particular part.

Next: Solving ODEs Numerically.