differential equations30 min

Second-Order Linear ODEs

Second-order linear ODEs with constant coefficients, the characteristic equation, and the three types of solutions

0/9Not Started

Why This Matters

A second-order ODE involves the second derivative -- it relates a quantity to its acceleration, not just its velocity. This is the language of vibrations, oscillations, and waves. When a spring bounces, a bridge sways, or an electrical circuit rings, the behavior is governed by a second-order ODE.

The key insight is the characteristic equation. For a homogeneous linear ODE with constant coefficients like ay'' + by' + cy = 0, you guess a solution of the form y = e^(rx), plug it in, and get a quadratic equation in r. The roots of this quadratic completely determine the nature of the solution: two real roots give exponential behavior, repeated roots give a special blended form, and complex roots give oscillations. One quadratic equation tells you everything.

Define Terms

Visual Model

ay′′ + by′ + cy = 02nd-order linear ODE
Guess y = e^(rx)Exponential ansatz
ar^2 + br + c = 0Characteristic equation
Two Real Rootsr1 != r2
Repeated Rootr1 = r2
Complex Rootsa +/- bi
C1*e^(r1*x) + C2*e^(r2*x)Exponential decay or growth
(C1 + C2*x)*e^(r*x)Critically damped
e^(ax)(C1*cos(bx) + C2*sin(bx))Oscillatory

The full process at a glance. Click Start tour to walk through each step.

The characteristic equation is a quadratic whose discriminant determines the solution type: exponential, critically damped, or oscillatory.

Code Example

Code
// Classify second-order ODE: a*y"" + b*y" + c*y = 0
// by solving the characteristic equation: a*r^2 + b*r + c = 0

function classifyODE(a, b, c) {
  const discriminant = b * b - 4 * a * c;
  console.log(`Characteristic equation: ${a}r^2 + ${b}r + ${c} = 0`);
  console.log(`Discriminant: ${discriminant}`);

  if (discriminant > 0) {
    const r1 = (-b + Math.sqrt(discriminant)) / (2 * a);
    const r2 = (-b - Math.sqrt(discriminant)) / (2 * a);
    console.log(`Two real roots: r1=${r1}, r2=${r2}`);
    console.log(`Solution: y = C1*e^(${r1}x) + C2*e^(${r2}x)`);
    return "two-real";
  } else if (discriminant === 0) {
    const r = -b / (2 * a);
    console.log(`Repeated root: r=${r}`);
    console.log(`Solution: y = (C1 + C2*x)*e^(${r}x)`);
    return "repeated";
  } else {
    const realPart = -b / (2 * a);
    const imagPart = Math.sqrt(-discriminant) / (2 * a);
    console.log(`Complex roots: ${realPart} +/- ${imagPart.toFixed(3)}i`);
    console.log(`Solution: y = e^(${realPart}x)(C1*cos(${imagPart.toFixed(3)}x) + C2*sin(${imagPart.toFixed(3)}x))`);
    return "complex";
  }
}

// Example 1: y"" - 5y" + 6y = 0 (two real roots)
console.log("--- Example 1 ---");
classifyODE(1, -5, 6);

// Example 2: y"" + 2y" + 1 = 0 (repeated root)
console.log("\n--- Example 2 ---");
classifyODE(1, 2, 1);

// Example 3: y"" + 4y = 0 (complex roots -- pure oscillation)
console.log("\n--- Example 3 ---");
classifyODE(1, 0, 4);

// Example 4: y"" + 2y" + 5y = 0 (damped oscillation)
console.log("\n--- Example 4 ---");
classifyODE(1, 2, 5);

Interactive Experiment

Try these exercises:

  • Classify y'' - 4y = 0. What are the roots? Is the solution oscillatory or exponential?
  • Classify y'' + 9y = 0. What frequency of oscillation does the solution have?
  • For y'' + 2y' + y = 0 (repeated root r = -1), verify that both e^(-x) and x*e^(-x) satisfy the ODE by plugging them in.
  • What happens to the oscillation in y'' + by' + 4y = 0 as you increase b from 0 to 4? At what value of b do oscillations disappear?
  • Try a = 2 in 2y'' + 3y' + y = 0. How does changing the leading coefficient affect the roots?

Quick Quiz

Coding Challenge

Characteristic Equation Classifier

Write a function called `classifyRoots` that takes coefficients a, b, c of the characteristic equation ar^2 + br + c = 0 and returns a string: 'two-real' if the discriminant is positive, 'repeated' if zero, or 'complex' if negative. Also print the roots in the format shown in the test cases.

Loading editor...

Real-World Usage

Second-order linear ODEs govern fundamental physical systems:

  • Mechanical vibrations: A mass on a spring follows my'' + cy' + ky = 0. The three solution types correspond to overdamped, critically damped, and underdamped motion.
  • Electrical circuits: An RLC circuit follows LQ'' + RQ' + Q/C = 0. The discriminant determines whether the circuit oscillates or decays monotonically.
  • Structural engineering: Building sway in wind or earthquakes is modeled by second-order ODEs. Engineers design dampers to avoid resonance.
  • Audio and signal processing: Second-order filters (biquad filters) are based on second-order ODEs. They are the building blocks of equalizers and synthesizers.
  • Control systems: The characteristic equation of a second-order system determines stability, overshoot, and settling time -- critical parameters in autopilots and robotics.

Connections