9. ODE Methods - Variation of Parameters#

Whilst the method of undetermined coefficients works for specific set of source terms f(x) (i.e. those of certain elementary functions with symmetries in their derivatives), we could ask what is the more general method for solving these sorts of ODEs?

Definition

The variation of parameters method can be used to solve nth degree linear ODEs of the form:

y(n)(x)+i=0n1ai(x)y(i)(x)=f(x)

which can be shown to have the solution:

i=1nui(x)Wi(x)W(x)dx

where ui(x),i{1,2,,n} are the the homogeneous solutions of the ODE, W(x) is the Wronskian of these homogeneous solutions:

W(u1,,un)=|u1(x)u2(x)un(x)u1(x)u2(x)un(x)u1(n1)(x)u2(n1)(x)un(n1)(x)|

and Wi(x) is the reduced Wronskian:

Wi(x)=|u1(x)u2(x)0un(x)u1(x)u2(x)0un(x)u1(n1)(x)u2(n1)(x)f(x)un(n1)(x)|

where the ith column of the Wronskian W(x) has been replaced with:

(00f(x))

9.1. First order systems#

If we start with a general first order linear ODE:

(9.1)#y+p(x)y=q(x)

we can think of this a sourced first order problem, so the homogenous equation is:

y+p(x)y=0

which we can solve, for instance with separation of variables:

1ydy=pdxln(y)=pdx+ln(y0)yh=y0epdx

where y0 is a constant.

Now we can use this homogeneous solution yh(x) to solve for the inhomogeneous case yp(x), by multiplying this solution with a (yet unknown) function C(x):

yp=C(x)epdx

If we substitute this back into (9.1) we will find:

C(x)epdxC(x)p(x)epdx+p(x)C(x)epdx=q(x)C(x)epdx=q(x)

which by straight integration means that:

C(x)=q(x)epdxdxyp=epdxq(x)epdxdx

and so the final solution is given by the sum of:

y=yh+yp=epdx(q(x)epdxdx+y0)

which we have seen before with integrating factors for first order systems.

9.2. Second order systems#

Let’s begin again with the form of the inhomogeneous second order ODE in ode2order:

Ly(x)=y(x)+p(x)y(x)+q(x)y(x)=r(x)

firstly we aim to solve the homogeneous equation:

Ly(x)=y(x)+p(x)y(x)+q(x)y(x)=0

which will admit solutions u1(x),u2(x). Hence we will construct a solution to the general equation of the form:

(9.2)#y(x)=A(x)u1(x)+B(x)u2(x)

We note that if A(x),B(x) here were just constants, then this would be a linear superposition of the homogeneous solutions - therefore in general these should contain some additive constant with each function. In order to have two equations with two unknowns, we need to enforce a separate condition on A(x),B(x), as we will see the most helpful condition to simplify later algebra turns out to be:

(9.3)#A(x)u1(x)+B(x)u2(x)=0

If we try to constuct the form of (8.1) using (9.2), we will find:

y(x)=(A(x)u1(x)+B(x)u2(x))=A(x)u1(x)+B(x)u2(x)+A(x)u1(x)+B(x)u2(x)=A(x)u1(x)+B(x)u2(x)

where we have used our condition (9.3) to reach the final line. Likewise for second derivatives:

y(x)=A(x)u1(x)+B(x)u2(x)+A(x)u1(x)+B(x)u2(x)

and so using the linear derivative operator:

Ly(x)=A(x)u1(x)+B(x)u2(x)+A(x)u1(x)+B(x)u2(x)+p(x)(A(x)u1(x)+B(x)u2(x))+q(x)(A(x)u1(x)+B(x)u2(x))=f(x)=A(x)(u(x)+u(x)+u(x))+B(x)(u(x)+u(x)+u(x))+A(x)u1(x)+B(x)u2(x)=A(x)u1(x)+B(x)u2(x)+A(x)Lu1(x)+B(x)Lu2(x)=A(x)u1(x)+B(x)u2(x)

where we have used the fact that the terms with A(x),B(x) coefficients are actually just the homogeneous equations, hence they equal zero. So this leaves a coupled ODE system:

A(x)u1(x)+B(x)u2(x)=0A(x)u1(x)+B(x)u2(x)=r(x)

which if we write as a matrix system W(x)a=b:

(u1(x)u2(x)u1(x)u2(x))(A(x)B(x))=(0r(x))

where W(x) is the Wronskian of the system.

So to find the solutions a=W1b we can invert this matrix as:

(A(x)B(x))=1W(u2(x)u2(x)u1(x)u1(x))(0f(x))=1W(u2(x)r(x)u1(x)r(x))

which means the final solutions can be found from:

(9.4)#A(x)=1Wu2(x)r(x)dxB(x)=1Wu1(x)r(x)dx

Worked example

Lets try and solve the ODE:

y+4y+3y=cosh(2x)

subject to the conditions y(0)=715,y(0)=115. We note that this could be solved with method of undetermined coefficients, but this means we can double check our results later!

The solutions to the homoegenous ODE can be found from the ansatz y=eλx:

λ2+4λ+3=0λ=1,3u1(x)=exu2(x)=e3x

which means that in order to construct the full solution:

y(x)=A(x)u1(x)+B(x)u2(x)

We need the Wronskian W(x) of the system, here given by:

W=|exe3xex3e3x|=3e4x(e4x)=2e4x

and so using (9.4):

A(x)=12e4xe3xcosh(2x)dx=14(e3x+ex)dx=14(13e3xex)+C1B(x)=12e4xexcosh(2x)dx=14(e5x+ex)dx=14(15e5x+ex)+C2

wher C1,C2 are constants. This means the final solution is given by:

y=(112e3x14ex)ex(120e5x14ex)e3x+(C1ex+C2e3x)=112e2x14e2x120e2x14e2x+(C1ex+C2e3x)=160(2e2x30e2x)+(C1ex+C2e3x)

Given the initial conditions, we find that:

y(0)=2860+(C1+C2)=715C1+C2=0y(x)=160(4e2x+60e2x)+(C1ex3C2e3x)y(0)=6460+(C13C2)=115C13C2=1

which we can solve as C1=1/2,C2=1/2, which gives final solutions as:

y(x)=130(e2x15e2x+15ex15e3x)

which we can check gives the right answer as:

y(x)=130(e2x15e2x+15ex15e3x)y(x)=130(2e2x+30e2x15ex+45e3x)y(x)=130(4e2x60e2x+15ex135e3x)y+4y+3y=130[(4+8+3)e2x+(60+12045)e2x+(1560+45)ex+(135+18045)e3x]=130(15e2x+15e2x)=cosh(2x)

and so the solutions are correct!