maths2u
Tier
⌕ Search ⌘K
Theorem

Variation of parameters

T-066Home MU-205Threads change
Statement

Let \(I \subseteq \mathbb{R}\) be an open interval and let \(p, q, g : I \to \mathbb{R}\) be continuous functions. Consider the second-order linear ODE \[ y'' + p(t)\,y' + q(t)\,y = g(t), \qquad t \in I. \] Suppose \(y_1, y_2 : I \to \mathbb{R}\) are solutions of the associated homogeneous equation \(y'' + p(t)y' + q(t)y = 0\) whose Wronskian \(W(t) = W[y_1,y_2](t) = y_1(t)y_2'(t) - y_1'(t)y_2(t)\) is nonzero for every \(t \in I\) (equivalently, \(\{y_1,y_2\}\) is a fundamental set of solutions). Then the function \[ y_p(t) = -y_1(t)\int \frac{y_2(t)\,g(t)}{W(t)}\,dt \;+\; y_2(t)\int \frac{y_1(t)\,g(t)}{W(t)}\,dt \] is a particular solution of the inhomogeneous equation on \(I\), for any choice of antiderivatives. The general solution is then \(y = c_1 y_1 + c_2 y_2 + y_p\) with \(c_1,c_2 \in \mathbb{R}\) arbitrary.

Why it matters

Variation of parameters converts the problem of solving an inhomogeneous linear ODE into a problem of integration, provided the homogeneous equation has already been solved. Unlike the method of undetermined coefficients, it makes no assumption on the algebraic form of the forcing term \(g\); it works for any continuous \(g\), including \(g(t) = \sec t\), \(g(t) = 1/t\), or forcing terms with no closed elementary antiderivative on their own (in which case \(y_p\) is left as an integral, which is still a legitimate closed-form answer).

The method also reveals the underlying structural fact that makes it work: linear ODEs solved by "unfreezing" the constants of the homogeneous solution and letting them absorb the forcing term. This idea generalises verbatim to \(n\)-th order linear systems and to first-order linear systems \(\mathbf{y}' = A(t)\mathbf{y} + \mathbf{g}(t)\), where it is the engine behind the variation-of-parameters (Duhamel) formula \(\mathbf{y}(t) = \Phi(t)\mathbf{c} + \Phi(t)\int \Phi(s)^{-1}\mathbf{g}(s)\,ds\).

Hypotheses
\(p, q, g\) continuous on \(I\).Without continuity of \(p,q\), the existence–uniqueness theorem for the homogeneous equation can fail, so a fundamental set \(\{y_1,y_2\}\) may not exist on all of \(I\); without continuity of \(g\) the integrals defining \(y_p\) may not be well-defined as classical antiderivatives. \(y_1, y_2\) are genuine solutions of the homogeneous equation.If \(y_1,y_2\) instead solved a different equation (e.g. with a sign error in \(q\)), the cancellation of the \(y_1'', y_2''\) terms in Step 4 of the proof fails and \(y_p\) built from the formula will not satisfy the target ODE. \(W[y_1,y_2](t) \neq 0\) for all \(t \in I\) (linear independence on the whole interval).Take \(y_1(t) = t^2\), \(y_2(t) = t^3\), which solve \(t^2 y'' - 4ty' + 6y = 0\) but have \(W(t) = t^4\) vanishing at \(t=0\); on any interval containing \(0\) the formula's integrand \(y_i g / W\) blows up there and the construction breaks down at that point. The equation is in the normalised (monic) form \(y'' + p(t)y' + q(t)y = g(t)\), coefficient of \(y''\) equal to \(1\).If instead one has \(a(t)y'' + b(t)y' + c(t)y = f(t)\) with \(a \not\equiv 1\), one must divide through by \(a(t)\) first (valid only where \(a(t) \neq 0\)) to get \(g = f/a\); using \(f\) in place of \(g\) directly in the boxed formula silently introduces a spurious factor of \(a(t)\) and gives a wrong particular solution.
Proof
1
Seek \(y_p(t) = u_1(t)y_1(t) + u_2(t)y_2(t)\) for unknown functions \(u_1, u_2\), replacing the two constants \(c_1,c_2\) of the homogeneous general solution by unknown functions ("varying the parameters").
This is the defining ansatz of the method; it is legal simply as a substitution — we have not yet imposed any equation on \(u_1,u_2\), so no generality is lost. A
2
Differentiate: \(y_p' = u_1'y_1 + u_2'y_2 + u_1y_1' + u_2y_2'\). Impose the auxiliary condition \(u_1'(t)y_1(t) + u_2'(t)y_2(t) = 0\), so that \(y_p' = u_1y_1' + u_2y_2'\).
We have two unknown functions \(u_1,u_2\) but as yet only one equation (that \(y_p\) solves the ODE) to determine them; imposing this extra condition is permissible because it removes one degree of freedom while leaving enough freedom to satisfy the ODE itself in Step 3 — a standard reduction trick (Lagrange's device) that turns a second-order problem for \(u_1,u_2\) individually into a first-order linear algebraic system for \(u_1',u_2'\). B
3
Differentiate again using the reduced expression: \(y_p'' = u_1'y_1' + u_2'y_2' + u_1y_1'' + u_2y_2''\).
Ordinary differentiation (product rule) applied to \(y_p' = u_1y_1'+u_2y_2'\) from Step 2. A
4
Substitute \(y_p, y_p', y_p''\) into \(y_p'' + p\,y_p' + q\,y_p = g\). Grouping terms in \(u_1\) and \(u_2\) gives \[ u_1\big(y_1'' + p y_1' + q y_1\big) + u_2\big(y_2'' + p y_2' + q y_2\big) + u_1'y_1' + u_2'y_2' = g. \] Since \(y_1,y_2\) solve the homogeneous equation, the two bracketed terms vanish identically, leaving \(u_1'(t)y_1'(t) + u_2'(t)y_2'(t) = g(t)\).
Direct substitution and use of the hypothesis that \(y_1,y_2\) satisfy \(y'' + py' + qy = 0\) (this is exactly where that hypothesis is used, and it is the reason \(y_1,y_2\) must be genuine homogeneous solutions). B
5
Steps 2 and 4 together give the linear system \[ \begin{pmatrix} y_1 & y_2 \\ y_1' & y_2' \end{pmatrix} \begin{pmatrix} u_1' \\ u_2' \end{pmatrix} = \begin{pmatrix} 0 \\ g \end{pmatrix}, \] whose coefficient matrix has determinant \(W(t) = y_1y_2' - y_1'y_2 \neq 0\) on \(I\) by hypothesis, hence is invertible at every \(t \in I\).
Cramer's rule / invertibility of a \(2\times2\) matrix with nonzero determinant; nonvanishing of \(W\) is precisely the hypothesis of linear independence of \(y_1,y_2\) throughout \(I\). A
6
Solving the \(2\times 2\) system by Cramer's rule: \[ u_1'(t) = \frac{-y_2(t)g(t)}{W(t)}, \qquad u_2'(t) = \frac{y_1(t)g(t)}{W(t)}. \]
Cramer's rule applied to the invertible system of Step 5; the right-hand sides are continuous on \(I\) since \(y_1,y_2,g\) are continuous and \(W\) is continuous and nonvanishing. A
7
Since \(u_1', u_2'\) are continuous on \(I\), the Fundamental Theorem of Calculus guarantees antiderivatives exist: \[ u_1(t) = -\int \frac{y_2(t)g(t)}{W(t)}\,dt, \qquad u_2(t) = \int \frac{y_1(t)g(t)}{W(t)}\,dt. \]
Fundamental Theorem of Calculus (existence of an antiderivative for any continuous function on an interval). A
8
Therefore \(y_p = u_1y_1 + u_2y_2\) with these \(u_1,u_2\) satisfies \(y_p'' + p y_p' + q y_p = g\) on \(I\); this is exactly the formula in the Statement.
Re-tracing Steps 1–7: the construction was forced at every stage by the two conditions imposed (Step 2's auxiliary condition, Step 4's substitution), so the resulting \(y_p\) satisfies the original ODE by construction, not merely by verification. C
9
Any two choices of antiderivatives in Step 7 differ by an added homogeneous solution \(c_1y_1 + c_2y_2\), so \(y_p\) is unique only up to addition of a homogeneous solution — consistent with the general solution formula \(y = c_1y_1+c_2y_2+y_p\) already absorbing that freedom.
If \(u_1,u_2\) and \(\tilde u_1 = u_1+c_1, \tilde u_2 = u_2+c_2\) are both antiderivative choices (constants of integration \(c_1,c_2\)), then \(\tilde y_p - y_p = c_1y_1+c_2y_2\), a homogeneous solution by linearity of the ODE. C
Result
y_p(t) = -y_1(t)\displaystyle\int \frac{y_2(t)g(t)}{W(t)}\,dt + y_2(t)\displaystyle\int \frac{y_1(t)g(t)}{W(t)}\,dt

Reading. Take any fundamental pair of homogeneous solutions \(y_1,y_2\) and their Wronskian \(W\); multiply the forcing term \(g\) against each homogeneous solution divided by \(W\), integrate, and recombine as shown to obtain one particular solution of the inhomogeneous equation. The full general solution is \(y = c_1y_1 + c_2y_2 + y_p\).

Scope. Applies to any linear second-order ODE \(y''+p(t)y'+q(t)y=g(t)\) with \(p,q,g\) continuous on an interval \(I\), given any fundamental set of homogeneous solutions on \(I\); no restriction on the functional form of \(g\) (unlike undetermined coefficients). An entirely analogous formula holds for \(n\)-th order linear equations and for first-order linear systems, with the Wronskian replaced by the determinant of a fundamental matrix.

Corollaries & converses
  • Every solution of the inhomogeneous equation on \(I\) has the form \(c_1y_1+c_2y_2+y_p\) for a unique pair \((c_1,c_2)\); this is immediate from linearity once one particular solution is known, and variation of parameters supplies that particular solution constructively.
  • Superposition corollary: if \(g = g_1+g_2\), the particular solutions add, \(y_p = y_{p,1}+y_{p,2}\), since the formula is linear in \(g\).
  • Converse-type statement: any particular solution \(\tilde y_p\) of the inhomogeneous equation can be written in the variation-of-parameters form for suitable choices of the two constants of integration in Step 7 — the family of formulas (over all antiderivative choices) exhausts all particular solutions, not just produces one.
  • The method does not converge to a "nicer" answer than undetermined coefficients would; when both apply, they must agree up to a homogeneous solution, and this can be used as a computational check.
Fails without
  • Drop nonvanishing of \(W\): with \(y_1 = t^2, y_2 = |t|t\) (or the monomial example \(y_1=t^2,y_2=t^3\) solving \(t^2y''-4ty'+6y=0\)), \(W(t) \to 0\) at \(t=0\); the integrands \(y_ig/W\) have a non-integrable singularity there and no particular solution is produced by the formula on any interval containing \(t=0\), even though the ODE itself may have perfectly good solutions there.
  • Drop that \(y_1,y_2\) solve the homogeneous equation: if one instead plugs in two functions \(y_1,y_2\) that are merely linearly independent but not homogeneous solutions (e.g. \(y_1=1,y_2=t\) used for \(y''+y=g\), which they do not solve), the bracketed terms in Step 4 do not vanish, an extra term survives, and the resulting \(u_1y_1+u_2y_2\) fails to satisfy \(y''+y=g\).
  • Drop continuity of \(g\): for \(g\) merely Riemann-integrable with a jump discontinuity, the formula still produces a function, but it will only be a solution in a weaker (piecewise \(C^2\), or Carathéodory) sense — it will fail to be twice continuously differentiable at the discontinuity, so the classical statement of the theorem (which asserts a genuine \(C^2\) solution) does not hold.
Common errors
  • Forgetting to divide by the leading coefficient \(a(t)\) first when the ODE is given as \(a(t)y''+b(t)y'+c(t)y=f(t)\) with \(a\not\equiv1\), and plugging \(f\) directly in for \(g\) — this silently mis-scales \(y_p\).
  • Mixing up the signs in \(u_1' = -y_2g/W\), \(u_2' = y_1g/W\); a very common slip is to swap which homogeneous solution gets the minus sign.
  • Dropping the constants of integration and then wondering why the "particular" solution seems to disagree with a textbook answer by a multiple of \(y_1\) or \(y_2\) — any valid choice of antiderivative is a valid \(y_p\), and answers can legitimately differ by a homogeneous solution.
  • Attempting to apply the method with \(y_1,y_2\) that are linearly dependent (e.g. accidentally taking \(y_2\) as a scalar multiple of \(y_1\)), making \(W\equiv 0\) and the formula meaningless (division by zero everywhere), rather than checking independence first.
  • Treating variation of parameters as requiring \(g\) to be of "nice" exponential/polynomial/trig type, then defaulting to undetermined coefficients even when it fails (e.g. \(g(t)=\tan t\)) instead of recognising this is exactly the regime where variation of parameters is needed.
Discussion

Variation of parameters was introduced by Lagrange in the 1770s in the context of perturbing the elliptical orbital elements of planets under mutual gravitational attraction — the "parameters" originally being literal orbital constants (semi-major axis, eccentricity, etc.) that were allowed to vary slowly under a perturbing force, exactly mirroring the algebraic device in Step 1 above. This origin explains the name: the constants \(c_1,c_2\) of the unperturbed (homogeneous) motion are "varied" into functions to absorb an external forcing term.

The method is best understood as an integral-transform construction dressed up in elementary language: the quantity \(g(t)/W(t)\) times \(y_1\) or \(y_2\) is precisely what appears when one builds the equation's Green's function. Indeed, defining \(G(t,s) = \dfrac{y_1(s)y_2(t) - y_1(t)y_2(s)}{W(s)}\) for \(s \le t\) (and suitably for \(s \gt t\), or symmetrically), one can rewrite \(y_p(t) = \int_{t_0}^t G(t,s)g(s)\,ds\), which is the Green's function representation of the same particular solution — variation of parameters and the Green's function method are the same content, differing only in bookkeeping.

The auxiliary condition imposed in Step 2 is not the only possible reduction; it is singled out because it is the one that makes the resulting linear algebraic system (Step 5) have the Wronskian as its determinant, guaranteeing solvability exactly when \(y_1,y_2\) are independent. Any other choice of auxiliary condition either fails to decouple the system as cleanly or reintroduces second derivatives of \(u_1,u_2\), defeating the reduction-of-order idea.

A frequent misconception is that variation of parameters and undetermined coefficients are "different methods that can give different answers." They cannot: both produce a particular solution of the same linear ODE, and any two particular solutions of the same equation differ by a solution of the homogeneous equation (Corollaries above). Discrepancies between a undetermined-coefficients answer and a variation-of-parameters answer, if genuinely different-looking, must be reconcilable by absorbing the difference into \(c_1y_1+c_2y_2\).

Worked examples
Ex.1
Solve \(y'' + y = \tan t\) on \(I = (-\pi/2,\pi/2)\).
Undetermined coefficients does not apply since \(\tan t\) is not a polynomial/exponential/sinusoid combination; variation of parameters is needed. B
Homogeneous equation \(y''+y=0\) has fundamental set \(y_1=\cos t, y_2=\sin t\), with \(W = \cos t\cos t - (-\sin t)\sin t = \cos^2t+\sin^2t = 1 \neq 0\) on \(I\).
Direct computation of the Wronskian of the standard fundamental set for \(y''+y=0\). A
\(u_1' = -\dfrac{\sin t \tan t}{1} = -\dfrac{\sin^2t}{\cos t} = \cos t - \sec t\), so \(u_1 = \sin t - \ln|\sec t + \tan t|\).
Apply the boxed formula for \(u_1'\), simplify \(\sin^2t/\cos t = (1-\cos^2t)/\cos t = \sec t - \cos t\), then integrate termwise (standard integral of \(\sec t\)). A
\(u_2' = \dfrac{\cos t \tan t}{1} = \sin t\), so \(u_2 = -\cos t\).
Apply the boxed formula for \(u_2'\) and integrate \(\sin t\) directly. A
\(y_p = u_1y_1+u_2y_2 = \big(\sin t-\ln|\sec t+\tan t|\big)\cos t + (-\cos t)\sin t = -\cos t\,\ln|\sec t+\tan t|\).
Substitute and simplify; the \(\sin t\cos t\) terms cancel. B
y(t) = c_1\cos t + c_2\sin t - \cos t\,\ln|\sec t + \tan t|

Reading. This is the general solution on \((-\pi/2,\pi/2)\), where \(\sec t\) is finite so the logarithm is well-defined.

Ex.2
Solve \(t^2y'' - 2ty' + 2y = t^3\ln t\) on \(I=(0,\infty)\), given that this Euler equation has homogeneous solutions \(y_1=t, y_2=t^2\).
First put in monic form: divide by \(t^2\) to get \(y''-\frac{2}{t}y'+\frac{2}{t^2}y = t\ln t\), so \(g(t)=t\ln t\) — a common error is to use \(t^3\ln t\) directly. B
Check \(y_1=t\) solves the homogeneous monic equation: \(y_1''-\frac2t y_1'+\frac{2}{t^2}y_1 = 0 - \frac2t(1) + \frac{2}{t^2}(t) = -\frac2t+\frac2t = 0\). Similarly \(y_2=t^2\) checks: \(2 - \frac2t(2t)+\frac{2}{t^2}(t^2) = 2-4+2=0\).
Direct verification, needed to legitimately invoke the theorem (Hypothesis: \(y_1,y_2\) must be genuine homogeneous solutions). A
\(W = y_1y_2'-y_1'y_2 = t(2t) - 1(t^2) = t^2 \neq 0\) on \(I=(0,\infty)\).
Direct computation; confirms the nonvanishing-Wronskian hypothesis on \(I\). A
\(u_1' = -\dfrac{y_2g}{W} = -\dfrac{t^2\cdot t\ln t}{t^2} = -t\ln t\), so \(u_1 = -\left(\dfrac{t^2}{2}\ln t - \dfrac{t^2}{4}\right) = -\dfrac{t^2}{2}\ln t+\dfrac{t^2}{4}\) (integration by parts).
Boxed formula plus integration by parts \(\int t\ln t\,dt = \frac{t^2}2\ln t - \frac{t^2}4\). A
\(u_2' = \dfrac{y_1g}{W} = \dfrac{t\cdot t\ln t}{t^2} = \ln t\), so \(u_2 = t\ln t - t\).
Boxed formula plus the standard antiderivative \(\int \ln t\,dt = t\ln t - t\). A
\(y_p = u_1y_1+u_2y_2 = \left(-\dfrac{t^2}{2}\ln t+\dfrac{t^2}{4}\right)t + (t\ln t-t)t^2 = \dfrac{t^3}{2}\ln t - \dfrac{3t^3}{4}\).
Substitute and collect like terms: \(-\frac{t^3}2\ln t+\frac{t^3}4+t^3\ln t-t^3 = \frac{t^3}2\ln t - \frac{3t^3}4\). B
y(t) = c_1t + c_2t^2 + \frac{t^3}{2}\ln t - \frac{3t^3}{4}

Reading. General solution of the original equation \(t^2y''-2ty'+2y=t^3\ln t\) on \((0,\infty)\); note \(-\frac34t^3\) could be absorbed by adjusting \(c_2\) only if \(t^2\) matched \(t^3\), which it does not, so this term is a genuine part of \(y_p\).

Problems
  1. Use variation of parameters to find a particular solution of \(y''+y=\sec t\) on \((-\pi/2,\pi/2)\).
    SolutionFundamental set \(y_1=\cos t,y_2=\sin t\), \(W=1\). \(u_1'=-\sin t\sec t=-\tan t \Rightarrow u_1=\ln|\cos t|\). \(u_2'=\cos t\sec t=1\Rightarrow u_2=t\). So \(y_p=\cos t\ln|\cos t|+t\sin t\). General solution: \(y=c_1\cos t+c_2\sin t+\cos t\ln|\cos t|+t\sin t\).
  2. Solve \(y''-2y'+y = \dfrac{e^t}{t}\) for \(t\gt0\), given homogeneous solutions \(y_1=e^t,y_2=te^t\).
    Solution\(W=y_1y_2'-y_1'y_2 = e^t(e^t+te^t)-e^t(te^t)=e^{2t}\). \(u_1'=-\dfrac{te^t\cdot e^t/t}{e^{2t}}=-1\Rightarrow u_1=-t\). \(u_2'=\dfrac{e^t\cdot e^t/t}{e^{2t}}=\dfrac1t\Rightarrow u_2=\ln t\). So \(y_p=-te^t+te^t\ln t\). General solution: \(y=c_1e^t+c_2te^t+te^t(\ln t-1)\), and the \(-te^t\) term can be absorbed into \(c_2te^t\), giving equivalently \(y=c_1e^t+c_2te^t+te^t\ln t\).
  3. Explain why applying variation of parameters to \(y''-y=e^t\) using \(y_1=e^t,y_2=e^{-t}\) requires care, and carry out the computation.
    SolutionNo special care beyond the standard method is actually needed here (the forcing \(e^t\) coincides with a homogeneous solution, which is exactly the resonance case undetermined coefficients handles awkwardly but variation of parameters handles automatically). \(W=e^t(-e^{-t})-e^t(e^{-t})=-1-1=-2\). \(u_1'=-\dfrac{e^{-t}e^t}{-2}=\dfrac12\Rightarrow u_1=\dfrac t2\). \(u_2'=\dfrac{e^te^t}{-2}=-\dfrac{e^{2t}}2\Rightarrow u_2=-\dfrac{e^{2t}}4\). So \(y_p=\dfrac t2 e^t-\dfrac{e^{2t}}4e^{-t}=\dfrac t2e^t-\dfrac{e^t}4\). The \(-\frac{e^t}4\) term duplicates \(c_1e^t\) and may be dropped, leaving \(y_p=\frac t2e^t\), matching the resonance-case answer from undetermined coefficients.
  4. A student takes \(y_1=e^{2t}, y_2=e^{-2t}\) for the equation \(y''-4y=g(t)\) but makes an arithmetic slip and writes \(W=4\) instead of the correct value. Compute the correct Wronskian and explain the consequence of the student's error for the final answer.
    SolutionCorrect Wronskian: \(W=y_1y_2'-y_1'y_2=e^{2t}(-2e^{-2t})-2e^{2t}(e^{-2t})=-2-2=-4\), not \(4\). Using \(W=4\) instead of \(-4\) flips the sign of both \(u_1'\) and \(u_2'\) throughout (since both formulas divide by \(W\)), so the student's computed \(y_p\) will be exactly the negative of the correct particular solution. Since \(-y_p\) is generally not itself a solution of an inhomogeneous equation (only of the homogeneous one when \(y_p\) is homogeneous, which it is not here), the student's final answer fails to satisfy the ODE — this can be caught by direct substitution back into \(y''-4y=g(t)\).
  5. State and prove (using the method of this theorem, generalised) the analogous variation-of-parameters formula for the first-order linear system \(\mathbf{y}'=A(t)\mathbf{y}+\mathbf{g}(t)\) given a fundamental matrix \(\Phi(t)\) solving \(\Phi'=A\Phi\) with \(\Phi(t)\) invertible for all \(t\in I\).
    SolutionSeek \(\mathbf{y}_p(t)=\Phi(t)\mathbf{u}(t)\) for a vector function \(\mathbf{u}\). Then \(\mathbf{y}_p'=\Phi'\mathbf{u}+\Phi\mathbf{u}'=A\Phi\mathbf{u}+\Phi\mathbf{u}'\) using \(\Phi'=A\Phi\). Substituting into \(\mathbf{y}_p'=A\mathbf{y}_p+\mathbf{g}\) gives \(A\Phi\mathbf{u}+\Phi\mathbf{u}'=A\Phi\mathbf{u}+\mathbf{g}\), so \(\Phi\mathbf{u}'=\mathbf{g}\), i.e. \(\mathbf{u}'=\Phi(t)^{-1}\mathbf{g}(t)\) (legal since \(\Phi(t)\) is invertible for every \(t\in I\), by hypothesis, exactly mirroring the nonvanishing-Wronskian hypothesis: \(\det\Phi(t)\) is the generalised Wronskian and is nonzero iff the columns of \(\Phi\) are a fundamental set). Integrating, \(\mathbf{u}(t)=\int\Phi(s)^{-1}\mathbf{g}(s)\,ds\), giving \(\mathbf{y}_p(t)=\Phi(t)\displaystyle\int\Phi(s)^{-1}\mathbf{g}(s)\,ds\), the direct matrix generalisation of the boxed scalar formula (which is recovered by taking \(\Phi=\begin{pmatrix}y_1&y_2\\y_1'&y_2'\end{pmatrix}\) and reading off the first component).