Variation of parameters
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
Proof
Result
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
Reading. This is the general solution on \((-\pi/2,\pi/2)\), where \(\sec t\) is finite so the logarithm is well-defined.
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
- Use variation of parameters to find a particular solution of \(y''+y=\sec t\) on \((-\pi/2,\pi/2)\).
Solution
Fundamental 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\). - 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\). - 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.
Solution
No 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. - 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.
Solution
Correct 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)\). - 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\).
Solution
Seek \(\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).