Nonhomogeneous Equations

Undetermined coefficients and variation of parameters

Until now, we have studied homogeneous second-order equations, where the right side is zero. These describe systems at rest, left to their own devices. But real systems are rarely isolated. Vibrating strings are plucked. Electrical circuits receive input signals. Bridges are buffeted by wind.

When we add a forcing function to the right side, the equation becomes nonhomogeneous:

ay+by+cy=g(t)ay'' + by' + cy = g(t)

The function g(t)g(t) represents an external influence driving the system. Solving this equation means finding how the system responds to that forcing.

The Structure of Solutions

The key insight is that nonhomogeneous equations have a beautiful additive structure. Their solutions decompose into two parts:

y=yh+ypy = y_h + y_p

Here yhy_h is the homogeneous solution, solving ay+by+cy=0ay'' + by' + cy = 0. We already know how to find this: use the characteristic equation, identify roots, and write out the appropriate exponential or oscillatory combinations.

The new piece is ypy_p, the particular solution. This is any single function that satisfies the full nonhomogeneous equation. It does not need to satisfy any initial conditions. It just needs to make the equation true.

Why does this decomposition work? Because the equation is linear. If yhy_h solves the homogeneous equation and ypy_p solves the nonhomogeneous equation, then:

a(yh+yp)+b(yh+yp)+c(yh+yp)=(ayh+byh+cyh)+(ayp+byp+cyp)=0+g(t)=g(t)a(y_h + y_p)'' + b(y_h + y_p)' + c(y_h + y_p) = (ay_h'' + by_h' + cy_h) + (ay_p'' + by_p' + cy_p) = 0 + g(t) = g(t)

The sum works because differentiation distributes across sums, and the homogeneous terms vanish.

Interactive: Homogeneous Plus Particular

Equation: y+y=3y'' + y = 3

y=1.0cost+0.5sintyh+3ypy = \underbrace{1.0\cos t + 0.5\sin t}_{y_h} + \underbrace{3}_{y_p}

Watch how the total solution combines the oscillating homogeneous part with the constant particular part. The constants c1c_1 and c2c_2 in yhy_h are adjusted to satisfy initial conditions. The particular solution ypy_p is fixed by the forcing function.

Undetermined Coefficients: The Fast Method

Given a specific forcing function g(t)g(t), how do we find a particular solution? The method of undetermined coefficients is remarkably efficient for certain common forcing functions.

The idea is to guess the form of ypy_p based on what g(t)g(t) looks like, then substitute into the equation to determine the unknown constants.

This works because differentiation does not radically change certain function families. Polynomials differentiate to polynomials of lower degree. Exponentials differentiate to exponentials with the same base. Sines and cosines differentiate to each other. So if the forcing function belongs to one of these families, the particular solution likely does too.

Interactive: Undetermined Coefficients Guide

Forcing function

g(t)=tng(t) = t^n

Guess this form

yp=Antn+An1tn1++A0y_p = A_n t^n + A_{n-1} t^{n-1} + \cdots + A_0

Example

g(t)=3t2+2typ=At2+Bt+Cg(t) = 3t^2 + 2t \Rightarrow y_p = At^2 + Bt + C

Guessing Rules

Here are the standard guesses:

Polynomial forcing: If g(t)=antn++a0g(t) = a_n t^n + \cdots + a_0, guess yp=Antn+An1tn1++A0y_p = A_n t^n + A_{n-1} t^{n-1} + \cdots + A_0. Always include all powers down to the constant term, even if some coefficients in g(t)g(t) are zero.

Exponential forcing: If g(t)=Ceatg(t) = Ce^{at}, guess yp=Aeaty_p = Ae^{at}.

Sinusoidal forcing: If g(t)=C1cos(ωt)+C2sin(ωt)g(t) = C_1 \cos(\omega t) + C_2 \sin(\omega t), guess yp=Acos(ωt)+Bsin(ωt)y_p = A\cos(\omega t) + B\sin(\omega t). Always include both sine and cosine, even if only one appears in g(t)g(t). Differentiation mixes them.

Products: For products like t2e3tt^2 e^{3t} or etcos(2t)e^{-t}\cos(2t), multiply the appropriate guesses together. For g(t)=t2e3tg(t) = t^2 e^{3t}, guess yp=(At2+Bt+C)e3ty_p = (At^2 + Bt + C)e^{3t}.

Worked Example

Solve y+3y+2y=6e4ty'' + 3y' + 2y = 6e^{4t}.

Step 1: Find the homogeneous solution. The characteristic equation r2+3r+2=(r+1)(r+2)=0r^2 + 3r + 2 = (r+1)(r+2) = 0 gives roots r=1r = -1 and r=2r = -2. So:

yh=c1et+c2e2ty_h = c_1 e^{-t} + c_2 e^{-2t}

Step 2: Guess a particular solution. Since g(t)=6e4tg(t) = 6e^{4t}, guess yp=Ae4ty_p = Ae^{4t}.

Step 3: Substitute into the equation. We have yp=4Ae4ty_p' = 4Ae^{4t} and yp=16Ae4ty_p'' = 16Ae^{4t}. Substituting:

16Ae4t+3(4Ae4t)+2(Ae4t)=6e4t16Ae^{4t} + 3(4Ae^{4t}) + 2(Ae^{4t}) = 6e^{4t} (16A+12A+2A)e4t=6e4t(16A + 12A + 2A)e^{4t} = 6e^{4t} 30A=6    A=1530A = 6 \implies A = \frac{1}{5}

Step 4: Write the general solution:

y=c1et+c2e2t+15e4ty = c_1 e^{-t} + c_2 e^{-2t} + \frac{1}{5}e^{4t}

The Resonance Case

What happens if your guess overlaps with the homogeneous solution? This is the resonance case, and it requires a modification.

Consider y4y=e2ty'' - 4y = e^{2t}. The homogeneous solution is yh=c1e2t+c2e2ty_h = c_1 e^{2t} + c_2 e^{-2t}. If we guess yp=Ae2ty_p = Ae^{2t}, substituting gives:

4Ae2t4Ae2t=e2t4Ae^{2t} - 4Ae^{2t} = e^{2t} 0=e2t0 = e^{2t}

This is a contradiction. The guess Ae2tAe^{2t} cannot work because e2te^{2t} is already a homogeneous solution.

The fix is to multiply by tt. Instead of Ae2tAe^{2t}, guess yp=Ate2ty_p = Ate^{2t}. Now:

yp=Ae2t+2Ate2t=A(1+2t)e2ty_p' = Ae^{2t} + 2Ate^{2t} = A(1 + 2t)e^{2t} yp=2Ae2t+2A(1+2t)e2t=A(4+4t)e2ty_p'' = 2Ae^{2t} + 2A(1 + 2t)e^{2t} = A(4 + 4t)e^{2t}

Substituting:

A(4+4t)e2t4Ate2t=e2tA(4 + 4t)e^{2t} - 4Ate^{2t} = e^{2t} 4Ae2t=e2t4Ae^{2t} = e^{2t} A=14A = \frac{1}{4}

So yp=t4e2ty_p = \frac{t}{4}e^{2t}.

If the multiplied form te2tte^{2t} is still a homogeneous solution (as with repeated roots), multiply by t2t^2 instead.

Interactive: Resonance Demonstration

Equation: y+y=cos(0.90t)y'' + y = \cos(0.90t)

ω=0.901\omega = 0.90 \neq 1: bounded oscillation with amplitude 11ω2=5.26\frac{1}{|1 - \omega^2|} = 5.26

When the forcing frequency matches the natural frequency, the amplitude grows without bound. This is resonance. Notice how the solution remains bounded when ω1\omega \neq 1, but grows linearly when ω=1\omega = 1. This phenomenon explains why soldiers break step crossing bridges and why opera singers can shatter glasses.

Variation of Parameters: The General Method

Undetermined coefficients only works for specific forcing functions: polynomials, exponentials, sines and cosines, and their products. What if g(t)=tan(t)g(t) = \tan(t) or g(t)=sec(t)g(t) = \sec(t) or g(t)=1tg(t) = \frac{1}{t}?

The method of variation of parameters handles any continuous forcing function. It always works, though the integrals may be difficult.

The idea is elegant: take the homogeneous solution yh=c1y1+c2y2y_h = c_1 y_1 + c_2 y_2 and vary the constants, letting them become functions of tt:

yp=u1(t)y1+u2(t)y2y_p = u_1(t) y_1 + u_2(t) y_2

Deriving the formulas: Differentiating ypy_p using the product rule:

yp=u1y1+u1y1+u2y2+u2y2y_p' = u_1' y_1 + u_1 y_1' + u_2' y_2 + u_2 y_2'

This has four terms, which would make ypy_p'' messy. To simplify, we impose the constraint u1y1+u2y2=0u_1' y_1 + u_2' y_2 = 0. Now yp=u1y1+u2y2y_p' = u_1 y_1' + u_2 y_2', and differentiating again:

yp=u1y1+u1y1+u2y2+u2y2y_p'' = u_1' y_1' + u_1 y_1'' + u_2' y_2' + u_2 y_2''

Substituting into ayp+byp+cyp=g(t)ay_p'' + by_p' + cy_p = g(t) and using the fact that y1y_1 and y2y_2 satisfy the homogeneous equation, most terms cancel, leaving:

a(u1y1+u2y2)=g(t)a(u_1' y_1' + u_2' y_2') = g(t)

Combined with our constraint u1y1+u2y2=0u_1' y_1 + u_2' y_2 = 0, we have two equations for two unknowns u1u_1' and u2u_2'. Solving this system (using Cramer's rule) yields the formulas below.

Interactive: Variation of Parameters Method

Step 1 of 8Start with the nonhomogeneous equation
ay+by+cy=g(t)ay'' + by' + cy = g(t)

We have a general second-order linear equation with any forcing function g(t).

Why this works: Variation of parameters succeeds for any continuous g(t). The integrals may be difficult, but they always exist.

The Formulas

For the equation ay+by+cy=g(t)ay'' + by' + cy = g(t), the particular solution is:

yp=y1y2g(t)aWdt+y2y1g(t)aWdty_p = -y_1 \int \frac{y_2 g(t)}{aW} dt + y_2 \int \frac{y_1 g(t)}{aW} dt

where W=y1y2y1y2W = y_1 y_2' - y_1' y_2 is the Wronskian of y1y_1 and y2y_2. Since y1y_1 and y2y_2 are linearly independent, W0W \neq 0.

Worked Example

Solve y+y=sec(t)y'' + y = \sec(t).

Step 1: Homogeneous solution. The characteristic equation r2+1=0r^2 + 1 = 0 gives r=±ir = \pm i. So y1=cos(t)y_1 = \cos(t) and y2=sin(t)y_2 = \sin(t).

Step 2: Compute the Wronskian:

W=cos(t)cos(t)(sin(t))sin(t)=cos2(t)+sin2(t)=1W = \cos(t) \cdot \cos(t) - (-\sin(t)) \cdot \sin(t) = \cos^2(t) + \sin^2(t) = 1

Step 3: Apply the formula with a=1a = 1 and g(t)=sec(t)g(t) = \sec(t):

u1=y2g(t)W=sin(t)sec(t)=tan(t)u_1' = -\frac{y_2 g(t)}{W} = -\sin(t) \sec(t) = -\tan(t) u2=y1g(t)W=cos(t)sec(t)=1u_2' = \frac{y_1 g(t)}{W} = \cos(t) \sec(t) = 1

Step 4: Integrate:

u1=tan(t)dt=lncos(t)u_1 = \int -\tan(t) \, dt = \ln|\cos(t)| u2=1dt=tu_2 = \int 1 \, dt = t

Step 5: Write the particular solution:

yp=cos(t)lncos(t)+tsin(t)y_p = \cos(t) \ln|\cos(t)| + t \sin(t)

Notice that sec(t)\sec(t) could not be handled by undetermined coefficients. There is no finite family of functions closed under differentiation that contains sec(t)\sec(t). Variation of parameters was necessary.

Transient and Steady State

When the homogeneous solution involves damping (negative real parts in characteristic roots), something interesting happens over time.

Interactive: Transient vs Steady State

Transient (yh)Steady state (yp)Total (y)

The transient part decays exponentially, leaving only the steady-state response. Higher damping causes faster decay.

The homogeneous part yhy_h is called the transient response. It depends on initial conditions and decays exponentially when the system is damped. Eventually it becomes negligible.

The particular solution ypy_p is called the steady-state response. It persists indefinitely, determined entirely by the forcing function.

After enough time, every solution approaches the same steady state, regardless of initial conditions. The transient dies out; only the particular solution remains.

This has practical implications. When designing a system to respond to periodic input, we often care only about the steady state. Initial transients are temporary disturbances that disappear.

Which Method to Use?

Interactive: Method Comparison

Forcing function

g(t)=3t2+5g(t) = 3t^2 + 5

Undetermined Coefficients

Easy: guess At² + Bt + C

Recommended

Variation of Parameters

Works but tedious integrals

Rule of thumb: Use undetermined coefficients for polynomials, exponentials, sines, and cosines (and their products). Use variation of parameters for everything else.

Use undetermined coefficients when:

  • The forcing function is a polynomial, exponential, sine, cosine, or a product of these
  • You want the fastest solution
  • You are willing to handle the resonance case if it arises

Use variation of parameters when:

  • The forcing function is anything else (tan, sec, ln, 1/t, etc.)
  • Undetermined coefficients fails
  • You want a method that always works

In practice, undetermined coefficients handles most textbook problems. Variation of parameters is the fallback for unusual forcing functions and is essential for understanding the structure of solutions.

Summary of the Method

To solve ay+by+cy=g(t)ay'' + by' + cy = g(t):

  1. Find the homogeneous solution yh=c1y1+c2y2y_h = c_1 y_1 + c_2 y_2 by solving the characteristic equation

  2. Find a particular solution ypy_p using either:

    • Undetermined coefficients (for polynomial, exponential, trig forcing)
    • Variation of parameters (for everything else)
  3. Combine: The general solution is y=yh+ypy = y_h + y_p

  4. Apply initial conditions to find c1c_1 and c2c_2

The particular solution accounts for the forcing; the homogeneous solution accounts for initial conditions.

Looking Ahead

In the next chapter on Mechanical Vibrations, we will apply these techniques to physical systems: masses on springs, damped oscillators, and driven systems. The concepts of resonance and steady state become concrete when you see a mass oscillating in response to a periodic force. The mathematics of this chapter provides the tools; the physics provides the intuition.

Key Takeaways

  • Nonhomogeneous equations ay+by+cy=g(t)ay'' + by' + cy = g(t) have solutions of the form y=yh+ypy = y_h + y_p
  • The homogeneous solution yhy_h solves the equation with g(t)=0g(t) = 0 and contains arbitrary constants
  • The particular solution ypy_p is any function satisfying the full equation
  • Undetermined coefficients provides fast solutions for polynomial, exponential, and sinusoidal forcing
  • When the guess overlaps with the homogeneous solution, multiply by tt (the resonance case)
  • Variation of parameters works for any continuous forcing function but requires integrating
  • The homogeneous part is transient (decays with damping); the particular part is steady state (persists)
  • Resonance occurs when the forcing frequency matches the natural frequency, causing unbounded growth