A common computational job is to find the root(s) of a function. That
is, for some function , find all the values of
that make
. If
, the root would be
,
a bit of a job to find before hand-held calculators.
The first step is to make a guess, or two. If you're lucky and guess
two numbers with
and
, then
you can make the following conclusion: so long as
is continuous,
the interval
contains at least one root. ``Proof'' is a
picture: the graph of
is above the axis at
and below the
axis at
, so somewhere in between it must cross the axis (this
``proof'' of the Intermediate Value Theorem wouldn't get you through
Calculus, but it will help you find a root).
The same conclusion holds if
and
. One way
to combine the two conditions is:
.
So, we cut the interval in half. Let be
. There
must be a root in either
or
, so we can
repeat our test: if
(in which case we'd be done), then
either
or
. We
can now restrict our search to half the original interval. Keep doing
this until the interval is ``small enough.'' If we decide in advance
that we want to be within some tolerance factor
of the root
,
then we keep cutting our interval in half until it is smaller than
. Notice that, even if
is small (for example
), the
fact that
, doesn't guarantee that
is small --
may have a large slope near
.
If you took the approach that you would keep bisecting until the
mid-point (call it ) of your interval had
, then
you might have an infinite loop. For example, consider finding the
root of
on a computer that could represent 5 decimal
digits. If you bisected until you had the interval
,
then the mid-point (in 5-digit precision) would be 1.4143...With
this approach, you must specify the maximum number of iterations
(loops).
If you repeat this process times, getting an interval
, and you return
as your best approximation of the
root
, you can be assured that
.
If we denote the length of
th interval by
, then
, and we say that the bisection method converges linearly
(due to the exponent 1).
There are root finding methods that converge with a higher exponent than 1, but they are not guaranteed to converge, whereas bisection always converges once we've made two appropriate initial guesses.