Higher-Order Variation of Parameters

by Justin Skycak (@justinskycak) on

Solving linear systems can sometimes be a necessary component of solving nonlinear systems.

This post is part of the book Justin Math: Linear Algebra. Suggested citation: Skycak, J. (2019). Higher-Order Variation of Parameters. In Justin Math: Linear Algebra. https://justinmath.com/higher-order-variation-of-parameters/

Want to get notified about new posts? Join the mailing list and follow on X/Twitter.


Until this point, we have been working exclusively with linear systems. However, solving linear systems can sometimes be a necessary component of solving nonlinear systems.

Second-Order Variation of Parameters

For example, recall the variation of parameters method for solving a second-order differential equation of the form

y+a1(x)y+a0(x)y=f(x).


Variation of parameters proceeds by first guessing a solution of the form

yf(x)=u1(x)y1(x)+u2(x)y2(x),


where y1 and y2 are the two zero solutions of the differential equation

y+a1(x)y+a0(x)y=0,


and u1(x) and u2(x) are some unknown multiplier functions that we solve for by setting up a system of equations.

To set up the first equation in our system, we force

yf(x)=u1(x)y1(x)+u2(x)y2(x)


and equate it to the true derivative of yf:

yf=u1y1+u2y2(u1y1+u2y2)=u1y1+u2y2u1y1+u1y1+u2y2+u2y2=u1y1+u2y2u1y1+u2y2=0


The second equation comes from substituting our guess for yf into the differential equation and simplifying, using the fact that y1 and y2 are the zero solutions.

f=yf+a1yf+a0yff=(u1y1+u2y2)+a1(u1y1+u2y2)+a0(u1y1+u2y2)f=(u1y1+u1y1+u2y2+u2y2)+a1(u1y1+u2y2)+a0(u1y1+u2y2)f=(u1)(y1+a1y1+a0y1)+(u2)(y2+a1y2+a0y2)+u1y1+u2y2f=(u1)(0)+(u2)(0)+u1y1+u2y2f=u1y1+u2y2


This results in a square system of 2 equations.

{u1y1+u2y2=0u1y1+u2y2=f


In 2 dimensions, we can easily solve for u1 and u2 using elimination, obtaining the result below.

u1=y2fy1y2y2y1u2=y1fy1y2y2y1


Then, we can simply integrate and substitute these back into our particular solution.

yf=u1y1+u2yy=y1y2fy1y2y2y1dx+y2y1fy1y2y2y1dx


Higher-Order Variation of Parameters

When we wish to use variation of parameters to find the particular solution of an Nth order differential equation

yn+a1(x)yn1++an(x)y=f(x)


we guess a solution of the form

yf(x)=u1(x)y1(x)+u2(x)y2(x)++un(x)yn(x)


and force

yf(x)=u1(x)y1(x)+u2(x)y2(x)++un(x)yn(x)yf(x)=u1(x)y1(x)+u2(x)y2(x)++un(x)yn(x)y(n1)f(x)=u1(x)y(n1)1(x)+u2(x)y(n1)2(x)++un(x)y(n1)n(x).


By equating each derivative with the true derivative of yf up to order N, we can set up a system of equations.

u1y1+u2y2++unyn=0u1y1+u2y2++unyn=0u1y(n2)1+u2y(n2)2++uny(n2)n=0u1y(n1)1+u2y(n1)2++uny(n1)n=f


This system is difficult to solve by elimination. But now we can use Cramer’s rule! First, let’s write our system more compactly, using the notation

y(0:n1)i=yi,yi,,y(n1)i.


The system becomes

u1y(0:n1)1+u2y(0:n1)2++uny(0:n1)n=0,,0,f.


According to Cramer’s rule, each ui is given by

ui=det(y(0:n1)1,,y(0:n1)i1,0,,0,f,y(0:n1)i+1,,y(0:n1)n)det(y(0:n1)1,y(0:n1)2,,y(0:n1)n).


The denominator of this fraction is also known as the Wronskian, denoted

W(y1,y2,,yn)=det(y(0:n1)1,y(0:n1)2,,y(0:n1)n).


If we define Wi,f as

Wi,f(y1,y2,,yn)=det(y(0:n1)1,,y(0:n1)i1,0,,0,f,y(0:n1)i+1,,y(0:n1)n)



then we have

ui=Wi,f(y1,y2,,yn)W(y1,y2,,yn).


Finally, we can write the particular solution to the differential equation by integrating and substituting into our initial guess.

yf=y1W1,f(y1,y2,,yn)W(y1,y2,,yn)dx++ynWn,f(y1,y2,,yn)W(y1,y2,,yn)dx


Demonstration

Let’s illustrate this method on a simple example. To make it easier to find the zero solutions, we’ll choose an example with constant coefficients, but remember that this method works even when the coefficients are functions themselves.

y2yy+2y=e3x


We start off by finding the zero solutions, i.e. those that satisfy the equation whose right-hand side is zero.

y2yy+2y=0


We do this by finding the roots of the characteristic polynomial p(r)=r32r2r+2. We can find the roots via factoring by grouping.

0=r32r2r+20=r2(r2)1(r2)0=(r21)(r2)0=(r+1)(r1)(r2)r=1,1,2


These roots correspond to the following zero solutions:

y1=C1exy1=C1exy2=C2e2x


It remains to find the particular solution. To use variation of parameters, we need three independent zero solutions, so we’ll choose the simplest ones from above: ex,ex,e2x.

Substituting these into the variation of parameters formula, we have a particular solution of the form

yf=exW1,f(ex,ex,e2x)W(ex,ex,e2x)dx+exW2,f(ex,ex,e2x)W(ex,ex,e2x)dx+e2xW3,f(ex,ex,e2x)W(ex,ex,e2x)dx


with f(x)=e3x. Now, it remains to do the computations. First, we compute the standard Wronskian in the denominator.

W(ex,ex,e2x)=det((ex(ex)(ex)),(ex(ex)(ex)),(e2x(e2x)(e2x)))=det((exexex),(exexex),(e2x2e2x4e2x))=(ex)(ex)(e2x)det((111),(111),(124))=(ex)(ex)(e2x)(6)=6e2x


Next, we compute the modified Wronskians in the numerators.

W1,f(ex,ex,e2x)=det((00e3x),(ex(ex)(ex)),(e2x(e2x)(e2x)))=det((00e3x),(exexex),(e2x2e2x4e2x))=(e3x)(ex)(e2x)det((001),(111),(124))=(e3x)(ex)(e2x)(1)=e6x


W2,f(ex,ex,e2x)=det((ex(ex)(ex)),(00e3x),(e2x(e2x)(e2x)))=det((exexex),(00e3x),(e2x2e2x4e2x))=(ex)(e3x)(e2x)det((111),(001),(124))=(ex)(e3x)(e2x)(3)=3e4x


W3,f(ex,ex,e2x)=det((ex(ex)(ex)),(ex(ex)(ex)),(00e3x))=det((exexex),(exexex),(00e3x))=(ex)(ex)(e3x)det((111),(111),(001))=(ex)(ex)(e3x)(2)=2e3x


Lastly, we substitute back into the formula for the particular solution, and simplify.

yf=exW1,f(ex,ex,e2x)W(ex,ex,e2x)dx+exW2,f(ex,ex,e2x)W(ex,ex,e2x)dx+e2xW3,f(ex,ex,e2x)W(ex,ex,e2x)dx=exe6x6e2xdx+ex3e4x6e2xdx+e2x2e3x6e2xdx=ex16e4xdx+ex12e2xdx+e2x13exdx=ex(124e4x)+ex(14e2x)+e2x(13ex)=124e3x+14e3x+13e3x=18e3x


The full solution to the differential equation, then, is

y=C1ex+C1ex+C2e2x+18e3x.


Exercises

Solve the following differential equations using variation of parameters. (You can view the solution by clicking on the problem.)

1)yy4y+4y=e2x
Solution:
y=C2e2x+C1ex+(C2+14x)e2x


2)yy5y3y=ex
Solution:
y=(C1,0+C1,1x)ex+C3e3x18ex


3)y+yyy=cosx
Solution:
y=C1ex+(C1,0+C1,1x)ex14(sinx+cosx)


4)y2y9y+18y=sinx
Solution:
y=C3e3x+C2e2x+C3e3x+125sinx+150cosx


5)y2y+y2=cosx
Solution:
y=C0+(C1,0+C1,1x)ex+2x+12cosx


6)yy+y4=sinx
Solution:
y=[C1sin(152x)+C2cos(152x)]e12x+x+110sinx310cosx+C3



This post is part of the book Justin Math: Linear Algebra. Suggested citation: Skycak, J. (2019). Higher-Order Variation of Parameters. In Justin Math: Linear Algebra. https://justinmath.com/higher-order-variation-of-parameters/


Want to get notified about new posts? Join the mailing list and follow on X/Twitter.