Every solution of a nonhomogeneous linear equation has the form : the general solution of the associated homogeneous equation plus any one solution of the full equation. Variation of parameters is the method that supplies that one particular solution, and unlike the method of undetermined coefficients, it works for every forcing function .
Quick Reference
| Item | Statement |
|---|---|
| Structure theorem | The general solution of is |
| General solution of , containing arbitrary constants | |
| Any single solution of , with no arbitrary constants | |
| Second-order ansatz | |
| Defining system | \begin{bmatrix} y_1 & y_2 \\ y_1' & y_2' \end{bmatrix}\begin{bmatrix} u_1' \\ u_2' \end{bmatrix} = \begin{bmatrix} 0 \\ R(x) \end{bmatrix} |
| Second-order formulas | u_1' = -\dfrac{R(x)y_2}{W}, \qquad u_2' = \dfrac{R(x)y_1}{W} |
| th order formula | u_k' = \dfrac{W_k(x)}{W(x)}R(x), with the Wronskian determinant having column replaced by |
| Requirement | The equation must be in standard form, so the coefficient of is |
The Structure of the General Solution
Let be any particular solution of on an interval , and let be the general solution of . Then every solution of on has the form
Proof
First, any such is a solution, since by linearity
Conversely, let be any solution of . Then
so solves the homogeneous equation. By the fundamental set theorem of Section 3.3, it equals for some constants, that is, . Therefore .
The consequence is a clean division of labor. Finding all solutions of the nonhomogeneous equation requires finding all solutions of the homogeneous one, plus just one solution of the full equation. The word "any" in the theorem is important: it does not matter which particular solution you find, since two different choices differ by a homogeneous solution and get absorbed into .
Variation of Parameters
Suppose we know a fundamental set for the second-order equation
y'' + P(x)y' + Q(x)y = R(x) .The homogeneous general solution is with constant and . The idea of variation of parameters, met already in Section 2.6, is to let those constants vary:
Substituting this into the equation gives one condition on two unknown functions, so we are free to impose a second condition of our own choosing. Choosing u_1'y_1 + u_2'y_2 = 0 keeps all second derivatives of and out of the calculation, and the two conditions together become the system
\begin{bmatrix} y_1 & y_2 \\ y_1' & y_2' \end{bmatrix} \begin{bmatrix} u_1' \\ u_2' \end{bmatrix} = \begin{bmatrix} 0 \\ R(x) \end{bmatrix}The coefficient matrix is the Wronskian matrix, whose determinant is nonzero because the solutions are independent. Solving by Cramer's rule,
Integrating each gives and , and assembling them gives . The derivation is carried out in full in Chapter 4; what matters here is the pattern and the fact that it never fails, provided the integrals can be evaluated.
Standard form is mandatory. The formulas assume the coefficient of y'' is . If the equation reads a_0(x)y'' + \cdots = b(x), divide through first, so that . Forgetting this step is the most common source of wrong answers.
Worked Examples
Find the general solution of
y'' - 2y' + y = \frac{e^{x}}{1+x^{2}} .Note that this equation cannot be solved by the method of undetermined coefficients.
Solution
The reason undetermined coefficients fails is that is not of the special form (polynomial times exponential times sine or cosine) that the method requires. Variation of parameters has no such restriction.
Step 1: the homogeneous solutions. The characteristic equation is
Because this has the double root , a fundamental set of solutions is :
Step 2: set up the system. To find a particular solution, write
The derivatives of and are determined by
whose solution is
<strong>Step 3: the Wronskian.</strong>
<strong>Step 4: compute u_1' and u_2'.</strong>
and
The exponentials cancel completely, leaving two elementary integrals.
<strong>Step 5: integrate.</strong>
\begin{aligned}
u_{1}(x) &= \int -\frac{x}{1+x^{2}},dx \
&= -\int\frac{dt}{2t} \qquad \left(t = 1+x^{2},\ dt = 2x,dx\right) \
&= -\frac{1}{2}\ln|t| = -\frac{1}{2}\ln\left(1+x^{2}\right)
[6pt]
u_{2}(x) &= \int\frac{dx}{1+x^{2}} = \tan^{-1}x .
\end{aligned}
The constants of integration are omitted, since any particular solution will do.
<strong>Step 6: assemble.</strong>
\begin{aligned}
y_{p} &= u_{1}(x)y_{1}(x) + u_{2}(x)y_{2}(x) \
&= -\frac{1}{2}e^{x}\ln\left(1+x^{2}\right) + xe^{x}\tan^{-1}x
\end{aligned}
Therefore the general solution of the given equation is
\begin{aligned}
y &= y_{h} + y_{p} = c_{1}y_{1} + c_{2}y_{2} + y_{p} \
&= c_{1}e^{x} + c_{2}xe^{x} - \frac{1}{2}e^{x}\ln\left(1+x^{2}\right) + xe^{x}\tan^{-1}x .
\end{aligned}
Variation of Parameters for Higher Order Equations
The method extends to any order. For an th order equation in standard form with fundamental set , write and impose auxiliary conditions of the same kind as before. Cramer's rule then gives
u_k'(x) = \frac{W_k(x)}{W(x)}\,R(x)where is the full Wronskian and is the determinant obtained by replacing the th column of the Wronskian matrix with . For this works out to
u_1' = \frac{W_1}{W}R, \qquad u_2' = -\frac{W_2}{W}R, \qquad u_3' = \frac{W_3}{W}Rwhere the alternating signs come from the cofactor expansion, and
W_1 = \begin{vmatrix} y_2 & y_3 \\ y_2' & y_3' \end{vmatrix}, \qquad W_2 = \begin{vmatrix} y_1 & y_3 \\ y_1' & y_3' \end{vmatrix}, \qquad W_3 = \begin{vmatrix} y_1 & y_2 \\ y_1' & y_2' \end{vmatrix} .Find the general solution of
y''' - 4y'' + 3y' = \frac{e^{2x}}{1+e^{x}} .Solution
Step 1: the characteristic equation.
\begin{aligned} r^{3} - 4r^{2} + 3r &= r\left(r^{2} - 4r + 3\right) = r(r-1)(r-3) = 0 \\ &\Longrightarrow \quad r = 0 \ \text{ or } \ r = 1 \ \text{ or } \ r = 3 \end{aligned}Therefore three linearly independent solutions of the corresponding homogeneous equation are
Note that the root contributes the constant solution .
Step 2: the Wronskians.
where the first column, having a single nonzero entry, was expanded along.
Step 3: the derivatives u_k'.
u_{1}' = \frac{W_{1}}{W}R(x) = \frac{2e^{4x}}{6e^{4x}}\cdot\frac{e^{2x}}{1+e^{x}} = \frac{e^{2x}}{3\left(1+e^{x}\right)}u_{2}' = -\frac{W_{2}}{W}R(x) = -\frac{3e^{3x}}{6e^{4x}}\cdot\frac{e^{2x}}{1+e^{x}} = -\frac{1}{2}\cdot\frac{e^{2x}}{e^{x}+e^{2x}} = -\frac{1}{2}\cdot\frac{e^{x}}{1+e^{x}}u_{3}' = \frac{W_{3}}{W}R(x) = \frac{e^{x}}{6e^{4x}}\cdot\frac{e^{2x}}{1+e^{x}} = \frac{e^{2x}}{6\left(e^{3x}+e^{4x}\right)} = \frac{1}{6\left(e^{x}+e^{2x}\right)}Step 4: integrate. Every integral yields to the substitution , for which , that is, .
\begin{aligned} u_{1} &= \frac{1}{3}\int\frac{e^{2x}}{1+e^{x}}\,dx = \frac{1}{3}\int\frac{t^{2}}{1+t}\cdot\frac{dt}{t} = \frac{1}{3}\int\frac{t}{1+t}\,dt \\ &= \frac{1}{3}\int\frac{t+1-1}{1+t}\,dt = \frac{1}{3}\int\left(1 - \frac{1}{1+t}\right)dt \\ &= \frac{1}{3}\left(t - \ln|1+t|\right) = \frac{1}{3}\left(e^{x} - \ln\left(1+e^{x}\right)\right) \end{aligned}\begin{aligned} u_{2} &= -\frac{1}{2}\int\frac{e^{x}}{1+e^{x}}\,dx = -\frac{1}{2}\int\frac{t}{1+t}\cdot\frac{dt}{t} = -\frac{1}{2}\int\frac{dt}{1+t} \\ &= -\frac{1}{2}\ln|1+t| = -\frac{1}{2}\ln\left(1+e^{x}\right) \end{aligned}\begin{aligned} u_{3} &= \frac{1}{6}\int\frac{dx}{e^{x}+e^{2x}} = \frac{1}{6}\int\frac{1}{t+t^{2}}\cdot\frac{dt}{t} = \frac{1}{6}\int\frac{dt}{t^{2}(1+t)} \\ &= \frac{1}{6}\int\left(\frac{1}{t^{2}} - \frac{1}{t} + \frac{1}{1+t}\right)dt \qquad \text{(partial fractions)} \\ &= \frac{1}{6}\left(-\frac{1}{t} - \ln|t| + \ln|1+t|\right) \\ &= \frac{1}{6}\left[-e^{-x} - x + \ln\left(1+e^{x}\right)\right] \end{aligned}The partial fraction decomposition used above is
which you can verify by combining the right side over the common denominator .
Step 5: assemble.
\begin{aligned} y_{p} &= u_{1}y_{1} + u_{2}y_{2} + u_{3}y_{3} \\ &= \frac{1}{3}\left[e^{x} - \ln\left(1+e^{x}\right)\right] - \frac{1}{2}e^{x}\ln\left(1+e^{x}\right) + \frac{1}{6}e^{3x}\left[-e^{-x} - x + \ln\left(1+e^{x}\right)\right] \end{aligned}and the general solution is
Note that the term inside is itself a homogeneous solution, so it can be absorbed into if you prefer a tidier answer. Extra homogeneous pieces appearing inside are harmless and are exactly what the "any particular solution" clause of the structure theorem permits.
Exercises
Use variation of parameters to solve y'' + y = \sec x on .
Solution
The homogeneous solutions are and , with .
u_1' = -\frac{\sec x\sin x}{1} = -\tan x \quad \Longrightarrow \quad u_1 = \ln|\cos x|u_2' = \frac{\sec x\cos x}{1} = 1 \quad \Longrightarrow \quad u_2 = xTherefore
and the general solution is
Undetermined coefficients could not have produced this, since is not of the required form.
Solve y'' - 3y' + 2y = \dfrac{1}{1 + e^{-x}}.
Solution
The characteristic equation gives , , and
Writing ,
u_1' = -\frac{R\,e^{2x}}{e^{3x}} = -\frac{R}{e^{x}} = -\frac{1}{1+e^{x}}, \qquad u_2' = \frac{R\,e^{x}}{e^{3x}} = \frac{1}{e^{x}\left(1+e^{x}\right)} .With and ,
Therefore
Suppose solves and solves . Write down a particular solution of .
Solution
By linearity, , so
This is the superposition principle for nonhomogeneous equations, and it lets you split a complicated forcing function into simple pieces and handle each separately.
Frequently Asked Questions
Why is the general solution ?
Because the difference of any two solutions of solves . So once you have one solution , every other solution differs from it by a homogeneous solution, and the homogeneous solutions are exactly . Nothing more and nothing less.
Does it matter which particular solution I use?
No. Two different particular solutions differ by a homogeneous solution, which is absorbed into by relabeling the arbitrary constants. This is why you can safely drop the constants of integration when computing and .
When should I use variation of parameters instead of undetermined coefficients?
Use undetermined coefficients when is a polynomial, an exponential, a sine or cosine, or a product of these, because guessing is faster. Use variation of parameters for everything else: , , , or any forcing function whose derivatives keep producing new forms. Variation of parameters always works; undetermined coefficients does not.
Why must the equation be in standard form?
Because the formulas take to be the right-hand side of an equation whose leading coefficient is . If you apply them to 2y'' + \cdots = g(x) without dividing first, every comes out twice too large. Divide by the leading coefficient before you begin.
What if the integrals for and cannot be evaluated?
Leave them as integrals. Writing is a legitimate and complete answer, and it can be evaluated numerically or bounded analytically. The method itself never fails; only the final antidifferentiation might.
Why does the extra condition u_1'y_1 + u_2'y_2 = 0 not lose solutions?
Because you are looking for one particular solution, not all of them. Two unknown functions offer more freedom than one equation constrains, and the extra condition simply picks a convenient point in that freedom. It is chosen precisely to eliminate u_1'' and u_2'' from the computation, which is what keeps the resulting system algebraic rather than differential.