← MATH 241 MathScape 0 MATH241

Variation of Parameters

2 min read

Jump to a section
Reference: Stewart §17.2

Textbook Reference

Primary source OpenStax Calculus Volume 3, Section 7.2: “Nonhomogeneous Linear Equations”
Direct link https://openstax.org/books/calculus-volume-3/pages/7-2-nonhomogeneous-linear-equations
Textbook used in class Stewart, Calculus, Section 17.2: “Nonhomogeneous Linear Equations” (Examples 5, 6)

Quick Reference

Given $y'' + p(x)y' + q(x)y = g(x)$ with homogeneous solutions $y_1, y_2$ and Wronskian $W = y_1 y_2' - y_2 y_1'$:

$$u_1' = \frac{-y_2\,g}{W}, \qquad u_2' = \frac{y_1\,g}{W}.$$

$$y_p = u_1 y_1 + u_2 y_2, \quad \text{where } u_1 = \int\frac{-y_2 g}{W}\,dx,\; u_2 = \int\frac{y_1 g}{W}\,dx.$$

Important: divide by $a$ first if the DE is $ay''+by'+cy = g$, so the leading coefficient is $1$.


Motivation

Undetermined coefficients requires $g(x)$ to be a polynomial, exponential, or sinusoid. Variation of parameters works for any continuous $g(x)$, including $\ln x$, $\sec x$, $1/x$, and functions whose derivatives generate new families. The trade-off is that you must integrate to find $u_1$ and $u_2$, and those integrals may themselves be hard.

The method’s name comes from its derivation: take the homogeneous solution $c_1 y_1 + c_2 y_2$, “vary” the constants $c_1, c_2$ into functions $u_1(x), u_2(x)$, and impose two conditions that determine $u_1'$ and $u_2'$ uniquely.


Key Concept

The two conditions imposed are:

  1. $u_1' y_1 + u_2' y_2 = 0$ (keeps the first-derivative term clean)
  2. $u_1' y_1' + u_2' y_2' = g$ (matches the right-hand side after substitution)

This $2\times 2$ linear system in $u_1', u_2'$ has determinant $W = y_1 y_2' - y_2 y_1' \neq 0$ (since $y_1, y_2$ are linearly independent), so it always has a unique solution. Solving by Cramer’s rule gives the formulas in the Quick Reference.


Worked Example

Find the general solution of $y'' + y = \sec x$, $-\pi/2 < x < \pi/2$.

Step 1: Homogeneous solutions. $r^2 + 1 = 0 \Rightarrow r = \pm i$. $y_1 = \cos x$, $y_2 = \sin x$.

Step 2: Wronskian. $W = \cos x\cos x - \sin x(-\sin x) = \cos^2 x + \sin^2 x = 1$.

Step 3: Compute $u_1'$ and $u_2'$. Here $g = \sec x$.

$$u_1' = \frac{-y_2 g}{W} = \frac{-\sin x\cdot\sec x}{1} = -\frac{\sin x}{\cos x} = -\tan x.$$

$$u_2' = \frac{y_1 g}{W} = \frac{\cos x\cdot\sec x}{1} = 1.$$

Step 4: Integrate. $$u_1 = \int(-\tan x)\,dx = \ln|\cos x|, \qquad u_2 = \int 1\,dx = x.$$

(Take constants of integration to be zero; they fold into $y_h$.)

Step 5: Particular solution. $$y_p = u_1 y_1 + u_2 y_2 = \cos x\ln|\cos x| + x\sin x.$$

Step 6: General solution. $$y = c_1\cos x + c_2\sin x + \cos x\ln|\cos x| + x\sin x.$$

Note: $\sec x$ is not in the undetermined coefficients table, so variation of parameters is required here.


Common misconception

variation of parameters and undetermined coefficients give different general solutions. They give different-looking expressions for $y_p$, but the general solutions are equivalent. Any two particular solutions differ by a solution of the homogeneous equation, which is absorbed into $c_1 y_1 + c_2 y_2$. If you check both $y_p$’s by substituting, each satisfies the nonhomogeneous equation, confirming they are both valid.


Leveled Practice

Problem 1. Find $y_p$ for $y'' + 4y = \csc(2x)$ using variation of parameters.

Show answer

$y_1 = \cos 2x$, $y_2 = \sin 2x$, $W = 2$.

$u_1' = -\sin(2x)\csc(2x)/2 = -1/2$. $u_1 = -x/2$.

$u_2' = \cos(2x)\csc(2x)/2 = \cos(2x)/(2\sin(2x)) = \cot(2x)/2$. $u_2 = \frac{1}{4}\ln|\sin(2x)|$.

$y_p = -\frac{x}{2}\cos(2x) + \frac{1}{4}\ln|\sin(2x)|\sin(2x)$.


Mastery Checklist


Next: Vibrating Springs