In mathematics, variation of parameters, also known as variation of constants, is a general method to solve inhomogeneous linear ordinary differential equations.

For first-order inhomogeneous linear differential equations it is usually possible to find solutions via integrating factors or undetermined coefficients with considerably less effort, although those methods leverage heuristics that involve guessing and do not work for all inhomogeneous linear differential equations.

Variation of parameters extends to linear partial differential equations as well, specifically to inhomogeneous problems for linear evolution equations like the heat equation, wave equation, and vibrating plate equation. In this setting, the method is more often known as Duhamel's principle, named after Jean-Marie Duhamel (1797–1872) who first applied the method to solve the inhomogeneous heat equation. Sometimes variation of parameters itself is called Duhamel's principle and vice versa.

## History

The method of variation of parameters was first sketched by the Swiss mathematician Leonhard Euler (1707–1783), and later completed by the Italian-French mathematician Joseph-Louis Lagrange (1736–1813).[1]

A forerunner of the method of variation of a celestial body's orbital elements appeared in Euler's work in 1748, while he was studying the mutual perturbations of Jupiter and Saturn.[2] In his 1749 study of the motions of the earth, Euler obtained differential equations for the orbital elements.[3] In 1753, he applied the method to his study of the motions of the moon.[4]

Lagrange first used the method in 1766.[5] Between 1778 and 1783, he further developed the method in two series of memoirs: one on variations in the motions of the planets[6] and another on determining the orbit of a comet from three observations.[7] During 1808–1810, Lagrange gave the method of variation of parameters its final form in a third series of papers.[8]

## Description of method

Given an ordinary non-homogeneous linear differential equation of order n

 ${\displaystyle y^{(n)}(x)+\sum _{i=0}^{n-1}a_{i}(x)y^{(i)}(x)=b(x).}$ (i)

Let ${\displaystyle y_{1}(x),\ldots ,y_{n}(x)}$ be a basis of the vector space of solutions of the corresponding homogeneous equation

 ${\displaystyle y^{(n)}(x)+\sum _{i=0}^{n-1}a_{i}(x)y^{(i)}(x)=0.}$ (ii)

Then a particular solution to the non-homogeneous equation is given by

 ${\displaystyle y_{p}(x)=\sum _{i=1}^{n}c_{i}(x)y_{i}(x)}$ (iii)

where the ${\displaystyle c_{i}(x)}$ are differentiable functions which are assumed to satisfy the conditions

 ${\displaystyle \sum _{i=1}^{n}c_{i}'(x)y_{i}^{(j)}(x)=0,\quad j=0,\ldots ,n-2.}$ (iv)

Starting with (iii), repeated differentiation combined with repeated use of (iv) gives

 ${\displaystyle y_{p}^{(j)}(x)=\sum _{i=1}^{n}c_{i}(x)y_{i}^{(j)}(x),\quad j=0,\ldots ,n-1\,.}$ (v)

One last differentiation gives

 ${\displaystyle y_{p}^{(n)}(x)=\sum _{i=1}^{n}c_{i}'(x)y_{i}^{(n-1)}(x)+\sum _{i=1}^{n}c_{i}(x)y_{i}^{(n)}(x)\,.}$ (vi)

By substituting (iii) into (i) and applying (v) and (vi) it follows that

 ${\displaystyle \sum _{i=1}^{n}c_{i}'(x)y_{i}^{(n-1)}(x)=b(x).}$ (vii)

The linear system (iv and vii) of n equations can then be solved using Cramer's rule yielding

${\displaystyle c_{i}'(x)={\frac {W_{i}(x)}{W(x))),\,\quad i=1,\ldots ,n}$

where ${\displaystyle W(x)}$ is the Wronskian determinant of the basis ${\displaystyle y_{1}(x),\ldots ,y_{n}(x)}$ and ${\displaystyle W_{i}(x)}$ is the Wronskian determinant of the basis with the i-th column replaced by ${\displaystyle (0,0,\ldots ,b(x)).}$

The particular solution to the non-homogeneous equation can then be written as

${\displaystyle \sum _{i=1}^{n}y_{i}(x)\,\int {\frac {W_{i}(x)}{W(x)))\,\mathrm {d} x.}$

## Intuitive explanation

Consider the equation of the forced dispersionless spring, in suitable units:

${\displaystyle x''(t)+x(t)=F(t).}$

Here x is the displacement of the spring from the equilibrium x = 0, and F(t) is an external applied force that depends on time. When the external force is zero, this is the homogeneous equation (whose solutions are linear combinations of sines and cosines, corresponding to the spring oscillating with constant total energy).

We can construct the solution physically, as follows. Between times ${\displaystyle t=s}$ and ${\displaystyle t=s+ds}$, the momentum corresponding to the solution has a net change ${\displaystyle F(s)\,ds}$ (see: Impulse (physics)). A solution to the inhomogeneous equation, at the present time t > 0, is obtained by linearly superposing the solutions obtained in this manner, for s going between 0 and t.

The homogeneous initial-value problem, representing a small impulse ${\displaystyle F(s)\,ds}$ being added to the solution at time ${\displaystyle t=s}$, is

${\displaystyle x''(t)+x(t)=0,\quad x(s)=0,\ x'(s)=F(s)\,ds.}$

The unique solution to this problem is easily seen to be ${\displaystyle x(t)=F(s)\sin(t-s)\,ds}$. The linear superposition of all of these solutions is given by the integral:

${\displaystyle x(t)=\int _{0}^{t}F(s)\sin(t-s)\,ds.}$

To verify that this satisfies the required equation:

${\displaystyle x'(t)=\int _{0}^{t}F(s)\cos(t-s)\,ds}$
${\displaystyle x''(t)=F(t)-\int _{0}^{t}F(s)\sin(t-s)\,ds=F(t)-x(t),}$

as required (see: Leibniz integral rule).

The general method of variation of parameters allows for solving an inhomogeneous linear equation

${\displaystyle Lx(t)=F(t)}$

by means of considering the second-order linear differential operator L to be the net force, thus the total impulse imparted to a solution between time s and s+ds is F(s)ds. Denote by ${\displaystyle x_{s))$ the solution of the homogeneous initial value problem

${\displaystyle Lx(t)=0,\quad x(s)=0,\ x'(s)=F(s)\,ds.}$

Then a particular solution of the inhomogeneous equation is

${\displaystyle x(t)=\int _{0}^{t}x_{s}(t)\,ds,}$

the result of linearly superposing the infinitesimal homogeneous solutions. There are generalizations to higher order linear differential operators.

In practice, variation of parameters usually involves the fundamental solution of the homogeneous problem, the infinitesimal solutions ${\displaystyle x_{s))$ then being given in terms of explicit linear combinations of linearly independent fundamental solutions. In the case of the forced dispersionless spring, the kernel ${\displaystyle \sin(t-s)=\sin t\cos s-\sin s\cos t}$ is the associated decomposition into fundamental solutions.

## Examples

### First-order equation

${\displaystyle y'+p(x)y=q(x)}$

The complementary solution to our original (inhomogeneous) equation is the general solution of the corresponding homogeneous equation (written below):

${\displaystyle y'+p(x)y=0}$

This homogeneous differential equation can be solved by different methods, for example separation of variables:

${\displaystyle {\frac {d}{dx))y+p(x)y=0}$
${\displaystyle {\frac {dy}{dx))=-p(x)y}$
${\displaystyle {dy \over y}=-{p(x)\,dx},}$
${\displaystyle \int {\frac {1}{y))\,dy=-\int p(x)\,dx}$
${\displaystyle \ln |y|=-\int p(x)\,dx+C}$
${\displaystyle y=\pm e^{-\int p(x)\,dx+C}=C_{0}e^{-\int p(x)\,dx))$

The complementary solution to our original equation is therefore:

${\displaystyle y_{c}=C_{0}e^{-\int p(x)\,dx))$

${\displaystyle y'+p(x)y=q(x)}$

Using the method variation of parameters, the particular solution is formed by multiplying the complementary solution by an unknown function C(x):

${\displaystyle y_{p}=C(x)e^{-\int p(x)\,dx))$

By substituting the particular solution into the non-homogeneous equation, we can find C(x):

${\displaystyle C'(x)e^{-\int p(x)\,dx}-C(x)p(x)e^{-\int p(x)\,dx}+p(x)C(x)e^{-\int p(x)\,dx}=q(x)}$
${\displaystyle C'(x)e^{-\int p(x)\,dx}=q(x)}$
${\displaystyle C'(x)=q(x)e^{\int p(x)\,dx))$
${\displaystyle C(x)=\int q(x)e^{\int p(x)\,dx}\,dx+C_{1))$

We only need a single particular solution, so we arbitrarily select ${\displaystyle C_{1}=0}$ for simplicity. Therefore the particular solution is:

${\displaystyle y_{p}=e^{-\int p(x)\,dx}\int q(x)e^{\int p(x)\,dx}\,dx}$

The final solution of the differential equation is:

{\displaystyle {\begin{aligned}y&=y_{c}+y_{p}\\&=C_{0}e^{-\int p(x)\,dx}+e^{-\int p(x)\,dx}\int q(x)e^{\int p(x)\,dx}\,dx\end{aligned))}

This recreates the method of integrating factors.

### Specific second-order equation

Let us solve

${\displaystyle y''+4y'+4y=\cosh x}$

We want to find the general solution to the differential equation, that is, we want to find solutions to the homogeneous differential equation

${\displaystyle y''+4y'+4y=0.}$

The characteristic equation is:

${\displaystyle \lambda ^{2}+4\lambda +4=(\lambda +2)^{2}=0}$

Since ${\displaystyle \lambda =-2}$ is a repeated root, we have to introduce a factor of x for one solution to ensure linear independence: ${\displaystyle u_{1}=e^{-2x))$ and ${\displaystyle u_{2}=xe^{-2x))$. The Wronskian of these two functions is

${\displaystyle W={\begin{vmatrix}e^{-2x}&xe^{-2x}\\-2e^{-2x}&-e^{-2x}(2x-1)\\\end{vmatrix))=-e^{-2x}e^{-2x}(2x-1)+2xe^{-2x}e^{-2x}=e^{-4x}.}$

Because the Wronskian is non-zero, the two functions are linearly independent, so this is in fact the general solution for the homogeneous differential equation (and not a mere subset of it).

We seek functions A(x) and B(x) so A(x)u1 + B(x)u2 is a particular solution of the non-homogeneous equation. We need only calculate the integrals

${\displaystyle A(x)=-\int {1 \over W}u_{2}(x)b(x)\,\mathrm {d} x,\;B(x)=\int {1 \over W}u_{1}(x)b(x)\,\mathrm {d} x}$

Recall that for this example

${\displaystyle b(x)=\cosh x}$

That is,

${\displaystyle A(x)=-\int {1 \over e^{-4x))xe^{-2x}\cosh x\,\mathrm {d} x=-\int xe^{2x}\cosh x\,\mathrm {d} x=-{1 \over 18}e^{x}\left(9(x-1)+e^{2x}(3x-1)\right)+C_{1))$
${\displaystyle B(x)=\int {1 \over e^{-4x))e^{-2x}\cosh x\,\mathrm {d} x=\int e^{2x}\cosh x\,\mathrm {d} x={1 \over 6}e^{x}\left(3+e^{2x}\right)+C_{2))$

where ${\displaystyle C_{1))$ and ${\displaystyle C_{2))$ are constants of integration.

### General second-order equation

We have a differential equation of the form

${\displaystyle u''+p(x)u'+q(x)u=f(x)}$

and we define the linear operator

${\displaystyle L=D^{2}+p(x)D+q(x)}$

where D represents the differential operator. We therefore have to solve the equation ${\displaystyle Lu(x)=f(x)}$ for ${\displaystyle u(x)}$, where ${\displaystyle L}$ and ${\displaystyle f(x)}$ are known.

We must solve first the corresponding homogeneous equation:

${\displaystyle u''+p(x)u'+q(x)u=0}$

by the technique of our choice. Once we've obtained two linearly independent solutions to this homogeneous differential equation (because this ODE is second-order) — call them u1 and u2 — we can proceed with variation of parameters.

Now, we seek the general solution to the differential equation ${\displaystyle u_{G}(x)}$ which we assume to be of the form

${\displaystyle u_{G}(x)=A(x)u_{1}(x)+B(x)u_{2}(x).}$

Here, ${\displaystyle A(x)}$ and ${\displaystyle B(x)}$ are unknown and ${\displaystyle u_{1}(x)}$ and ${\displaystyle u_{2}(x)}$ are the solutions to the homogeneous equation. (Observe that if ${\displaystyle A(x)}$ and ${\displaystyle B(x)}$ are constants, then ${\displaystyle Lu_{G}(x)=0}$.) Since the above is only one equation and we have two unknown functions, it is reasonable to impose a second condition. We choose the following:

${\displaystyle A'(x)u_{1}(x)+B'(x)u_{2}(x)=0.}$

Now,

{\displaystyle {\begin{aligned}u_{G}'(x)&=\left(A(x)u_{1}(x)+B(x)u_{2}(x)\right)'\\&=\left(A(x)u_{1}(x)\right)'+\left(B(x)u_{2}(x)\right)'\\&=A'(x)u_{1}(x)+A(x)u_{1}'(x)+B'(x)u_{2}(x)+B(x)u_{2}'(x)\\&=A'(x)u_{1}(x)+B'(x)u_{2}(x)+A(x)u_{1}'(x)+B(x)u_{2}'(x)\\&=A(x)u_{1}'(x)+B(x)u_{2}'(x)\end{aligned))}

Differentiating again (omitting intermediary steps)

${\displaystyle u_{G}''(x)=A(x)u_{1}''(x)+B(x)u_{2}''(x)+A'(x)u_{1}'(x)+B'(x)u_{2}'(x).}$

Now we can write the action of L upon uG as

${\displaystyle Lu_{G}=A(x)Lu_{1}(x)+B(x)Lu_{2}(x)+A'(x)u_{1}'(x)+B'(x)u_{2}'(x).}$

Since u1 and u2 are solutions, then

${\displaystyle Lu_{G}=A'(x)u_{1}'(x)+B'(x)u_{2}'(x).}$

We have the system of equations

${\displaystyle {\begin{bmatrix}u_{1}(x)&u_{2}(x)\\u_{1}'(x)&u_{2}'(x)\end{bmatrix)){\begin{bmatrix}A'(x)\\B'(x)\end{bmatrix))={\begin{bmatrix}0\\f\end{bmatrix)).}$

Expanding,

${\displaystyle {\begin{bmatrix}A'(x)u_{1}(x)+B'(x)u_{2}(x)\\A'(x)u_{1}'(x)+B'(x)u_{2}'(x)\end{bmatrix))={\begin{bmatrix}0\\f\end{bmatrix)).}$

So the above system determines precisely the conditions

${\displaystyle A'(x)u_{1}(x)+B'(x)u_{2}(x)=0.}$
${\displaystyle A'(x)u_{1}'(x)+B'(x)u_{2}'(x)=Lu_{G}=f.}$

We seek A(x) and B(x) from these conditions, so, given

${\displaystyle {\begin{bmatrix}u_{1}(x)&u_{2}(x)\\u_{1}'(x)&u_{2}'(x)\end{bmatrix)){\begin{bmatrix}A'(x)\\B'(x)\end{bmatrix))={\begin{bmatrix}0\\f\end{bmatrix))}$

we can solve for (A′(x), B′(x))T, so

${\displaystyle {\begin{bmatrix}A'(x)\\B'(x)\end{bmatrix))={\begin{bmatrix}u_{1}(x)&u_{2}(x)\\u_{1}'(x)&u_{2}'(x)\end{bmatrix))^{-1}{\begin{bmatrix}0\\f\end{bmatrix))={\frac {1}{W)){\begin{bmatrix}u_{2}'(x)&-u_{2}(x)\\-u_{1}'(x)&u_{1}(x)\end{bmatrix)){\begin{bmatrix}0\\f\end{bmatrix)),}$

where W denotes the Wronskian of u1 and u2. (We know that W is nonzero, from the assumption that u1 and u2 are linearly independent.) So,

{\displaystyle {\begin{aligned}A'(x)&=-{1 \over W}u_{2}(x)f(x),&B'(x)&={1 \over W}u_{1}(x)f(x)\\A(x)&=-\int {1 \over W}u_{2}(x)f(x)\,\mathrm {d} x,&B(x)&=\int {1 \over W}u_{1}(x)f(x)\,\mathrm {d} x\end{aligned))}

While homogeneous equations are relatively easy to solve, this method allows the calculation of the coefficients of the general solution of the inhomogeneous equation, and thus the complete general solution of the inhomogeneous equation can be determined.

Note that ${\displaystyle A(x)}$ and ${\displaystyle B(x)}$ are each determined only up to an arbitrary additive constant (the constant of integration). Adding a constant to ${\displaystyle A(x)}$ or ${\displaystyle B(x)}$ does not change the value of ${\displaystyle Lu_{G}(x)}$ because the extra term is just a linear combination of u1 and u2, which is a solution of ${\displaystyle L}$ by definition.

## Notes

1. ^ See:
2. ^ Euler, L. (1748) "Recherches sur la question des inégalités du mouvement de Saturne et de Jupiter, sujet proposé pour le prix de l'année 1748, par l’Académie Royale des Sciences de Paris" [Investigations on the question of the differences in the movement of Saturn and Jupiter; this subject proposed for the prize of 1748 by the Royal Academy of Sciences (Paris)] (Paris, France: G. Martin, J.B. Coignard, & H.L. Guerin, 1749).
3. ^ Euler, L. (1749) "Recherches sur la précession des équinoxes, et sur la nutation de l’axe de la terre," Histoire [or Mémoires ] de l'Académie Royale des Sciences et Belles-lettres (Berlin), pages 289–325 [published in 1751].
4. ^ Euler, L. (1753) Theoria motus lunae: exhibens omnes ejus inaequalitates ... [The theory of the motion of the moon: demonstrating all of its inequalities ... ] (Saint Petersburg, Russia: Academia Imperialis Scientiarum Petropolitanae [Imperial Academy of Science (St. Petersburg)], 1753).
5. ^ Lagrange, J.-L. (1766) “Solution de différens problèmes du calcul integral,” Mélanges de philosophie et de mathématique de la Société royale de Turin, vol. 3, pages 179–380.
6. ^ See:
7. ^ See:
8. ^ See:
• Lagrange, J.-L. (1808) “Sur la théorie des variations des éléments des planètes et en particulier des variations des grands axes de leurs orbites,” Mémoires de la première Classe de l’Institut de France. Reprinted in: Joseph-Louis Lagrange with Joseph-Alfred Serret, ed., Oeuvres de Lagrange (Paris, France: Gauthier-Villars, 1873), vol. 6, pages 713–768.
• Lagrange, J.-L. (1809) “Sur la théorie générale de la variation des constantes arbitraires dans tous les problèmes de la méchanique,” Mémoires de la première Classe de l’Institut de France. Reprinted in: Joseph-Louis Lagrange with Joseph-Alfred Serret, ed., Oeuvres de Lagrange (Paris, France: Gauthier-Villars, 1873), vol. 6, pages 771–805.
• Lagrange, J.-L. (1810) “Second mémoire sur la théorie générale de la variation des constantes arbitraires dans tous les problèmes de la méchanique, ... ,” Mémoires de la première Classe de l’Institut de France. Reprinted in: Joseph-Louis Lagrange with Joseph-Alfred Serret, ed., Oeuvres de Lagrange (Paris, France: Gauthier-Villars, 1873), vol. 6, pages 809–816.

## References

• Coddington, Earl A.; Levinson, Norman (1955). Theory of Ordinary Differential Equations. McGraw-Hill.
• Boyce, William E.; DiPrima, Richard C. (2005). Elementary Differential Equations and Boundary Value Problems (8th ed.). Wiley. pp. 186–192, 237–241.
• Teschl, Gerald (2012). Ordinary Differential Equations and Dynamical Systems. American Mathematical Society.