# Maximum Principle and Approximating Boundary Value Problems

### Solutions to differential equations often satisfy some sort of maximum principle, which can in turn be used to construct upper and lower bounds on solutions. We illustrate this in one dimension, using a boundary value problem for an ordinary differential equation (ODE).

Join the DZone community and get the full member experience.

Join For Freesolutions to differential equations often satisfy some sort of maximum principle, which can in turn be used to construct upper and lower bounds on solutions.

we illustrate this in one dimension, using a boundary value problem for an ordinary differential equation (ode).

## maximum principles

if the second derivative of a function is positive over an open interval (
*
a
*
,
*
b
*
), the function cannot have a maximum in that interval. if the function has a maximum over the closed interval [
*
a
*
,
*
b
*
] then it must occur at one of the ends, at
*
a
*
or
*
b
*
.

this can be generalized, for example, to the following maximum principle. let
*
l
*
be the differential operator

*
l
*
[
*
u
*
] =
*
u
*
” +
*
g
*
(
*
x
*
)
*
u’ + h
*
(
*
x
*
)

where
*
g
*
and
*
h
*
are bounded functions on some interval [
*
a, b
*
] and
*
h
*
is non-positive. suppose
*
l
*
[
*
u
*
] ≥ 0 on (
*
a, b
*
). if
*
u
*
has an interior maximum, then
*
u
*
must be constant.

## boundary value problems

now suppose that we’re interested in the boundary value problem
*
l
*
[
*
u
*
] =
*
f
*
where we specify the values of
*
u
*
at the endpoints
*
a
*
and
*
b, i.e. u
*
(
*
a
*
) =
*
u
_{
a
}
*
and

*u*(

*b*) =

*u*. we can construct an upper bound on

_{ b }*u*as follows.

suppose we find a function
*
z
*
such that
*
l
*
[
*
z
*
] ≤
*
f
*
and
*
z
*
(
*
a
*
) ≥
*
u
_{
a
}
*
and

*z*(

*b*) ≥

*u*. then by applying the maximum principle to

_{ b }*u*–

*z*, we see that

*u*–

*z*must be ≤ 0, and so

*z*is an upper bound for

*u*.

similarly, suppose we find a function
*
w
*
such that
*
l
*
[
*
w
*
] ≥
*
f
*
and
*
w
*
(
*
a
*
) ≤
*
u
_{
a
}
*
and

*w*(

*b*) ≤

*u*. then by applying the maximum principle to

_{ b }*w*–

*u*, we see that

*w*–

*u*must be ≤ 0, and so

*w*is an lower bound for

*u*.

note that any functions
*
z
*
and
*
w
*
that satisfy the above requirements give upper and lower bounds, though the bounds may not be very useful. by being clever in our choice of
*
z
*
and
*
w
*
we may be able to get tighter bounds. we might start by choosing polynomials, exponentials, etc. any functions that are easy to work with and see how good the resulting bounds are.

## airy equation example

the following is an elaboration on an example from [1]. suppose we want to bound solutions to

*
u
*
”(
*
x
*
) –
*
x u
*
(
*
x
*
) = 0

where
*
u
*
(0) = 0 and
*
u
*
(1) = 1. (this is a well-known equation, but for purposes of illustration we’ll pretend at first that we know nothing about its solutions.)

for our upper bound, we can simply use
*
z
*
(
*
x
*
) =
*
x
*
. we have
*
l
*
[
*
z
*
] ≤ 0 and
*
z
*
satisfies the boundary conditions exactly.

for our lower bound, we use
*
w
*
(
*
x
*
) =
*
x
*
– β
*
x
*
(1 –
*
x
*
). why? the function
*
z
*
already satisfies the boundary condition. if we add some multiple of
*
x
*
(1 –
*
x
*
) we’ll maintain the boundary condition since
*
x
*
(1 –
*
x
*
) is zero at 0 and 1. the coefficient β gives us some room to maneuver. turns out
*
l
*
[
*
w
*
] ≥ 0 if β ≥ 1/2. if we choose β = 1/2 we have:

(
*
x
*
+
*
x
*
^{
2
}
)/2 ≤
*
u
*
(
*
x
*
) ≤
*
x
*

in general, you don’t know the function you’re trying to bound. that’s when bounds are most useful. but this is a sort of toy example because we do know the solution. the equation in this example is well known and is called airy’s equation. the airy functions
*
ai
*
and
*
bi
*
are independent solutions. here’s a plot of the solution with its upper and lower bounds.

here’s the python code i used to solve for the coefficients of
*
ai
*
and
*
bi
*
and make the plot.

```
import numpy as np
from scipy.linalg import solve
from scipy.special import airy
import matplotlib.pyplot as plt
# airy(x) returns (ai(x), ai'(x), bi(x), bi'(x))
def ai(x):
return airy(x)[0]
def bi(x):
return airy(x)[2]
m = np.matrix([[ai(0), bi(0)], [ai(1), bi(1)]])
c = solve(m, [0, 1])
t = np.linspace(0, 1, 100)
plt.plot(t, (t + t**2)/2, 'r-', t, c[0]*ai(t) + c[1]*bi(t), 'k--', t, t, 'b-',)
plt.legend(["lower bound $(x + x^2)/2$",
"exact solution $c_0ai + c_1bi$",
"upper bound $x$"], loc="upper left")
plt.show()
```

scipy’s function
```
airy
```

has an optimization that we waste here. the function computes
*
ai
*
and
*
bi
*
and their first derivatives all at the same time. we could take advantage of that to remove some redundant computations, but that would make the code harder to read. we chose instead to wait an extra nanosecond for the plot.

* * *

[1] murray protter and hans weinberger. maximum principles in differential equations.

Published at DZone with permission of John Cook, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Comments