You are on page 1of 26

Classroom Tips and Techniques:

Green's Functions for Second-Order ODEs


Robert J. Lopez
Emeritus Professor of Mathematics and Maple Fellow
Maplesoft

Introduction
More than 50 years ago in a graduate course in differential equations, my colleagues and I struggled
to understand what a Green's function for an ordinary differential equation really was. One wag even
pointed to a green chalk mark on a blackboard and declared it to be the long-sought essence of the
Green's function.

It was a considerable time later that I articulated a terse description of the Green's function, namely,
that it is the kernel of the integral operator that inverts a differential operator. In fact, I felt free to
share this insight with students learning the Laplace transform in my undergraduate differential
equations courses at Rose-Hulman Institute of Technology. The syllabi for these courses included a
discussion of the Dirac delta function, from which the notions of transfer function, fundamental
solution, and Green's function for the initial value problem easily follow. Of course, I was fortunate
that the students in these courses had Maple at hand, either on desk-top computers or laptops. The
ability to obtain solutions of test problems directly, using Maple's dsolve command, and then by a
Green's function technique meant that the learning process was self-correcting. It was always
possible to obtain instant feedback to determine whether or not a given approach to a computation
was viable.

Explaining "the kernel of the integral operator that inverts the differential operator" really isn't that
hard. Use a simple example such as the initial value problem

for which the solution is

It's not hard to convince an undergraduate that the more complex initial value problem

might just have a solution of the form


where the function , the Green's function, arises from the additional complexity of the second-
order differential operator.

In this month's article, we will detail how Maple might be used to obtain Green's functions for
second-order initial value problems (IVPs) and boundary value problems (BVPs). For each, we
examine the cases of homogeneous and nonhomogeneous conditions; for the BVP, we examine both
the unmixed and mixed cases. In particular, the differential equation , where
, is used in each example listed in Table 1. The initial and boundary conditions that
distinguish the six examples considered, are listed in the table.

Exampl Conditions Characterization


e
1 IVP
2 IVP

BVP
3
Separated, homogeneous

BVP
4
Separated, nonhomogeneous

BVP
5
Mixed, homogeneous

BVP
6
Mixed, nonhomogeneous

Table 1 Initial or boundary conditions delineating the six examples of this discussion

For the IVP, the independent variable is taken as , whereas for the BVPs, it is taken as .

Initializations
The following installations, definitions, and notational devices are used to make Maple's calculations
more like what one might read in a textbook.

Install the inttrans package for access to the Laplace


transform.
Access the Wronskian command in the VectorCalculus
package.
Alias Y to the Laplace transform of .
Alias L to the laplace transform command.
Alias to invlaplace, the inverse Laplace transform
command.
Every instance of this symbol has to be set as an Atomic
Variable.

Alias to the Dirac "delta" function.

The left-hand side of the ODE for the IVPs.


The left-hand side of the ODE for the BVPs.
assign as function
Context Menu: Assign Function f

Example 1

Obtain the Green's function for the IVP , and use it to


obtain the solution to the given IVP.

Mathematical Solution
Method 1

Let L be the differential operator and let be the (weak) solution of

the IVP

Then the Green's function for the IVP is

, and the solution to this IVP is .

Because is a weak solution of the ODE , it does not have a continuous first
derivative. Indeed, it will later be shown that has a jump of across the line .

Method 2
Let be a fundamental set for the homogeneous ODE , and let
be the Wronskian for this fundamental set. Then the Green's function

for the IVP is

The astute reader will see this form of the Green's function arising from the particular solution
generated by the Variation of Parameters technique. Indeed, let the general solution of the
ODE be

The inert initial conditions require , and the particular solution can be compressed
into the single integral

whence the definition of the Green's function.

Maple's dsolve Solution


Invoking Maple's dsolve command leads to the following solution.

Figure 1 contains a graph of this solution.


Figure 1 Solution of the IVP in Example 1

Maple Implementation of Method 1


To obtain a weak solution of the equation , the Laplace transform can be used because the
ODE in Example 1 has constant coefficients. After applying the transform to the equation, use the
eval command to impose the inert initial conditions. Use the solve command to obtain and
note that in certain disciplines, this is usually called the transfer function, V.

(1)

(2)

(3)

Obtain . The inverse Laplace transform of is returned as an expression. To


convert this to a Maple function, use the unapply command.

(4)

(5)
Using , the nonzero rule in the Green's function, the solution of the IVP in Example 1 is
obtained in terms of hyperbolic functions, which can be changed to exponential functions via the
convert command.

A comparison of this solution to Maple's dsolve solution,

shows that the two are identical.

Figure 2 is a graph of the Green's function , while Figure 3 is a graph of the derivative
. Note the continuity of but the jump of in the derivative.

Figure 2 Graph of Figure 3 Graph of t-derivative


Maple Implementation of Method 2

Obtain a fundamental set for the homogeneous ODE with the dsolve command.

Use the unapply command to define the members of the fundamental set as the functions
and , making each name an atomic variable.

Obtain the Wronskian of and , then use the unapply command to define it as the function
W.

Obtain , the nonzero rule in the definition of the Green's function .


Note the use of the expand and combine commands, needed to compress the expression.

Use to obtain .

Compare to the solution obtained with Maple's dsolve command.


Example 2

Use a Green's function technique to solve the IVP . In


particular, take and .

Mathematical Solution
As in Method 2 for Example 1, the general solution of this IVP is of the form , where
is the homogeneous solution and is the particular solution obtained by Variation
of Parameters.

It is not hard to show that . Hence, A and B are determined by the two equations

and

The obvious techniques give and , where is the

Wronskian of the homogeneous solutions and .

The complete solution of the IVP is then , where is the

Green's function for the homogeneous case detailed in Example 1.

Maple's dsolve Solution


Invoking Maple's dsolve command leads to the following solution when and .
Figure 4 contains a graph of this solution.

Figure 4 Solution of the IVP in Example 2

Maple Solution from First Principles

The general solution is given by , which evaluates to

where Y is used in place of , is a fundamental set, and is the nonzero rule in the
Green's function obtained in Example 1.

Imposition of the nonhomogeneous initial conditions leads to the equations

(6)

whose solution is
Hence, the general solution becomes

which compares nicely to Maple's dsolve solution

(7)

Example 3

For the given BVP with separated homogeneous boundary conditions, obtain an appropriate
Green's function, and use it to solve the BVP.

Mathematical Solution
On the interval the boundary value problem

has as its Green's function

where , a fundamental set for the homogeneous ODE, satisfy


The solution of the BVP is then .

Maple's dsolve Solution


It is convenient to define the boundary conditions as functions.

An application of Maple's dsolve command then gives the solution as

Figure 5 displays a graph of this solution.

Figure 5 Solution of BVP in Example 3

Maple Solution from First Principles


The Green's function is constructed from a fundamental set whose members satisfy the
equations . To this end, take two linear combinations of the homogeneous
solutions and and impose and .
There are four constants to determine, but only two equations. Hence, solve the first equation for
in terms of ; and the second, for in terms of

The judicious choices of and then lead to the two solutions

The Wronskian of and , obtained with Maple's Wronskian command, is

and hence, the Green's function is

The solution of the BVP, computed via this Green's function, is then
That this solution is equivalent to YM, Maple's dsolve solution, is verified by showing the
difference between it and the Green's function solution to be zero.

=0

Example 4

For the given BVP with separated nonhomogeneous boundary conditions, obtain an appropriate
Green's function, and use it to solve the BVP.

Mathematical Solution
If the boundary conditions in Example 3 were the nonhomogeneous

the solution of the associated BVP is obtained by adding to the Green's function solution of
Example 3, the perturbation

Recall that . The solution of the BVP is then


Maple's dsolve Solution
As in Example 3, define the boundary conditions as functions.

An application of Maple's dsolve command then gives the solution as

This solution is graphed in Figure 6.

Figure 6 Solution of BVP in Example 4

Maple Solution from First Principles


Using the Green's function and the fundamental set from Example 3, the solution for Example 4 is

or
That this solution is equivalent to Maple's dsolve solution is verified by following calculation
showing the difference between these two solutions is zero.

=0

Example 5

For the given BVP with mixed homogeneous boundary conditions, obtain an appropriate Green's
function, and use it to solve the BVP.

Mathematical Solution
For the second-order ODE, the general mixed boundary conditions

include the periodic boundary conditions


We will examine two methods of solution, the first, a distributional approach in which the
equation is solved by the Laplace transform; and a second, gleaned from Ince's
classic ODE text.

Method 1

Take the Laplace transform of the equation and, since the initial consitions are
not known, set . Solve the resulting equation for , the Laplace
transform of , and impose the boundary conditions , giving two
equations in the two unknowns a and b. This determines the weak solution .

The Green's function determined by this method is , where

and the solution of the BVP, determined by the integral , is


1

Figure 7 provides a graph of this solution.

Figure 7 Solution of the BVP in Example 5

Method 2
Let be a fundamental set for the homogeneous ODE . Form a new fundamental
set , where and are two distinct linear combinations of and , and L and R
respectively represent "left" and "right". In particular, take

and

and build the Green's function from the piecewise function


The four constants are determined by four conditions: across the line , the
continuity of G and the jump of in the derivative of G, and the two boundary conditions.
In particular, the continuity condition is expressed via the equation while the
jump condition for the derivative is expressed via the equation . When
applying the boundary conditions, is used when evaluating at ; and , at .

Maple's dsolve Solution


For compactness, first define the two boundary conditions, then apply the dsolve command. The
solution is returned in a form that will allow comparisons to the results obtained by other
methods.

Maple Implementation of Method 1


The solution of is obtained via the Laplace transform, using the unknowns a and b
for and , respectively. To facilitate imposing the boundary conditions that then
determine the constants a and b, the solution is written as a pair of functions YL and YR, the first
applicable when , the second, when .

Obtain the Laplace transform of the ODE


(8)

Apply the initial conditions

(9)

Solve for the unknown Laplace transform and invert

Define the two solutions as functions

Apply the boundary conditions and solve the resulting equations for a and b. These are large
expressions in which hyperbolic and exponential functions appear. Considerable simplification is
obtained by converting all expressions to exponential form.
(10)

Form the Green's function and use it to calculate , the solution of the BVP. The proof that all
results are valid is obtained by showing the solution found with the Green's function is the same
as that found by Maple's dsolve command.

Form the Green's function

Use the Green's function to obtain the solution of the BVP

1
(11)

Show that the solution via the Green's function matches Maple's dsolve solution
=0

Maple Implementation of Method 2

Recalling that = was a fundamental set for the IVP in Example 1, write

assign as function
Context Menu: Assign Function VL
assign as function
Context Menu: Assign Function VR
Write and solve the four equations detailed in Method 2.

The continuity condition

The jump condition for the derivative

The two boundary conditions

Solve the four equations


Form the functions and , and from these, the piecewise function G.

The function

The function

The Green's function G

Verify that the Green's function via Method 2 is the same as the one via Method 1

Example 6

For the given BVP with mixed nonhomogeneous boundary conditions, obtain an appropriate
Green's function, and use it to solve the BVP.
Mathematical Solution
Let be a fundamental set satisfying . Then, to the solution in Example
5 add the perturbation

Recalling Method 2 in Example 5, the reader should note that

not only because the 's are functions of just whereas and are functions of both and , but
also because

In the solution of Example 5 by Method 2, the boundary conditions were applied to , not
separately to and .

Maple's dsolve Solution


For compactness, first define the two boundary conditions, then apply the dsolve command. The
solution is returned in a form that will allow comparisons to the results obtained by other
methods.

Figure 8 compares the graphs of the solutions from Examples 5 and 6, verifying that these two
solutions are different.

Figure 8 The solutions for Examples 5 and 6

Maple Solution from First Principles

To obtain the functions and , recall that = was a fundamental set for the IVP
in Example 1, and write

assign as function
Context Menu: Assign Function z1
assign as function
Context Menu: Assign Function z2

then apply the conditions


There are four constants and only two equations, so solve the first equation for and the second
for , obtaining

With judicious choices for and , obtain the fundamental set whose members are

Consequently, the appropriate perturbation is


and the solution to Example 6 is

That this solution agrees with Maple's dsolve solution is established by the following comparison.

=0

Legal Notice: © Maplesoft, a division of Waterloo Maple Inc. 2017. Maplesoft and Maple are trademarks of Waterloo Maple
Inc. This application may contain errors and Maplesoft is not liable for any damages resulting from the use of this material.
This application is intended for non-commercial, non-profit use only. Contact Maplesoft for permission if you wish to use this
application in for-profit activities.

You might also like