DIFFERENTIAL EQUATIONS • SECOND-ORDER LINEAR ODES

Undetermined Coefficients

A powerful shortcut for solving differential equations by intelligently guessing the form of the answer.

Historical Context & Motivation

Differential equations describe how quantities change, and they appear everywhere — from the motion of a swinging pendulum to the current flowing through a circuit. By the 1700s, mathematicians had mastered homogeneous linear ODEs (equations where every term involves the unknown function or its derivatives). However, real-world problems almost always include an outside force or input, creating nonhomogeneous equations. The big question became: how do you find solutions when there is a forcing function on the right-hand side?

Several brilliant mathematicians contributed ideas over about two centuries. Their work eventually produced the method of undetermined coefficients — a technique that lets you 'guess' the correct form of a particular solution and then solve for the unknown constants. It is elegant precisely because it turns a calculus problem into an algebra problem.

1739
Euler's Foundations
Leonhard Euler systematically solved second-order linear ODEs with constant coefficients, establishing the characteristic equation approach that underpins the homogeneous solution.
1743
d'Alembert's Contributions
Jean le Rond d'Alembert extended Euler's work and explored methods for handling nonhomogeneous terms, laying groundwork for particular solution techniques.
1774
Lagrange's Variation of Parameters
Joseph-Louis Lagrange developed variation of parameters, a more general (but more complex) method. The desire for a simpler alternative for common forcing functions motivated undetermined coefficients.
1800s
Method Formalized
Textbook authors in the 19th century codified the method of undetermined coefficients with clear rules for guessing particular solutions involving polynomials, exponentials, and trigonometric functions.
Today
Standard Tool in STEM
Undetermined coefficients is now a core technique taught in every differential equations course and applied daily by engineers and scientists modeling vibrations, circuits, and heat transfer.

The central question this method answers is: given a second-order linear ODE with a polynomial, exponential, or sinusoidal forcing term on the right side, how can we efficiently find a particular solution without resorting to more complicated techniques? The answer lies in making an educated guess and letting algebra do the heavy lifting.

Core Principles & Definitions

Before diving into the method, you need to understand a few key ideas that make it work. The method of undetermined coefficients applies specifically to linear ODEs with constant coefficients — equations where the coefficients of y, y′, and y″ are just numbers, not functions of x. The forcing function (right-hand side) must also be one of a few special types.

1

General Solution = Homogeneous + Particular

The general solution of a nonhomogeneous ODE is y = yh + yp. The homogeneous solution yh handles the left side set to zero; the particular solution yp accounts for the forcing term.
2

The 'Guess' Must Match the Forcing Function

Your trial solution yp mimics the form of g(x). If g(x) is a polynomial, you guess a polynomial. If it is an exponential, you guess an exponential of the same type. If it is sine or cosine, you include both sine and cosine.
3

Solve for the Coefficients with Algebra

After plugging your guess into the ODE, you match coefficients of like terms on both sides. This produces a system of algebraic equations whose solutions give you the unknown constants.
4

The Modification Rule (When Your Guess Overlaps)

If any term in your guess already appears in the homogeneous solution yh, you must multiply your guess by x (or x² if needed) to avoid duplication. This is called the modification rule.
5

Limited to Special Forcing Functions

This method only works when g(x) is a polynomial, an exponential eαx, a sine or cosine function, or a combination of these. For anything else (like ln x or tan x), you need variation of parameters.
KEY TAKEAWAY
Think of undetermined coefficients like a fill-in-the-blank test. The differential equation tells you the shape of the answer (polynomial? exponential? trig?), and your job is to fill in the blanks — the actual numerical coefficients. It is like knowing a recipe calls for 'some amount' of flour and sugar, then using the constraints of the recipe to figure out the exact amounts.

Visual Explanation

The diagram below illustrates the overall workflow of the method of undetermined coefficients. It shows how you start with a nonhomogeneous ODE, split the problem into finding the homogeneous and particular solutions, and then combine them. Pay close attention to the decision point: if your guess overlaps with yh, you must apply the modification rule before proceeding.

The flowchart shows the two parallel tracks: finding the homogeneous solution yh on the left, and constructing the particular solution yp on the right. Notice the diamond-shaped decision box — if your trial guess overlaps with yh, you loop back and multiply by x before continuing.

The key insight from this diagram is that the method always follows the same logical path. Once you learn to identify the form of g(x) and check for overlap, the rest is substitution and algebra. The green box at the bottom — y = yh + yp — reminds you that the final answer always combines both pieces.

Mathematical Framework

The method applies to equations of the standard form shown below. The left-hand side has constant coefficients a, b, and c, while the right-hand side g(x) is the forcing function (also called the nonhomogeneous term). Your goal is to find the general solution, which requires both the homogeneous part and a particular solution.

STANDARD FORM
ay″ + by′ + cy = g(x)
where a, b, c are real constants (a ≠ 0), y″ = d²y/dx², y′ = dy/dx, and g(x) is a polynomial, exponential, sine, cosine, or a combination of these.
GENERAL SOLUTION STRUCTURE
y = yh + yp
where yh is the general solution to ay″ + by′ + cy = 0 (found via the characteristic equation), and yp is any one particular solution to the full nonhomogeneous equation.
CHARACTERISTIC EQUATION
ar² + br + c = 0
Solving this quadratic gives roots r1 and r2. Two distinct real roots → yh = C₁e^(r₁x) + C₂e^(r₂x). Repeated root → yh = (C₁ + C₂x)e^(rx). Complex roots α ± βi → yh = e^(αx)[C₁ cos(βx) + C₂ sin(βx)].

The crucial step unique to this method is choosing the correct trial form for yp. The next section provides a detailed lookup table for making that choice.

Choosing the Right Trial Solution

The entire method hinges on selecting the correct form for your trial particular solution. The table below is your go-to reference. For each type of forcing function g(x), it tells you exactly what form yp should take. The capital letters (A, B, C, …) represent the undetermined coefficients you will solve for.

Standard trial solutions for the method of undetermined coefficients
Forcing Function g(x)Trial Particular Solution ypNotes
Constant kAJust a single constant
Polynomial of degree nAₙxⁿ + Aₙ₋₁xⁿ⁻¹ + … + A₁x + A₀Include ALL terms down to the constant, even if some are missing in g(x)
keᵅˣAeᵅˣMatch the exponent exactly
k cos(βx) or k sin(βx)A cos(βx) + B sin(βx)Always include BOTH sine and cosine, even if g(x) has only one
keᵅˣ cos(βx) or keᵅˣ sin(βx)eᵅˣ[A cos(βx) + B sin(βx)]Combine exponential and trig rules
(polynomial) × eᵅˣ(Aₙxⁿ + … + A₀)eᵅˣPolynomial degree matches the original
⚠️ The Modification Rule
If any term in your trial yp duplicates a term in the homogeneous solution yh, multiply the entire trial guess by x. If it still overlaps, multiply by x² instead. This ensures your particular solution is truly independent from yh.
This decision tree helps you choose the right trial particular solution for the three main categories of forcing functions. Each branch leads to a diamond-shaped check: does your guess overlap with the homogeneous solution? If yes, modify it by multiplying by x.

Worked Example

Let's walk through a complete example from start to finish. We will solve the following nonhomogeneous second-order ODE using the method of undetermined coefficients.

PROBLEM
y″ − 3y′ − 4y = 3e²ˣ
Find the general solution.
Solving y″ − 3y′ − 4y = 3e²ˣ
1
Step 1 — Write the Characteristic EquationSet the left-hand side equal to zero: y″ − 3y′ − 4y = 0. Replace y with e^(rx) to get the characteristic equation: r² − 3r − 4 = 0. Factor this as (r − 4)(r + 1) = 0, giving roots r₁ = 4 and r₂ = −1.
r₁ = 4, r₂ = −1
2
Step 2 — Write the Homogeneous SolutionWith two distinct real roots, the homogeneous solution is yh = C₁e⁴ˣ + C₂e⁻ˣ.
yh = C₁e⁴ˣ + C₂e⁻ˣ
3
Step 3 — Choose the Trial Particular SolutionThe forcing function is g(x) = 3e²ˣ. Since this is an exponential with α = 2, our trial guess is yp = Ae²ˣ. We check: does e²ˣ appear in yh? The homogeneous solution contains e⁴ˣ and e⁻ˣ but NOT e²ˣ, so no modification is needed.
yp = Ae²ˣ (no overlap)
4
Step 4 — Compute Derivatives of ypDifferentiate: y′p = 2Ae²ˣ and y″p = 4Ae²ˣ.
y′p = 2Ae²ˣ, y″p = 4Ae²ˣ
5
Step 5 — Substitute into the ODEPlug yp and its derivatives into y″ − 3y′ − 4y = 3e²ˣ: (4Ae²ˣ) − 3(2Ae²ˣ) − 4(Ae²ˣ) = 3e²ˣ. Factor out e²ˣ: (4A − 6A − 4A)e²ˣ = 3e²ˣ. Simplify the left side: −6Ae²ˣ = 3e²ˣ.
−6Ae²ˣ = 3e²ˣ
6
Step 6 — Solve for the CoefficientDivide both sides by e²ˣ (which is never zero): −6A = 3, so A = −1/2.
A = −1/2
7
Step 7 — Write the General SolutionCombine the homogeneous and particular solutions: y = yh + yp = C₁e⁴ˣ + C₂e⁻ˣ − (1/2)e²ˣ.
y = C₁e⁴ˣ + C₂e⁻ˣ − (1/2)e²ˣ
💡 Verification Tip
You can always check your answer by plugging the particular solution back into the original ODE. If you substitute yp = −(1/2)e²ˣ into y″ − 3y′ − 4y, you should get 3e²ˣ. This is a great habit for catching algebraic errors.

Strengths, Limitations & Comparisons

The method of undetermined coefficients is fast and straightforward, but it doesn't work for every problem. Understanding its strengths and limitations will help you decide when to use it and when to reach for a different technique.

Undetermined Coefficients vs. Variation of Parameters
FeatureUndetermined CoefficientsVariation of Parameters
SpeedFast — mainly algebra once you pick the guessSlower — involves integrals that can be difficult
Applicable g(x)Only polynomials, exponentials, sines, cosines, and their productsAny continuous g(x) — ln x, tan x, 1/x, etc.
Coefficient typeRequires constant coefficients on the left sideWorks with variable coefficients too
ComplexityLow — systematic, step-by-step processMedium to high — need to evaluate integrals
Best used wheng(x) is one of the allowed types and you want a quick solutiong(x) is an unusual function or coefficients are non-constant
KEY TAKEAWAY
Think of undetermined coefficients as a shortcut through a maze. It works beautifully when the maze has a clear, predictable pattern (polynomial, exponential, or trig forcing functions). But if the maze has an unpredictable layout (like g(x) = ln x), the shortcut doesn't apply and you need the general-purpose route: variation of parameters. When the shortcut does work, though, it saves a lot of time and effort.

Connection to Advanced Theory

The method of undetermined coefficients is your entry point into a much larger world of techniques for solving differential equations. As you advance in math and engineering, you will encounter several related methods that extend or generalize what you have learned here.

From undetermined coefficients to advanced topics
ConceptWhat You Know NowWhat Comes Next
Solving nonhomogeneous ODEsUndetermined coefficients for polynomial/exponential/trig forcing functionsVariation of parameters for arbitrary g(x); Green's functions in advanced courses
Second-order equationsConstant coefficient equations with two characteristic rootsHigher-order ODEs (3rd, 4th order) using the same method — just bigger characteristic equations
Transform methodsSolving in the x-domain directlyLaplace transforms convert ODEs into algebra in the s-domain, often bypassing the guess-and-check step entirely
ApplicationsBasic forced oscillation problemsResonance, RLC circuits, beam deflection, control systems — all modeled by the same equations

One particularly exciting connection is to the phenomenon of resonance. When the frequency of the forcing function exactly matches a natural frequency of the system (which shows up as an overlap with yh), the modification rule kicks in and the particular solution grows without bound — the physical system literally shakes apart. This is exactly what happened to the famous Tacoma Narrows Bridge in 1940. The modification rule is not just a math trick; it encodes real physics.

🔮 Looking Ahead
If you study engineering or physics in college, you will use Laplace transforms to solve the same types of equations. The Laplace transform method converts a differential equation into a purely algebraic equation — no guessing required. It is like upgrading from a manual shortcut to an automatic solver.

Practice Problems

Test your understanding with these five problems, arranged from conceptual reasoning to critical thinking. Try each one on your own before reading the answer.

PROBLEM 1CONCEPTUAL
Explain why, when the forcing function is g(x) = 5 sin(3x), your trial particular solution must include both A cos(3x) and B sin(3x), even though g(x) contains only a sine term.
PROBLEM 2BASIC CALCULATION
Find the general solution of y″ + 4y = 8. (Hint: the forcing function is a constant, which is a degree-0 polynomial.)
PROBLEM 3INTERMEDIATE
Solve y″ − 2y′ + y = eˣ. Note: the characteristic equation has a repeated root at r = 1. What modification is needed for your trial solution, and what is the general solution?
PROBLEM 4APPLIED
A spring-mass system is modeled by y″ + 9y = 12 cos(2t), where y(t) is displacement in meters. Find the particular solution that represents the steady-state oscillation caused by the external force 12 cos(2t). What is its amplitude?
PROBLEM 5CRITICAL THINKING
Consider y″ + 4y = 5 cos(2x). Notice that the forcing frequency (ω = 2) matches the natural frequency of the homogeneous solution. What happens to your trial guess, and what does the resulting particular solution tell you about the physical behavior of the system?

Lesson Summary

The method of undetermined coefficients provides a systematic way to solve second-order linear ODEs with constant coefficients when the forcing function g(x) is a polynomial, exponential, sine, cosine, or combination of these. The general solution always takes the form y = yh + yp, where yh comes from the characteristic equation and yp is found by crafting a trial guess that mirrors the form of g(x).

The key steps are: (1) solve the homogeneous equation using the characteristic equation, (2) write a trial yp matching the type of g(x), (3) check for overlap with yh and apply the modification rule (multiply by x) if needed, (4) substitute into the ODE and match coefficients to solve for the unknowns, and (5) combine yh and yp. When the method does not apply — for example, if g(x) = ln x — you turn to variation of parameters instead.

Varsity Tutors • Differential Equations • Undetermined Coefficients