Lecture 14: Solving Linear Nonhomogeneous DEs

Lecture 14: Solving Linear Nonhomogeneous DEs
with the Method of Variation of parameters
Winfried Just
Department of Mathematics, Ohio University
October 9, 2015
Winfried Just, Ohio University
MATH3400, Lecture 14: Variation of Parameters
Drawbacks of the method of undetermined coefficients
The method of undetermined coefficients can often be used to find
a particular solution yp (x) of a nonhomogeneous linear DE
an (x)y (n) + an−1 (x)y (n−1) + . . . a1 (x)y 0 + a0 (x)y = g (x).
It has certain drawbacks though:
It works only if g (x) has a special form. With this method we
could not solve, for example,
y 00 + 9y = csc 3x
It works only if all terms ai (x) are constants. With this
method we could not solve, for example,
x 2 y 00 − xy 0 + y = sin x
Ohio University – Since 1804
Winfried Just, Ohio University
Department of Mathematics
MATH3400, Lecture 14: Variation of Parameters
What is the method of variation of parameters?
The method of variation of parameters gives a direct way of
finding the general solution y (x) of a nonhomogeneous linear DE
an (x)y (n) + an−1 (x)y (n−1) + . . . a1 (x)y 0 + a0 (x)y = g (x).
It works as long as you can explicitly integrate all relevant
functions.
Its major drawback is that it relies on formulas that are hard to
memorize.
Here we will restrict ourselves to presenting the method for
second-order linear DEs with leading coefficient a2 = 1.
Ohio University – Since 1804
Winfried Just, Ohio University
Department of Mathematics
MATH3400, Lecture 14: Variation of Parameters
How the method of variation of parameters works
Consider a 2nd -order nonhomogeneous second-order linear DE
y 00 + a1 (x)y 0 + a0 (x)y = g (x).
1
(1)
Find two linearly independent solutions y1 (x), y2 (x) of the
associated homogeneous DE
y 00 + a1 (x)y 0 + a0 (x)y = 0
2
(2)
Calculate the Wronskian
y1 (x) y2 (x)
W = det
.
y10 (x) y20 (x)
3
The general solution of (1) is given by
Z
y (x) = y1 (x)
−y2 (x)g (x)
dx + y2 (x)
W
Ohio University – Since 1804
Winfried Just, Ohio University
Z
y1 (x)g (x)
dx.
W
Department of Mathematics
MATH3400, Lecture 14: Variation of Parameters
Example 1
Consider the DE y 00 + 9y = csc 3x.
1
Find two linearly independent solutions y1 (x), y2 (x) of the
associated homogeneous DE y 00 + 9y = 0:
Let us choose y1 (x) = cos 3x and y2 (x) = sin 3x.
2
Calculate the Wronskian
y1 (x) y2 (x)
cos 3x
W = det
= det
y10 (x) y20 (x)
−3 sin 3x
3
sin 3x
3 cos 3x
= 3.
The general solution of y 00 + 9y = csc 3x is given by
Z
y (x) = y1 (x)
−y2 (x)g (x)
dx + y2 (x)
W
Ohio University – Since 1804
Winfried Just, Ohio University
Z
y1 (x)g (x)
dx.
W
Department of Mathematics
MATH3400, Lecture 14: Variation of Parameters
Example 1: Evaluate the integrals of Step 3
Let y1 (x) = cos 3x and y2 (x) = sin 3x. Then W = 3.
The general solution of y 00 + 9y = csc 3x is given by
R
R
(x)
(x)
dx + y2 (x) y1 (x)g
dx.
y (x) = y1 (x) −y2 (x)g
W
W
Substitute:
y (x) = cos 3x
R
− sin 3x csc 3x
3
dx + sin 3x
R
cos 3x csc 3x
3
dx.
1
sin 3x :
Simplify using the definition csc 3x =
R cot 3x
R
y (x) = cos 3x −1
3 dx + sin 3x
3 dx.
Integrate:
y (x) = cos 3x( −x
3 + c1 ) + sin 3x(ln(sin 3x) + c2 ) =
−x cos 3x
3
+ sin 3x ln(sin 3x) + c1 cos 3x + c2 sin 3x = yp (x) + yc (x).
The complementary solution yc (x) pops out of this calculation
when we multiply the constants of integration c1 , c2
with y1 (x) = cos 3x and y2 (x) = sin 3x.
Ohio University – Since Winfried
1804
Just, Ohio University
Department
of Mathematics
MATH3400, Lecture 14: Variation
of Parameters
Wait a minute: Can the formula possibly be correct?
When we substitute y1 (x) = cos 3x and y2 (x) = sin 3x into
R
R
g (x)
dx + y2 (x) y1 (x)Wg (x) dx,
y (x) = y1 (x) −y2 (x)
W
we get
y (x) = cos 3x
R
− sin 3x g (x)
W
dx + sin 3x
R
cos 3x g (x)
W
dx.
But what if we switch names: y1 (x) = sin 3x and y2 (x) = cos 3x?
After substituting we get:
R
R
3x g (x)
yswitched (x) = sin 3x − cosW
dx + cos 3x
sin 3x g (x)
W
dx,
which seems to be −y (x).
Impossible!
If the method is correct, it must give the same result,
regardless of which function was labeled y1 (x).
What is going on here?
Ohio University – Since 1804
Winfried Just, Ohio University
Department of Mathematics
MATH3400, Lecture 14: Variation of Parameters
The Wronskian also changes sign
For the choice y1 (x) = cos 3x and y2 (x) = sin 3x we got W = 3.
For the choice y1 (x) = sin 3x and y2 (x) = cos 3x we get:
W = det
y1 (x) y2 (x)
y10 (x) y20 (x)
= det
sin 3x
3 cos 3x
Substitution into
R
R
g (x)
y (x) = y1 (x) −y2 (x)
dx + y2 (x)
W
cos 3x
−3 sin 3x
y1 (x) g (x)
W
= −3.
dx
gives for y1 (x) = cos 3x and y2 (x) = sin 3x:
R
R cos 3x g (x)
g (x)
y (x) = cos 3x − sin 3x
dx
+
sin
3x
dx,
3
3
and for y1 (x) = sin 3x and y2 (x) = cos 3x:
R
R
3x g (x)
yswitched (x) = sin 3x − cos−3
dx + cos 3x
sin 3x g (x)
−3
dx.
The result does not change when we switch names.
But we need to keep track of which function is named y1 (x)!
Ohio University – Since 1804
Winfried Just, Ohio University
Department of Mathematics
MATH3400, Lecture 14: Variation of Parameters
Example 2
Consider the DE y 00 − x1 y 0 +
1
1
y
x2
= sin x.
Find two linearly independent solutions y1 (x), y2 (x) of the
complementary Cauchy-Euler DE y 00 − x1 y 0 +
1
y
x2
= 0:
Let us choose y1 (x) = x and y2 (x) = x ln x.
2
Calculate the Wronskian
y1 (x) y2 (x)
x
x ln x
W = det
= det
= x.
y10 (x) y20 (x)
1 ln x + 1
3
The general solution of y 00 − x1 y 0 +
Z
y (x) = y1 (x)
1
y
x2
= sin x is given by
−y2 (x)g (x)
dx + y2 (x)
W
Ohio University – Since 1804
Winfried Just, Ohio University
Z
y1 (x)g (x)
dx.
W
Department of Mathematics
MATH3400, Lecture 14: Variation of Parameters
Example 2: Evaluate the integrals of Step 3
Let y1 (x) = x and y2 (x) = x ln x. Then W = x.
The general solution of y 00 − x1 y 0 + x12 y = sin x is given by
R y1 (x)g (x)
R
(x)
dx
+
y
(x)
dx.
y (x) = y1 (x) −y2 (x)g
2
W
W
Substitute:
R
y (x) = x
−x ln x sin x
x
dx + x ln x
R
x sin x
x
dx.
Simplify:
y (x) = x
R
− ln x sin x dx + x ln x
R
sin x dx.
Integrate: The second integral is easy. But the first?
Best to leave it in symbolic form.
R
x
y (x) = x − x0 ln u sin u du + c1 + x ln x(− cos x + c2 ) =
Rx
−x x0 ln u sin u du − x ln x cos x + c1 x + c2 x ln x = yp (x) + yc (x).
Here yp (x) contains a part that is well-defined and can be
numerically approximated, but does not have an explicit formula.
Just, Ohio University
Ohio University – Since Winfried
1804
MATH3400, Lecture 14: Variation
of Parameters
Department
of Mathematics