← Back to Math 055

4.6 Variation of Parameters: Class Notes

4.6a

Consider the homogeneous second-order differential equation a2(x)y″+a1(x)y′+a0(x)y=0. The general solution to this DE is y=c1y1+c2y2. When the input function of an associated nonhomogeneous DE is not restricted to the type we saw in 4.4, we consider particular solutions with coefficients that are variable functions. That is, we will find yp(x)=u1(x)y1(x)+u2(x)y2(x).

Starting with a2(x)y″+a1(x)y′+a0(x)y=g(x), divide by a2(x) to put the DE in standard form:

y″+P(x)y′+Q(x)y=f(x).

The complementary function (from 4.3) is yc=c1y1+c2y2, where c1 and c2 are constants.

Now consider yp=u1(x)y1(x)+u2(x)y2(x), with the constants replaced by functions. Differentiate it twice:

yp′=u1′y1+u1y1′+u2′y2+u2y2′yp″=u1″y1+2u1′y1′+u1y1″+u2″y2+2u2′y2′+u2y2″

Substituting y″, P(x)y′, and Q(x)y into y″+P(x)y′+Q(x)y=f(x), the DE becomes

u1″y1+2u1′y1′+u1y1″+u2″y2+2u2′y2′+u2y2″+Pu1′y1+Pu1y1′+Pu2′y2+Pu2y2′+Qu1y1+Qu2y2=f(x).

Since y1 and y2 are solutions of the homogeneous DE, the terms with u1 itself (not its derivatives) add up to zero:

u1(y1″+Py1′+Qy1)=0.

Likewise for y2: the u2 terms add up to zero. What remains is

u1″y1+2u1′y1′+u2″y2+2u2′y2′+P(u1′y1+u2′y2)=f(x).

Split 2u1′y1′ into u1′y1′+u1′y1′. The piece u1″y1+u1′y1′ is the derivative ddx(u1′y1) by the Product Rule, and in the same way u2″y2+u2′y2′ is ddx(u2′y2). The equation becomes

ddx(u1′y1+u2′y2)+u1′y1′+u2′y2′+P(u1′y1+u2′y2)=f(x).

If we require u1′y1+u2′y2=0, the first and last groups are zero, so u1′y1′+u2′y2′=f(x). Here we are considering a system with unknown functions u1′ and u2′:

u1′y1+u2′y2=0u1′y1′+u2′y2′=f(x)

Recall: Cramer’s Rule

The system ax+by=e, cx+dy=f can be solved using Cramer’s Rule:

D=|abcd|=ad−bc,Dx=|ebfd|,Dy=|aecf|

x=DxD,y=DyDif D≠0.

To see where this comes from, multiply the first equation by d and the second by b, then subtract (the third line is the difference):

adx+bdy=de−(bcx+bdy)=−(bf)(ad−bc)x=de−bf

so x=de−bfad−bc=DxD. Likewise, y=af−cead−bc=DyD.

Here the unknowns are u1′ and u2′, so we form

W=|y1y2y1′y2′|,W1=|0y2f(x)y2′|,W2=|y10y1′f(x)|.

W1 and W2 use f(x), the right side of the standard form, so the DE must be in standard form before forming them.

4.6b

W=|y1y2y1′y2′|,W1=|0y2f(x)y2′|,W2=|y10y1′f(x)|

Expanding the determinants, W1=−f(x)y2 and W2=f(x)y1.

u1′=W1W⟹u1=∫W1Wdxu2′=W2W⟹u2=∫W2Wdx

yp=u1y1+u2y2 and y=yc+yp

Example

Solve the differential equation by variation of parameters.

y″+y=sec⁡θtan⁡θ

Solution

The auxiliary equation is m2+1=0, so m=±i and

yc=c1cos⁡θ+c2sin⁡θ,y1=cos⁡θ,y2=sin⁡θ.

The Wronskian and the other two determinants:

W=|cos⁡θsin⁡θ−sin⁡θcos⁡θ|=cos2⁡θ+sin2⁡θ=1

W1=|0sin⁡θsec⁡θtan⁡θcos⁡θ|=−tan2⁡θ,W2=|cos⁡θ0−sin⁡θsec⁡θtan⁡θ|=tan⁡θ

Then

u1=∫(−tan2⁡θ)dθ=∫(1−sec2⁡θ)dθ=θ−tan⁡θ.

Tip: No +C is needed here: it would only add Cy1 to the solution, which we already have in yc.

u2=∫tan⁡θdθ=−∫−sin⁡θcos⁡θdθ=−ln⁡|cos⁡θ|=ln⁡|sec⁡θ|

For this integral, let u=cos⁡θ, so du=−sin⁡θdθ.

So the particular solution is

yp=u1y1+u2y2=(θ−tan⁡θ)cos⁡θ+sin⁡θln⁡|sec⁡θ|=θcos⁡θ−sin⁡θ+sin⁡θln⁡|sec⁡θ|.

The term −sin⁡θ is a multiple of y2=sin⁡θ, so it combines with c2sin⁡θ in yc:

y=c1cos⁡θ+c2sin⁡θ+θcos⁡θ−sin⁡θ+sin⁡θln⁡|sec⁡θ|

Answer: y=c1cos⁡θ+c2sin⁡θ+θcos⁡θ+sin⁡θln⁡|sec⁡θ|

4.6c

Example

Solve the initial-value problem by variation of parameters.

2y″+y′−y=x+1,y(0)=1,y′(0)=0

Solution

Divide by 2 to put the DE in standard form before forming W, W1, and W2:

y″+12y′−12y=x+12,f(x)=x+12

The auxiliary equation of the original DE is 2m2+m−1=0, so (2m−1)(m+1)=0 and m=1/2, −1:

yc=c1e−x+c2ex/2,y1=e−x,y2=ex/2

W=|e−xex/2−e−x12ex/2|=12e−x/2+e−x/2=32e−x/2

W1=|0ex/2x+1212ex/2|=−ex/2(x+12),W2=|e−x0−e−xx+12|=e−x(x+12)

For u1, integrate by parts with u=x+1, du=dx, dv=exdx, v=ex:

u1=13∫−ex/2(x+1)e−x/2dx=−13∫ex(x+1)dx=−13(x+1)ex+13ex=−13xex

For u2, integrate by parts with u=x+1, du=dx, dv=e−x/2dx, v=−2e−x/2:

u2=13∫e−x(x+1)e−x/2dx=13∫e−x/2(x+1)dx=−23(x+1)e−x/2−43e−x/2=−23xe−x/2−2e−x/2

Then yp=u1y1+u2y2=−13x−23x−2=−x−2, so

y=c1e−x+c2ex/2−x−2.

Apply the initial conditions, using y′=−c1e−x+12c2ex/2−1:

y(0)=1⟹1=c1+c2−2⟹c1+c2=3y′(0)=0⟹0=−c1+12c2−1⟹−c1+12c2=1

Adding the two equations gives 32c2=4, so c2=83 and c1=3−83=13.

Answer: y=13e−x+83ex/2−x−2

Example

Solve the differential equation by variation of parameters.

y″−4y=e2xx

Solution

The auxiliary equation is m2−4=0, so m=±2:

yc=c1e2x+c2e−2x,y1=e2x,y2=e−2x

W=|e2xe−2x2e2x−2e−2x|=−2−2=−4

W1=|0e−2xe2xx−2e−2x|=−1x,W2=|e2x02e2xe2xx|=e4xx

u1=∫W1Wdx=14∫1xdx=14ln⁡|x|

u2=∫W2Wdx=−14∫e4xxdx

The integrand e4xx has no elementary antiderivative, so u2 stays an integral, written with a variable upper limit:

u2=−14∫x0xe4ttdt

Answer: y=c1e2x+c2e−2x+14e2xln⁡|x|−14e−2x∫x0xe4ttdt

4.6d

Example

Solve the given third-order differential equation by variation of parameters.

y‴+4y′=sec⁡2x

Solution

The auxiliary equation is m3+4m=0, so m(m2+4)=0 and m=0, ±2i:

yc=c1+c2cos⁡2x+c3sin⁡2x

Recall: 3×3 determinant

|abcdefghi|=a|efhi|−b|dfgi|+c|degh|

Each entry of the top row multiplies the 2×2 determinant left when its row and column are crossed out. The signs follow the checkerboard pattern

+−+−+−+−+

so you can also expand along any other row or column, such as a column with zeros.

Expanding the Wronskian down the first column (only its top entry is nonzero):

W=|1cos⁡2xsin⁡2x0−2sin⁡2x2cos⁡2x0−4cos⁡2x−4sin⁡2x|=1|−2sin⁡2x2cos⁡2x−4cos⁡2x−4sin⁡2x|=8

For Wk, replace column k of W with 0, 0, sec⁡2x:

W1=|0cos⁡2xsin⁡2x0−2sin⁡2x2cos⁡2xsec⁡2x−4cos⁡2x−4sin⁡2x|=sec⁡2x|cos⁡2xsin⁡2x−2sin⁡2x2cos⁡2x|=2sec⁡2x

W2=|10sin⁡2x002cos⁡2x0sec⁡2x−4sin⁡2x|=|02cos⁡2xsec⁡2x−4sin⁡2x|=−2

W3=|1cos⁡2x00−2sin⁡2x00−4cos⁡2xsec⁡2x|=|−2sin⁡2x0−4cos⁡2xsec⁡2x|=−2tan⁡2x

Then uk′=Wk/W:

u1=∫14sec⁡2xdx=18ln⁡|sec⁡2x+tan⁡2x|u2=∫(−14)dx=−14xu3=∫(−14tan⁡2x)dx=18ln⁡|cos⁡2x|

With yp=u1·1+u2cos⁡2x+u3sin⁡2x, and on an interval where cos⁡2x≠0:

Answer: y=c1+c2cos⁡2x+c3sin⁡2x+18ln⁡|sec⁡2x+tan⁡2x|−14xcos⁡2x+18sin⁡2xln⁡|cos⁡2x|,(−π/4<x<π/4)