Variation of Parameters

Variation of parameters, like the method of undetermined coefficients, is another method for finding the particular solution of an nth-order linear differential equation L(y)=ϕ(x){L}{\left({y}\right)}=\phi{\left({x}\right)} once the solution to the associated homogeneous equation L(y)=0{L}{\left({y}\right)}={0} is known.

Recall from the linear independence note that if y1(x), y2(x), , yn(x){y}_{{1}}{\left({x}\right)},\ {y}_{{2}}{\left({x}\right)},\ \ldots,\ {y}_{{n}}{\left({x}\right)} are n{n} linearly independent solutions of L(y)=0{L}{\left({y}\right)}={0}, the general solution of L(y)=0{L}{\left({y}\right)}={0} is yh=c1y1(x)+c2y2(x)++cnyn(x){y}_{{h}}={c}_{{1}}{y}_{{1}}{\left({x}\right)}+{c}_{{2}}{y}_{{2}}{\left({x}\right)}+\ldots+{c}_{{n}}{y}_{{n}}{\left({x}\right)}.

The variation of parameters method assumes that the particular solution has the form of the homogeneous solution, except that the constants ci,i=1,2,,n{c}_{{i}},i={1},{2},\ldots,{n} are functions of x{x} (that's why it is called variation of parameters): yp=c1(x)y1(x)+c2(x)y2(x)++cn(x)yn(x){y}_{{p}}={c}_{{1}}{\left({x}\right)}{y}_{{1}}{\left({x}\right)}+{c}_{{2}}{\left({x}\right)}{y}_{{2}}{\left({x}\right)}+\ldots+{c}_{{n}}{\left({x}\right)}{y}_{{n}}{\left({x}\right)}.

We know yi(x),i=1,2,,n{y}_{{i}}{\left({x}\right)},i={1},{2},\ldots,{n}, but we need to determine ci(x),i=1,2,,n{c}_{{i}}{\left({x}\right)},i={1},{2},\ldots,{n}.

For this, set up the following system of linear equations:

{c1y1+c2y2++cnyn=0c1y1+c2y2++cnyn=0c1y1(n1)+c2y2(n1)++cnyn(n1)=0c1y1(n)+c2y2(n)++cnyn(n)=0{\left\{\begin{array}{c}{c}_{{1}}'{y}_{{1}}+{c}_{{2}}'{y}_{{2}}+\ldots+{c}_{{n}}'{y}_{{n}}={0}\\{c}_{{1}}'{y}_{{1}}'+{c}_{{2}}'{y}_{{2}}'+\ldots+{c}_{{n}}'{y}_{{n}}'={0}\\\ldots\\{c}_{{1}}'{{y}_{{1}}^{{{\left({n}-{1}\right)}}}}+{c}_{{2}}'{{y}_{{2}}^{{{\left({n}-{1}\right)}}}}+\ldots+{c}_{{n}}'{{y}_{{n}}^{{{\left({n}-{1}\right)}}}}={0}\\{c}_{{1}}'{{y}_{{1}}^{{{\left({n}\right)}}}}+{c}_{{2}}'{{y}_{{2}}^{{{\left({n}\right)}}}}+\ldots+{c}_{{n}}'{{y}_{{n}}^{{{\left({n}\right)}}}}={0}\\ \end{array}\right.}

Then, integrate each ci{c}_{{i}}' to obtain ci{c}_{{i}}, disregarding all constants of integration. This is permissible because we are seeking only one particular solution.

Since y1(x), y2(x), , yn(x){y}_{{1}}{\left({x}\right)},\ {y}_{{2}}{\left({x}\right)},\ \ldots,\ {y}_{{n}}{\left({x}\right)} are n{n} linearly independent solutions of the same equation L(y)=0{L}{\left({y}\right)}={0}, their Wronskian is not zero. This means that the system has a nonzero determinant and can be solved uniquely for c1(x), c2(x), , cn(x){c}_{{1}}'{\left({x}\right)},\ {c}_{{2}}'{\left({x}\right)},\ \ldots,\ {c}_{{n}}'{\left({x}\right)}.

The method of variation of parameters can be applied to all linear differential equations. It is therefore more powerful than the method of undetermined coefficients, which is restricted to linear differential equations with constant coefficients and particular forms of ϕ(x)\phi{\left({x}\right)}. Nonetheless, in those cases where both methods are applicable, the method of undetermined coefficients is usually the more efficient and, hence, the preferable one.
As a practical matter, the integration of vi(x){v}_{{i}}'{\left({x}\right)} may be impossible to perform. In any such case, other methods (in particular, numerical techniques) should be employed.

Example 1. Solve y2y+y=exx{y}''-{2}{y}'+{y}=\frac{{{{e}}^{{x}}}}{{x}}.

The homogeneous solution is yh=c1ex+c2xex{y}_{{h}}={c}_{{1}}{{e}}^{{{x}}}+{c}_{{2}}{x}{{e}}^{{x}}.

To find the particular solution, set up the system:

{c1ex+c2xex=0c1(ex)+c2(xex)=exx{\left\{\begin{array}{c}{c}_{{1}}'{{e}}^{{x}}+{c}_{{2}}'{x}{{e}}^{{x}}={0}\\{c}_{{1}}'{\left({{e}}^{{x}}\right)}'+{c}_{{2}}'{\left({x}{{e}}^{{x}}\right)}'=\frac{{{{e}}^{{x}}}}{{x}}\\ \end{array}\right.},

Or

{c1ex+c2xex=0c1ex+c2(xex+ex)=exx{\left\{\begin{array}{c}{c}_{{1}}'{{e}}^{{x}}+{c}_{{2}}'{x}{{e}}^{{x}}={0}\\{c}_{{1}}'{{e}}^{{x}}+{c}_{{2}}'{\left({x}{{e}}^{{x}}+{{e}}^{{x}}\right)}=\frac{{{{e}}^{{x}}}}{{x}}\\ \end{array}\right.}.

Subtract the first equation from the second: c2ex=exx{c}_{{2}}'{{e}}^{{x}}=\frac{{{{e}}^{{x}}}}{{x}}, or c2=1x{c}_{{2}}'=\frac{{1}}{{x}}.

From the first equation, c1=c2x=1xx=1{c}_{{1}}'=-{c}_{{2}}'{x}=-\frac{{1}}{{x}}{x}=-{1}.

So, c2=1xdx=ln(x){c}_{{2}}=\int\frac{{1}}{{x}}{d}{x}={\ln{{\left({\left|{x}\right|}\right)}}}, and c1=1dx=x{c}_{{1}}=\int-{1}{d}{x}=-{x}.

Thus, yp=c1ex+c2xex=xex+ln(x)xex{y}_{{p}}={c}_{{1}}{{e}}^{{x}}+{{c}}^{{2}}{x}{{e}}^{{x}}=-{x}{{e}}^{{x}}+{\ln{{\left({\left|{x}\right|}\right)}}}{x}{{e}}^{{x}}.

Finally, the general solution is y=yh+yp=c1ex+c2xexxex+ln(x)xex=c1ex+c3xex+ln(x)xex{y}={y}_{{h}}+{y}_{{p}}={c}_{{1}}{{e}}^{{x}}+{c}_{{2}}{x}{{e}}^{{x}}-{x}{{e}}^{{x}}+{\ln{{\left({\left|{x}\right|}\right)}}}{x}{{e}}^{{x}}={c}_{{1}}{{e}}^{{x}}+{c}_{{3}}{x}{{e}}^{{x}}+{\ln{{\left({\left|{x}\right|}\right)}}}{x}{{e}}^{{x}}, where c3=c21{c}_{{3}}={c}_{{2}}-{1}.

Let's work one more example.

Example 2. Solve 2y3y+y=ex{2}{y}''-{3}{y}'+{y}={{e}}^{{x}}.

The corresponding homogeneous equation is 2y3y+y=0{2}{y}''-{3}{y}'+{y}={0}. The characteristic equation is 2r23r+1=0{2}{{r}}^{{2}}-{3}{r}+{1}={0} that has the roots r1=1,r2=12{r}_{{1}}={1},{r}_{{2}}=\frac{{1}}{{2}}.

So, yh=c1ex+c2e12x{y}_{{h}}={c}_{{1}}{{e}}^{{x}}+{c}_{{2}}{{e}}^{{\frac{{1}}{{2}}{x}}}.

Now, be careful when applying the variation of parameters method. To apply it correctly, the coefficient near the highest derivative has to be 1{1}; so, first divide both sides of the differential equation by 2{2}: y1.5y+0.5y=12ex{y}''-{1.5}{y}'+{0.5}{y}=\frac{{1}}{{2}}{{e}}^{{x}}.

Now, set up the system:

{c1ex+c2e12x=0c1(ex)+c2(e12x)=12ex{\left\{\begin{array}{c}{c}_{{1}}'{{e}}^{{x}}+{c}_{{2}}'{{e}}^{{\frac{{1}}{{2}}{x}}}={0}\\{c}_{{1}}'{\left({{e}}^{{x}}\right)}'+{c}_{{2}}'{\left({{e}}^{{\frac{{1}}{{2}}{x}}}\right)}'=\frac{{1}}{{2}}{{e}}^{{x}}\\ \end{array}\right.},

Or

{c1ex+c2e12x=0c1ex+12c2e12x=12ex{\left\{\begin{array}{c}{c}_{{1}}'{{e}}^{{x}}+{c}_{{2}}'{{e}}^{{\frac{{1}}{{2}}{x}}}={0}\\{c}_{{1}}'{{e}}^{{x}}+\frac{{1}}{{2}}{c}_{{2}}'{{e}}^{{\frac{{1}}{{2}}{x}}}=\frac{{1}}{{2}}{{e}}^{{x}}\\ \end{array}\right.}.

Subtract the first equation from the second: 12c2e12x=12ex-\frac{{1}}{{2}}{c}_{{2}}'{{e}}^{{\frac{{1}}{{2}}{x}}}=\frac{{1}}{{2}}{{e}}^{{x}} or c2=e12x{c}_{{2}}=-{{e}}^{{\frac{{1}}{{2}}{x}}}.

From the first equation, c1=c2e12x=(e12x)e12x=1{c}_{{1}}'=-{c}_{{2}}'{{e}}^{{-\frac{{1}}{{2}}{x}}}=-{\left(-{{e}}^{{\frac{{1}}{{2}}{x}}}\right)}{{e}}^{{-\frac{{1}}{{2}}{x}}}={1}.

So, c1=1dx=x{c}_{{1}}=\int{1}{d}{x}={x}, and c2=e12xdx=2e12x{c}_{{2}}=\int-{{e}}^{{\frac{{1}}{{2}}{x}}}{d}{x}=-{2}{{e}}^{{\frac{{1}}{{2}}{x}}}.

Therefore, yp=c1ex+c2e12x=xex2ex{y}_{{p}}={c}_{{1}}{{e}}^{{x}}+{c}_{{2}}{{e}}^{{\frac{{1}}{{2}}{x}}}={x}{{e}}^{{x}}-{2}{{e}}^{{x}}.

Finally, y=yh+yp=c1ex+c2e12x+xex2ex=c3ex+c2e12x+xex{y}={y}_{{h}}+{y}_{{p}}={c}_{{1}}{{e}}^{{x}}+{c}_{{2}}{{e}}^{{\frac{{1}}{{2}}{x}}}+{x}{{e}}^{{x}}-{2}{{e}}^{{x}}={c}_{{3}}{{e}}^{{x}}+{c}_{{2}}{{e}}^{{\frac{{1}}{{2}}{x}}}+{x}{{e}}^{{x}}, where c3=c12{c}_{{3}}={c}_{{1}}-{2}.

Now, let's consider one final example.

Example 3. Find the general solution of y+y=1cos(x){y}'''+{y}'=\frac{{1}}{{{\cos{{\left({x}\right)}}}}}.

The solution of the corresponding homogeneous equation is yh=c1+c2cos(x)+c3sin(x){y}_{{h}}={c}_{{1}}+{c}_{{2}}{\cos{{\left({x}\right)}}}+{c}_{{3}}{\sin{{\left({x}\right)}}}.

To find the particular solution, set up the system:

{c11+c2cos(x)+c3sin(x)=0c1(1)+c2(cos(x))+c3(sin(x))=0c1(1)+c2(cos(x))+c3(sin(x))=1cos(x){\left\{\begin{array}{c}{c}_{{1}}'\cdot{1}+{c}_{{2}}'{\cos{{\left({x}\right)}}}+{c}_{{3}}'{\sin{{\left({x}\right)}}}={0}\\{c}_{{1}}'\cdot{\left({1}\right)}'+{c}_{{2}}'{\left({\cos{{\left({x}\right)}}}\right)}'+{c}_{{3}}'{\left({\sin{{\left({x}\right)}}}\right)}'={0}\\{c}_{{1}}'\cdot{\left({1}\right)}''+{c}_{{2}}'{\left({\cos{{\left({x}\right)}}}\right)}''+{c}_{{3}}'{\left({\sin{{\left({x}\right)}}}\right)}''=\frac{{1}}{{{\cos{{\left({x}\right)}}}}}\\ \end{array}\right.},

Or

{c1+c2cos(x)+c3sin(x)=0c2sin(x)+c3cos(x)=0c2cos(x)c3sin(x)=1cos(x){\left\{\begin{array}{c}{c}_{{1}}'+{c}_{{2}}'{\cos{{\left({x}\right)}}}+{c}_{{3}}'{\sin{{\left({x}\right)}}}={0}\\-{c}_{{2}}'{\sin{{\left({x}\right)}}}+{c}_{{3}}'{\cos{{\left({x}\right)}}}={0}\\-{c}_{{2}}'{\cos{{\left({x}\right)}}}-{c}_{{3}}'{\sin{{\left({x}\right)}}}=\frac{{1}}{{{\cos{{\left({x}\right)}}}}}\\ \end{array}\right.}.

Solving this system gives c1=1cos(x), c2=1, c3=tan(x){c}_{{1}}'=\frac{{1}}{{{\cos{{\left({x}\right)}}}}},\ {c}_{{2}}'=-{1},\ {c}_{{3}}'=-{\tan{{\left({x}\right)}}}.

So,

c1=1cos(x)dx=ln(1+sin(x)cos(x)){c}_{{1}}=\int\frac{{1}}{{{\cos{{\left({x}\right)}}}}}{d}{x}={\ln{{\left({\left|\frac{{{1}+{\sin{{\left({x}\right)}}}}}{{{\cos{{\left({x}\right)}}}}}\right|}\right)}}}

c2=1dx=x{c}_{{2}}=\int-{1}{d}{x}=-{x}

c3=tan(x)dx=ln(cos(x)){c}_{{3}}=\int-{\tan{{\left({x}\right)}}}{d}{x}={\ln{{\left({\left|{\cos{{\left({x}\right)}}}\right|}\right)}}}.

Thus, yp=c1+c2cos(x)+c3sin(x)=ln(1+sin(x)cos(x))xcos(x)+ln(cos(x))sin(x){y}_{{p}}={c}_{{1}}+{c}_{{2}}{\cos{{\left({x}\right)}}}+{c}_{{3}}{\sin{{\left({x}\right)}}}={\ln{{\left({\left|\frac{{{1}+{\sin{{\left({x}\right)}}}}}{{{\cos{{\left({x}\right)}}}}}\right|}\right)}}}-{x}{\cos{{\left({x}\right)}}}+{\ln{{\left({\left|{\cos{{\left({x}\right)}}}\right|}\right)}}}{\sin{{\left({x}\right)}}}

Finally, the general solution is

y=yh+yp=c1+c2cos(x)+c3sin(x)+ln(1+sin(x)cos(x))xcos(x)+ln(cos(x))sin(x){y}={y}_{{h}}+{y}_{{p}}={c}_{{1}}+{c}_{{2}}{\cos{{\left({x}\right)}}}+{c}_{{3}}{\sin{{\left({x}\right)}}}+{\ln{{\left({\left|\frac{{{1}+{\sin{{\left({x}\right)}}}}}{{{\cos{{\left({x}\right)}}}}}\right|}\right)}}}-{x}{\cos{{\left({x}\right)}}}+{\ln{{\left({\left|{\cos{{\left({x}\right)}}}\right|}\right)}}}{\sin{{\left({x}\right)}}}