DIFFERENTIAL EQUATIONS • SECOND-ORDER LINEAR ODES

Variation of Parameters — Method of Variation of Parameters (Intro)

A powerful technique for solving nonhomogeneous differential equations when simpler methods fall short.

Historical Context & Motivation

Throughout the 1700s and 1800s, mathematicians and physicists were racing to model real-world phenomena — from planetary orbits to vibrating strings — using differential equations. They quickly discovered that many physical systems lead to nonhomogeneous differential equations, equations where an external force or input drives the system. The simplest method for solving these, called undetermined coefficients, only works when the driving force has a very specific, "nice" form — like a polynomial, exponential, or sine function. But what happens when the driving force is something messier, like tan(x) or 1/x? That's the gap the method of variation of parameters was designed to fill.

1748
Euler's Early Work
Leonhard Euler develops early techniques for solving second-order linear ODEs and lays the groundwork for general solution methods.
1774
Lagrange Introduces Variation of Parameters
Joseph-Louis Lagrange formally introduces the method of variation of parameters, initially to solve problems in celestial mechanics involving perturbed planetary orbits.
1809
Refinement Through Celestial Mechanics
Lagrange and other mathematicians refine the technique and apply it broadly, establishing it as a general-purpose tool for nonhomogeneous linear ODEs of any order.
1900s
Modern Textbook Standard
Variation of parameters becomes a standard topic in differential equations courses worldwide, valued for its generality compared to the method of undetermined coefficients.

The key question that variation of parameters answers is this: if we already know how to solve the homogeneous equation (with no driving force), can we cleverly modify that solution to handle any driving force? The answer, as Lagrange showed, is yes — and the trick is to let the "constants" in the homogeneous solution become functions. That's why the method is called variation of parameters: the parameters (constants) are allowed to vary.

Core Principles & Definitions

Before diving into the method itself, you need to understand a few foundational ideas. Each of these concepts plays a critical role in how variation of parameters works, so take a moment to internalize each one.

1

Homogeneous vs. Nonhomogeneous

A homogeneous ODE has the form y″ + p(x)y′ + q(x)y = 0. A nonhomogeneous ODE has a nonzero right side: y″ + p(x)y′ + q(x)y = g(x). The function g(x) is the driving force.
2

Complementary Solution yc

The complementary solution yc = c₁y₁ + c₂y₂ is the general solution to the associated homogeneous equation. It contains two arbitrary constants c₁ and c₂.
3

Particular Solution yp

A particular solution yp is any single solution to the full nonhomogeneous equation. The general solution is y = yc + yp.
4

The Wronskian W

The Wronskian is a determinant W = y₁y₂′ − y₂y₁′ built from two independent solutions. If W ≠ 0, the solutions are linearly independent and form a valid basis.
5

The Key Idea: Let Constants Vary

Instead of yp = c₁y₁ + c₂y₂ with fixed constants, we guess yp = u₁(x)y₁ + u₂(x)y₂, where u₁ and u₂ are unknown functions we must determine.
KEY TAKEAWAY
Think of the homogeneous solution like a recipe with two fixed ingredients (c₁ and c₂). When the equation has a nonzero right side, those fixed ingredients aren't enough — you need to adjust the amounts as you go. Variation of parameters replaces the fixed constants with adjustable functions u₁(x) and u₂(x), like a chef tweaking a recipe in real time to account for changing conditions.

Visual Explanation

The diagram below shows the overall logic of variation of parameters. You start with a nonhomogeneous ODE, find the homogeneous (complementary) solution with its two independent solutions y₁ and y₂, compute the Wronskian, and then use integration formulas to find the unknown functions u₁ and u₂. Finally, you assemble the particular solution and add it to the complementary solution to get the general answer.

Flowchart showing the five major steps in variation of parameters. Notice how each step feeds directly into the next: you need y₁ and y₂ to build the Wronskian, and you need the Wronskian to compute u₁′ and u₂′. The final general solution combines the complementary and particular pieces.

The flowchart highlights the sequential, step-by-step nature of the method. Each box depends on the previous one. The most common source of errors is in Step 3, where you must correctly set up and solve the system of equations for u₁′ and u₂′. We'll see how that system is derived in the next section.

Mathematical Framework

Let's set up the mathematics carefully. We begin with a second-order linear nonhomogeneous ODE in standard form, meaning the coefficient of y″ is 1. If it isn't already 1, divide the entire equation by the leading coefficient before applying the method.

STANDARD FORM
y″ + p(x)y′ + q(x)y = g(x)
Here, p(x) and q(x) are the coefficient functions, and g(x) is the nonhomogeneous (driving) term. The leading coefficient of y″ must be 1.

We assume we already know two linearly independent solutions y₁ and y₂ of the corresponding homogeneous equation (where g(x) = 0). The particular solution takes the form:

PARTICULAR SOLUTION FORM
yₚ = u₁(x) · y₁(x) + u₂(x) · y₂(x)
The functions u₁(x) and u₂(x) are the "varied parameters" — they replace the constants c₁ and c₂ from the complementary solution.

When we substitute this guess into the ODE and simplify, we impose an extra condition — called the Lagrange condition — to keep things manageable: u₁′y₁ + u₂′y₂ = 0. This constraint, combined with the ODE itself, produces a clean system of two equations in the two unknowns u₁′ and u₂′.

SYSTEM FOR u₁′ AND u₂′
u₁′y₁ + u₂′y₂ = 0 and u₁′y₁′ + u₂′y₂′ = g(x)
Solving this 2×2 system using Cramer's rule (or substitution) gives the formulas for u₁′ and u₂′ in terms of the Wronskian.
VARIATION OF PARAMETERS FORMULAS
u₁′ = −y₂ · g(x) / W u₂′ = y₁ · g(x) / W
Where W is the Wronskian: W = y₁y₂′ − y₂y₁′. You then integrate u₁′ and u₂′ to find u₁ and u₂.
⚠️ Don't Forget!
The equation must be in standard form (coefficient of y″ equal to 1) before you use these formulas. If your equation is, say, 2y″ + 6y′ + 4y = 10eˣ, divide everything by 2 first to get y″ + 3y′ + 2y = 5eˣ.

The Wronskian — Your Key Tool

The Wronskian is the single most important computational tool in variation of parameters. Named after the Polish mathematician Józef Hoene-Wroński, it is a 2×2 determinant that tells you whether two solutions y₁ and y₂ are truly independent — and it appears in every formula for u₁′ and u₂′. If the Wronskian is zero everywhere, the two solutions are not independent, and the method cannot proceed.

The Wronskian determinant and a concrete example. With y₁ = cos x and y₂ = sin x, the Wronskian simplifies to W = 1, confirming the two solutions are independent. The bottom panel summarizes what W ≠ 0 and W = 0 each mean.

In practice, computing the Wronskian is straightforward. You write down your two solutions y₁ and y₂, differentiate each one to get y₁′ and y₂′, and then evaluate the 2×2 determinant. For constant-coefficient equations (the kind you'll see most often at this level), the Wronskian often turns out to be a simple exponential or even a constant — as in the cos x, sin x example above, where W = 1.

Common Wronskian calculations for frequently encountered solution pairs
Homogeneous Solutionsy₁′, y₂′Wronskian W
y₁ = eˣ, y₂ = e²ˣeˣ, 2e²ˣeˣ · 2e²ˣ − e²ˣ · eˣ = e³ˣ
y₁ = cos 2x, y₂ = sin 2x−2 sin 2x, 2 cos 2x2cos²2x + 2sin²2x = 2
y₁ = e⁻ˣ, y₂ = xe⁻ˣ−e⁻ˣ, e⁻ˣ − xe⁻ˣe⁻ˣ(e⁻ˣ − xe⁻ˣ) − xe⁻ˣ(−e⁻ˣ) = e⁻²ˣ

Worked Example

Let's walk through a complete example to see every step of variation of parameters in action. We'll solve the equation y″ + y = sec x. Notice that the right side, sec x, is not an exponential, polynomial, or simple sine/cosine — so the method of undetermined coefficients would fail here. This is exactly the kind of problem where variation of parameters shines.

Solve y″ + y = sec x
1
Step 1 — Verify Standard FormThe equation y″ + y = sec x is already in standard form: the coefficient of y″ is 1, p(x) = 0, q(x) = 1, and g(x) = sec x. No division is needed.
Standard form confirmed: g(x) = sec x
2
Step 2 — Solve the Homogeneous EquationThe homogeneous equation is y″ + y = 0. The characteristic equation is r² + 1 = 0, giving r = ±i. The two independent solutions are y₁ = cos x and y₂ = sin x, so the complementary solution is yc = c₁ cos x + c₂ sin x.
y₁ = cos x, y₂ = sin x
3
Step 3 — Compute the WronskianWe need y₁′ = −sin x and y₂′ = cos x. Then W = y₁y₂′ − y₂y₁′ = (cos x)(cos x) − (sin x)(−sin x) = cos²x + sin²x.
W = 1
4
Step 4 — Find u₁′ and u₂′Using the formulas: u₁′ = −y₂ · g(x) / W = −(sin x)(sec x) / 1 = −sin x · sec x = −sin x / cos x = −tan x. And u₂′ = y₁ · g(x) / W = (cos x)(sec x) / 1 = cos x · sec x = 1.
u₁′ = −tan x, u₂′ = 1
5
Step 5 — Integrate to Find u₁ and u₂u₁ = ∫(−tan x) dx = ln|cos x| (we drop the constant of integration since we only need one particular solution). u₂ = ∫ 1 dx = x.
u₁ = ln|cos x|, u₂ = x
6
Step 6 — Assemble the General SolutionThe particular solution is yp = u₁y₁ + u₂y₂ = (ln|cos x|)(cos x) + (x)(sin x) = cos x · ln|cos x| + x sin x. The general solution is y = yc + yp.
y = c₁ cos x + c₂ sin x + cos x · ln|cos x| + x sin x
💡 Why This Matters
The function sec x cannot be handled by the method of undetermined coefficients because there is no finite combination of sec x and its derivatives that closes under differentiation. Variation of parameters handles it gracefully, proving its value as a universal method for nonhomogeneous linear ODEs.

Strengths, Limitations & Comparison

You might wonder: if variation of parameters works for any g(x), why do we even bother with undetermined coefficients? The answer is efficiency. When undetermined coefficients applies, it's often faster because it avoids integration. But it only applies to a limited set of right-hand-side functions. Here's a side-by-side comparison of the two methods.

Comparison of the two main methods for finding particular solutions
FeatureUndetermined CoefficientsVariation of Parameters
Types of g(x) handledPolynomials, exponentials, sines, cosines, and products/sums of theseAny continuous g(x)
Coefficient requirementsConstant coefficients onlyConstant or variable coefficients
Guesswork needed?Yes — you must guess the form of yₚNo guessing — systematic formulas
Integration required?No (only algebra)Yes — two integrals needed
Typical speedFaster when applicableSlower but always works
Best used wheng(x) is a standard formg(x) is non-standard (tan x, sec x, 1/x, etc.)
KEY TAKEAWAY
Think of undetermined coefficients as a specialized power tool — extremely fast for the right job, but only fits specific screws. Variation of parameters is like a universal wrench — it takes a bit more effort to use, but it fits every screw you'll ever encounter. The smart strategy is to check whether undetermined coefficients applies first; if not, reach for variation of parameters.

Connection to Higher-Order & Advanced Theory

Variation of parameters is not limited to second-order equations. The same idea — replace constants in the complementary solution with unknown functions — extends naturally to third-order, fourth-order, and even n-th order linear ODEs. The Wronskian becomes a larger n×n determinant, and you solve an n×n system of equations for u₁′, u₂′, …, uₙ′. The algebra grows, but the principle is identical.

From second-order to the general n-th order case
FeatureSecond-Order (This Lesson)Higher-Order / Advanced
Number of solutions needed2 (y₁, y₂)n (y₁, y₂, …, yₙ)
Wronskian size2×2 determinantn×n determinant
System to solve2 equations, 2 unknownsn equations, n unknowns
Integrals needed2n
Related advanced topicsBasic applicationGreen's functions, integral transforms, systems of ODEs

In more advanced courses (college-level differential equations and beyond), you'll encounter Green's functions, which can be viewed as a generalization of variation of parameters. The particular solution formula can be rewritten as an integral involving a special function G(x, t) called the Green's function. This perspective connects variation of parameters to powerful tools used in physics, engineering, and applied mathematics.

Practice Problems

PROBLEM 1CONCEPTUAL
Explain in your own words why the method is called "variation of parameters." What exactly is being "varied," and why is this necessary?
PROBLEM 2BASIC CALCULATION
Compute the Wronskian of y₁ = e³ˣ and y₂ = e⁻ˣ.
PROBLEM 3INTERMEDIATE
Use variation of parameters to find a particular solution to y″ − y = eˣ/x. (The homogeneous solutions are y₁ = eˣ and y₂ = e⁻ˣ.) Set up the integrals for u₁ and u₂; you do not need to evaluate them.
PROBLEM 4APPLIED
A spring-mass system is modeled by y″ + 4y = tan(2x), where y represents displacement. Find the general solution using variation of parameters.
PROBLEM 5CRITICAL THINKING
Why does the method of variation of parameters impose the condition u₁′y₁ + u₂′y₂ = 0? What would happen if we didn't impose this condition? Would the method still work? Explain your reasoning.

Lesson Summary

The method of variation of parameters is a systematic technique for finding a particular solution to any second-order linear nonhomogeneous ODE y″ + p(x)y′ + q(x)y = g(x). The method works by replacing the constants c₁ and c₂ in the complementary solution with unknown functions u₁(x) and u₂(x). The Wronskian W = y₁y₂′ − y₂y₁′ must be nonzero, confirming that y₁ and y₂ are linearly independent.

The formulas u₁′ = −y₂g(x)/W and u₂′ = y₁g(x)/W give you the derivatives of the unknown functions, which you then integrate to find u₁ and u₂. The general solution is y = c₁y₁ + c₂y₂ + u₁y₁ + u₂y₂. Unlike undetermined coefficients, this method works for any continuous g(x), making it the go-to approach when the driving function has a non-standard form like sec x, tan x, or 1/x.

Varsity Tutors • Differential Equations • Variation of Parameters — Method of Variation of Parameters (Intro)