Vibrating springs, swinging pendulums, coupled circuits. The equations that describe anything that oscillates.
Hang a weight on a spring and pull it down. Let go. It oscillates up and down. Newton's second law says F = ma, which means the acceleration (second derivative of position) is proportional to the force.
For a spring with stiffness k and mass m, the restoring force is −kx, where x is displacement from equilibrium. Newton's law gives:
This is a second-order ODE because it involves the second derivative. First-order ODEs describe exponential growth/decay. Second-order ODEs describe oscillation. That one extra derivative changes everything.
Add friction proportional to velocity, and an external driving force F(t), and you get the full mass-spring-damper system:
This single equation models not just mechanical vibration but also RLC circuits (replace m with L, c with R, k with 1/C), acoustic resonators, and even simple models of building sway during earthquakes.
Start with the simplest case: no external force. The equation y'' + py' + qy = 0 (with constant coefficients p and q) is homogeneous. We need to find two linearly independent solutions, because the general solution is a linear combination of them.
The key insight: try y = erx. Plug it in: r2erx + p r erx + q erx = 0. Factor out erx (never zero):
This is the characteristic equation. Its roots determine the behavior of the solution entirely. The quadratic formula gives r = (−p ± √(p2 − 4q))/2.
The superposition principle says that if y1 and y2 are solutions, then c1y1 + c2y2 is also a solution. The two constants c1, c2 are determined by two initial conditions: y(0) and y'(0).
The discriminant Δ = p2 − 4q of the characteristic equation r2 + pr + q = 0 splits the solutions into three cases:
| Δ | Roots | General solution | Behavior |
|---|---|---|---|
| > 0 | Two distinct real r1, r2 | c1er1x + c2er2x | Overdamped |
| = 0 | Repeated real r | (c1 + c2x)erx | Critically damped |
| < 0 | Complex α ± iβ | eαx(c1cosβx + c2sinβx) | Oscillatory |
The complex case is the most physically important. When the roots are α ± iβ, the solution oscillates with frequency β and amplitude that grows or decays according to the sign of α.
Adjust p and q to move between the three cases. The discriminant Δ = p2 − 4q determines the qualitative behavior.
Return to the mass-spring-damper: mx'' + cx' + kx = 0. Divide by m: x'' + (c/m)x' + (k/m)x = 0. Define the natural frequency ω0 = √(k/m) and the damping ratio ζ = c/(2mω0).
The damping ratio ζ completely determines the qualitative behavior:
| ζ | Behavior | Physical meaning |
|---|---|---|
| ζ > 1 | Overdamped | Heavy friction, sluggish return to equilibrium |
| ζ = 1 | Critically damped | Fastest return without oscillation (car suspension goal) |
| 0 < ζ < 1 | Underdamped | Oscillation with exponentially decaying amplitude |
| ζ = 0 | Undamped | Pure sinusoidal oscillation forever |
Adjust the damping ratio ζ. Watch the spring mass oscillate (or not) after being displaced. The teal envelope shows exponential decay e−ζω0t.
Now add a driving force: y'' + py' + qy = g(x). The solution has two parts:
where yh is the homogeneous solution (what we already know) and yp is a particular solution of the full equation. The homogeneous part contains the two free constants (for initial conditions). The particular solution carries the forcing.
When g(x) is a polynomial, exponential, sine, cosine, or a product of these, we guess the form of yp with unknown coefficients, substitute, and solve for them.
| g(x) | Try yp = |
|---|---|
| Polynomial degree n | Anxn + ... + A1x + A0 |
| eax | Aeax |
| sin(bx) or cos(bx) | A cos(bx) + B sin(bx) |
| eaxsin(bx) | eax(A cos(bx) + B sin(bx)) |
Example: y'' + y = cos(x). The homogeneous solution is c1cos(x) + c2sin(x). Trying yp = A cos(x) + B sin(x) fails because these are already homogeneous solutions. Modification: try yp = x(A cos(x) + B sin(x)). Substituting yields yp = (x/2) sin(x).
Undetermined coefficients only works for special right-hand sides. Variation of parameters works for any g(x), as long as you know the homogeneous solutions y1, y2.
The idea: we know the homogeneous solution is c1y1 + c2y2. What if we let the "constants" vary? Replace c1, c2 with unknown functions u1(x), u2(x):
Substituting into the ODE and imposing the constraint u1'y1 + u2'y2 = 0 (to simplify the algebra), we get a system for u1' and u2' that involves the Wronskian:
Integrate u1' and u2' to get u1 and u2. Then yp = u1y1 + u2y2. This always works, though the integrals may be hard.
Most real systems have multiple interacting variables. Two masses connected by springs. Two tanks exchanging fluid. A predator and prey population. These are modeled by systems of first-order ODEs:
In matrix form: x' = Ax, where A is a 2×2 matrix. The solution depends entirely on the eigenvalues of A.
If A has eigenvalues λ1, λ2 with eigenvectors v1, v2, the general solution is:
For a 2D system x' = Ax, the phase portrait shows trajectories in the (x1, x2) plane. The eigenvalues of A classify the behavior at the origin (the equilibrium point):
| Eigenvalues | Phase portrait | Name |
|---|---|---|
| Both real, same sign, negative | Trajectories spiral/flow into origin | Stable node |
| Both real, same sign, positive | Trajectories flow away from origin | Unstable node |
| Real, opposite signs | Trajectories approach along one axis, leave along another | Saddle point |
| Complex, negative real part | Spirals inward | Stable spiral |
| Complex, positive real part | Spirals outward | Unstable spiral |
| Pure imaginary | Closed ellipses | Center |
Adjust the matrix entries a, b, c, d of A = [[a,b],[c,d]]. The eigenvalues and phase portrait type update live. Click to add trajectories.
This is the ultimate second-order ODE demonstration. A mass-spring-damper driven by a sinusoidal force F0cos(ωt). When the driving frequency ω matches the natural frequency ω0 and damping is low, the amplitude explodes. This is resonance.
The orange curve is the displacement x(t). Adjust ω (driving frequency) and ζ (damping). Watch amplitude peak when ω ≈ ω0 and damping is small.
Amplitude response curve (amplitude vs driving frequency):
| This lesson | Where it leads |
|---|---|
| Characteristic equation | Eigenvalues in linear algebra (Ch 4) |
| Damping ratio ζ | Transfer functions via Laplace transforms (Ch 3) |
| Phase portraits | Nonlinear dynamics, Lyapunov stability |
| Resonance | Fourier analysis decomposes any forcing into frequencies (Ch 6) |
| Systems of ODEs | State-space representation in control theory |
"The book of nature is written in the language of mathematics." — Galileo Galilei