Differential Equations • Second-Order Linear ODEs

Undetermined Coefficients

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

A changing curve with sigma and variable symbols for differential equations
Inside this lesson 10 sections 5 questions 9 figures

SECTION 1

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.

SECTION 2

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.

SECTION 3

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.

Method of Undetermined Coefficients — Workfloway″ + by′ + cy = g(x)Solve ay″ + by′ + cy = 0Identify form of g(x)Find yh (char. equation)Write trial guess y_pOverlap y_h?NoYesMultiplyby xPlug y_p into ODEMatch coefficients → solvey = y_h + y_pGeneral Solution
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.

SECTION 4

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)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+ypy = 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

ar2+br+c=0ar² + br + c = 0

Solving this quadratic gives roots r1 and r2. Two distinct real roots → yh = C₁er1xe^{r₁x} + C₂er2xe^{r₂x}. Repeated root → yh = (C₁ + C₂x)erxe^{rx}. Complex roots α ± βi → yh = eαxe^{α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.

SECTION 5

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.

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

Standard trial solutions for the method of undetermined coefficients

⚠

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.
Trial Solution Decision TreeWhat is g(x)?PolynomialExponential eᵅˣTrig (sin/cos)yp = Aₙxⁿ + ... + A₀Include all degrees ≤ nyp = AeᵅˣMatch exponent αyp = A cos βx + B sin βxAlways include both!In yh?In yh?In yh?NoYesUse as is ✓Multiply by xNoYesUse as is ✓Multiply by xNoYesUse as is ✓Multiply by xThen: Plug yp into ODE → Match coefficients → SolveCombine: y = yh + yp for the general solution
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.

SECTION 6

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=3e2xy″ − 3y′ − 4y = 3e²ˣ

Find the general solution.

Solving y″ − 3y′ − 4y = 3e²ˣ

  1. 1

    Step 1 — Write the Characteristic Equation

    Set the left-hand side equal to zero: y″ − 3y′ − 4y = 0. Replace y with erxe^{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. 2

    Step 2 — Write the Homogeneous Solution

    With two distinct real roots, the homogeneous solution is yh = C₁e⁴ˣ + C₂e⁻ˣ.
    yh = C₁e⁴ˣ + C₂e⁻ˣ
  3. 3

    Step 3 — Choose the Trial Particular Solution

    The 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. 4

    Step 4 — Compute Derivatives of yp

    Differentiate: y′p = 2Ae²ˣ and y″p = 4Ae²ˣ.
    y′p = 2Ae²ˣ, y″p = 4Ae²ˣ
  5. 5

    Step 5 — Substitute into the ODE

    Plug 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. 6

    Step 6 — Solve for the Coefficient

    Divide both sides by e²ˣ (which is never zero): −6A = 3, so A = −1/2.
    A = −1/2
  7. 7

    Step 7 — Write the General Solution

    Combine 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.

SECTION 7

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.

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

Undetermined Coefficients vs. Variation of Parameters

✦

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.

SECTION 8

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.

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

From undetermined coefficients to advanced topics

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.

SECTION 9

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.

Question 1: CONCEPTUAL

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.
Show answer
When you substitute a trial solution involving sin(3x) into the ODE, taking derivatives produces both sine and cosine terms (since the derivative of sin is cos and vice versa). If your trial solution only included B sin(3x), you would have cosine terms on the left side of the equation with no corresponding terms on the right, making it impossible to match coefficients. Including both A cos(3x) and B sin(3x) ensures you have enough 'free constants' to balance all the terms that arise from differentiation.

Question 2: BASIC CALCULATION

Find the general solution of y″ + 4y = 8. (Hint: the forcing function is a constant, which is a degree-0 polynomial.)
Show answer
First, solve the homogeneous equation y″ + 4y = 0. The characteristic equation is r² + 4 = 0, giving r = ±2i (complex roots with α = 0, β = 2). So yh = C₁ cos(2x) + C₂ sin(2x). For the particular solution, g(x) = 8 is a constant, so try yp = A. Then y″p = 0 and y′p = 0. Substituting: 0 + 4A = 8, so A = 2. The general solution is y = C₁ cos(2x) + C₂ sin(2x) + 2.

Question 3: INTERMEDIATE

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?
Show answer
The characteristic equation r² − 2r + 1 = (r − 1)² = 0 gives a repeated root r = 1, so yh = (C₁ + C₂x)eˣ. Since g(x) = eˣ, you would normally guess yp = Aeˣ. But eˣ and xeˣ both appear in yh, so you must multiply by x². Try yp = Ax²eˣ. Compute y′p = A(2x + x²)eˣ and y″p = A(2 + 4x + x²)eˣ. Substituting and simplifying gives 2Aeˣ = eˣ, so A = 1/2. General solution: y = (C₁ + C₂x)eˣ + (1/2)x²eˣ.

Question 4: APPLIED

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?
Show answer
The homogeneous solution uses the characteristic equation r² + 9 = 0, giving r = ±3i, so yh = C₁ cos(3t) + C₂ sin(3t). The forcing function is 12 cos(2t), so try yp = A cos(2t) + B sin(2t). No overlap with yh (2 ≠ 3). Compute y″p = −4A cos(2t) − 4B sin(2t). Substitute: (−4A + 9A) cos(2t) + (−4B + 9B) sin(2t) = 12 cos(2t). This gives 5A = 12 and 5B = 0, so A = 12/5 and B = 0. The particular solution is yp = (12/5) cos(2t), with amplitude 12/5 = 2.4 meters.

Question 5: CRITICAL 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?
Show answer
The characteristic equation r² + 4 = 0 gives r = ±2i, so yh = C₁ cos(2x) + C₂ sin(2x). The forcing function is 5 cos(2x), but cos(2x) already appears in yh, so you must modify: yp = x[A cos(2x) + B sin(2x)]. After differentiation and substitution, you find A = 0 and B = 5/4, giving yp = (5/4)x sin(2x). The factor of x multiplying the oscillation means the amplitude grows linearly with time — this is resonance. Physically, the external force is perfectly in sync with the system's natural vibration, pumping energy into it each cycle. The oscillations grow without bound (in this idealized model without damping), which is why engineers must design structures to avoid matching natural frequencies.

SUMMARY

Lesson Summary

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