Second-Order Linear: Springs and Oscillations

Second-Order Linear: Springs and Oscillations
Second-Order Linear: Springs and Oscillations | Ideasthesia

Second-order differential equations describe oscillation, vibration, and acceleration. Anything involving a second derivative—which means anything involving a force (F = ma, where a is second derivative of position).

Standard form: a(x)y'' + b(x)y' + c(x)y = f(x)

where y' = dy/dx and y'' = d²y/dx².

If f(x) = 0, it's homogeneous. If f(x) ≠ 0, it's nonhomogeneous.

Second-order equations are qualitatively different from first-order. Solutions can oscillate. Behavior depends on initial position and initial velocity. The solution space is two-dimensional—you need two initial conditions, and the general solution has two arbitrary constants.

Why Second-Order Matters

Most of classical physics is second-order:

Newton's second law: F = m(d²x/dt²)d²x/dt² = F/m

Harmonic oscillator: m(d²x/dt²) + kx = 0 (mass-spring system)

Damped oscillator: m(d²x/dt²) + c(dx/dt) + kx = 0 (with friction)

Driven oscillator: m(d²x/dt²) + c(dx/dt) + kx = F(t) (external force)

RLC circuit: L(d²Q/dt²) + R(dQ/dt) + Q/C = V(t) (inductance, resistance, capacitance)

Wave equation (1D): ∂²u/∂t² = c²(∂²u/∂x²) (spatial second derivative too)

Second-order equations govern dynamics. If you care about how things move, you care about second-order ODEs.

Linear vs Nonlinear

As with first-order, linearity matters.

A second-order ODE is linear if y, y', and y'' appear to the first power only, with no products or nonlinear functions.

Linear: y'' + 3y' + 2y = sin(x) (all terms linear in y and derivatives)

Nonlinear: y'' + (y')² = 0 (squared derivative)

Nonlinear: y'' + y³ = 0 (cubed y—this is Duffing's equation)

Nonlinear: y'' + sin(y) = 0 (nonlinear function of y—this is the pendulum equation)

Linear equations have systematic solution methods. Nonlinear equations are generally much harder.

For this article, we focus on linear second-order ODEs.

Standard Linear Form

a(x)y'' + b(x)y' + c(x)y = f(x)

If a, b, c are constants (don't depend on x), it's a constant coefficient equation.

If a, b, c vary with x, it's a variable coefficient equation.

Constant coefficients are easier—we'll focus on those first.

Constant Coefficient Equations

Standard form: ay'' + by' + cy = f(x) (a, b, c constant)

Divide by a: y'' + py' + qy = g(x)

where p = b/a, q = c/a, g = f/a.

Homogeneous case: y'' + py' + qy = 0

Nonhomogeneous case: y'' + py' + qy = g(x)

The general solution to the nonhomogeneous equation is:

y = y_c + y_p

where:

  • y_c = complementary (homogeneous) solution
  • y_p = particular solution to nonhomogeneous equation

This is the superposition principle: general solution = homogeneous solution + particular solution.

Homogeneous Equations: The Core

For y'' + py' + qy = 0, we need two independent solutions y₁ and y₂.

General solution: y = C₁y₁ + C₂y₂

The constants C₁ and C₂ are determined by initial conditions.

Why two constants? Because it's second-order. You need to specify y(x₀) and y'(x₀) to pin down a unique solution. That's two pieces of information, hence two constants.

The Characteristic Equation

For constant coefficients, try exponential solutions: y = e^(rx).

Substitute into y'' + py' + qy = 0:

y' = re^(rx) y'' = r²e^(rx)

Equation becomes:

r²e^(rx) + pre^(rx) + qe^(rx) = 0

Factor out e^(rx) (never zero):

r² + pr + q = 0

This is the characteristic equation—a quadratic in r.

Solve for r using the quadratic formula:

r = (-p ± √(p² - 4q))/2

The nature of the roots determines the form of the solution.

Three Cases: Real Distinct, Repeated, Complex

Case 1: Two distinct real roots (p² - 4q > 0)

If r = r₁ and r = r₂ (r₁ ≠ r₂), then:

y₁ = e^(r₁x) y₂ = e^(r₂x)

General solution: y = C₁e^(r₁x) + C₂e^(r₂x)

Example: y'' - 3y' + 2y = 0

Characteristic equation: r² - 3r + 2 = 0

Factor: (r - 1)(r - 2) = 0

Roots: r = 1, r = 2

Solution: y = C₁e^x + C₂e^(2x)

Case 2: Repeated real root (p² - 4q = 0)

If r = r₁ (double root), we have only one exponential solution: y₁ = e^(r₁x).

We need a second independent solution. It turns out to be: y₂ = xe^(r₁x).

General solution: y = (C₁ + C₂x)e^(r₁x)

Example: y'' - 4y' + 4y = 0

Characteristic equation: r² - 4r + 4 = 0

Factor: (r - 2)² = 0

Root: r = 2 (repeated)

Solution: y = (C₁ + C₂x)e^(2x)

Case 3: Complex conjugate roots (p² - 4q < 0)

If r = α ± iβ (complex conjugates), where α = -p/2 and β = √(4q - p²)/2, then:

Using Euler's formula e^(iβx) = cos(βx) + i·sin(βx), the real solutions are:

y₁ = e^(αx)cos(βx) y₂ = e^(αx)sin(βx)

General solution: y = e^(αx)(C₁cos(βx) + C₂sin(βx))

Example: y'' + 4y = 0

Characteristic equation: r² + 4 = 0

Roots: r = ±2i (α = 0, β = 2)

Solution: y = C₁cos(2x) + C₂sin(2x)

This is simple harmonic motion—pure oscillation.

Physical Interpretation of Cases

Real distinct roots: Overdamping. System returns to equilibrium without oscillating (e.g., shock absorber in car).

Repeated root: Critical damping. System returns to equilibrium as fast as possible without overshooting.

Complex roots: Underdamping. System oscillates with decaying amplitude (e.g., guitar string, pendulum with air resistance).

The discriminant p² - 4q determines the regime.

Example: Mass-Spring System

Equation: m(d²x/dt²) + c(dx/dt) + kx = 0

Divide by m: d²x/dt² + (c/m)(dx/dt) + (k/m)x = 0

Let p = c/m (damping coefficient), q = k/m.

Characteristic equation: r² + pr + q = 0

Roots: r = (-p ± √(p² - 4q))/2

No damping (c = 0, so p = 0):

r = ±i√q = ±i√(k/m) (pure imaginary)

Solution: x = C₁cos(ωt) + C₂sin(ωt), where ω = √(k/m) (natural frequency).

Light damping (p² < 4q):

Complex roots → oscillation with exponential decay.

Heavy damping (p² > 4q):

Real roots → exponential approach to equilibrium, no oscillation.

Critical damping (p² = 4q):

Repeated root → fastest return to equilibrium without overshoot.

This is why car suspensions are designed near critical damping—you want potholes damped quickly without bouncing.

Nonhomogeneous Equations

For y'' + py' + qy = g(x), the general solution is:

y = y_c + y_p

where:

  • y_c = general solution to y'' + py' + qy = 0 (we just covered this)
  • y_p = any particular solution to the full equation

Finding y_p depends on the form of g(x).

Method of Undetermined Coefficients

If g(x) is a simple function (polynomial, exponential, sine/cosine), guess the form of y_p and solve for coefficients.

Rules:

If g(x) = polynomial of degree n → guess polynomial of degree n

If g(x) = e^(ax) → guess y_p = Ae^(ax) (unless e^(ax) is already in y_c, then multiply by x)

If g(x) = cos(βx) or sin(βx) → guess y_p = Acos(βx) + Bsin(βx) (unless already in y_c, then multiply by x)

Example: y'' + 4y = 8x

Homogeneous solution: y_c = C₁cos(2x) + C₂sin(2x) (from r² + 4 = 0)

Particular solution: Since g(x) = 8x (polynomial degree 1), guess y_p = Ax + B.

y_p' = A y_p'' = 0

Substitute: 0 + 4(Ax + B) = 8x

4Ax + 4B = 8x

Match coefficients:

  • 4A = 8 → A = 2
  • 4B = 0 → B = 0

So y_p = 2x.

General solution: y = C₁cos(2x) + C₂sin(2x) + 2x

Variation of Parameters

When undetermined coefficients fails (e.g., g(x) = ln(x) or other irregular functions), use variation of parameters.

Suppose y_c = C₁y₁ + C₂y₂. Let the constants vary: y_p = u₁(x)y₁ + u₂(x)y₂.

Impose constraints and solve for u₁ and u₂. This works for any g(x) but involves more computation.

We'll skip the details here (it's messy), but know the method exists for tough cases.

Initial Value Problems

To find C₁ and C₂, use initial conditions.

Example: Solve y'' - y = 0 with y(0) = 1 and y'(0) = 2.

Characteristic equation: r² - 1 = 0 → r = ±1

General solution: y = C₁e^x + C₂e^(-x)

Apply y(0) = 1:

1 = C₁e^0 + C₂e^0 = C₁ + C₂

So C₁ + C₂ = 1.

Differentiate: y' = C₁e^x - C₂e^(-x)

Apply y'(0) = 2:

2 = C₁ - C₂

Solve system:

  • C₁ + C₂ = 1
  • C₁ - C₂ = 2

Add: 2C₁ = 3 → C₁ = 3/2

Subtract: 2C₂ = -1 → C₂ = -1/2

Particular solution: y = (3/2)e^x - (1/2)e^(-x)

Reduction to First-Order System

Any second-order ODE can be rewritten as a system of two first-order ODEs.

Let v = y'. Then:

y' = v v' = y''

Original equation y'' + py' + qy = g(x) becomes:

y' = v v' = -pv - qy + g(x)

This is a system of first-order equations in y and v. Many numerical methods work with this form.

Boundary Value Problems

Instead of initial conditions (y and y' at one point), sometimes you have boundary conditions (y at two different points).

Example: y'' + y = 0 with y(0) = 0 and y(π) = 0.

General solution: y = C₁cos(x) + C₂sin(x)

Apply y(0) = 0: 0 = C₁ → C₁ = 0

Apply y(π) = 0: 0 = C₂sin(π) = 0 → satisfied for any C₂

Solution: y = C₂sin(x) (infinite solutions—eigenvalue problem).

Boundary value problems are trickier than initial value problems. Not all boundary conditions have solutions, and some have infinitely many.

Linear Independence

Two solutions y₁ and y₂ are linearly independent if neither is a constant multiple of the other.

Test: Compute the Wronskian:

W(y₁, y₂) = y₁y₂' - y₂y₁'

If W ≠ 0, solutions are independent.

Example: y₁ = e^x, y₂ = e^(2x)

W = e^x·2e^(2x) - e^(2x)·e^x = 2e^(3x) - e^(3x) = e^(3x) ≠ 0

Independent. Good.

Linear independence ensures the general solution y = C₁y₁ + C₂y₂ spans the full solution space.

Summary of Solution Method

For ay'' + by' + cy = 0:

  1. Write characteristic equation: ar² + br + c = 0
  2. Solve for r (quadratic formula)
  3. Based on roots:
    • Distinct real: y = C₁e^(r₁x) + C₂e^(r₂x)
    • Repeated real: y = (C₁ + C₂x)e^(rx)
    • Complex α ± iβ: y = e^(αx)(C₁cos(βx) + C₂sin(βx))
  4. For nonhomogeneous, add particular solution y_p

This is algorithmic for constant coefficients.

For variable coefficients (a(x), b(x), c(x)), methods include series solutions, Frobenius method, and numerical approaches. Much harder.

Next: we dive deeper into the characteristic equation method and explore the three cases in detail.


Part 6 of the Differential Equations series.

Previous: Linear First-Order: The Integrating Factor Method Next: The Characteristic Equation: Turning Calculus into Algebra