Escolar Documentos
Profissional Documentos
Cultura Documentos
Bisection Method
One of the first numerical methods developed to find the root of a nonlinear equation f(x)=0 was
the bisection method (also called Binary-Search method). The method is based on the following
theorem.
Theorem: An equation f(x)=0, where f(x) is a real continuous function, has at least one root
between xl and xu if f(xl) f(xu) < 0 (See Figure 1).
Note that if f(xl) f(xu) > 0, there may or may not be any root between xl and xu (Figures 2
and 3). Also if f(xl) f(xu) < 0, there may be more than one root between xl and xu (Figure 4). So
the theorem only guarantees one root between xΡ and xu if f(xl) f(xu) < 0.
Since the method is based on finding the root between two points, the method falls under
the category of bracketing methods.
Since the root is bracketed between two points, xl and xu, one can find the mid-point, xm
between xΡ and xu. This gives us two new intervals
2. xm and xu.
Page 1 of 10
Annexure
f(x)
xl
x
xu
Figure 1: At least one root exists between two points if function is real and continuous, and
changes sign
f(x)
xl x
xu
Figure 2: If function f(x) does not change sign between two points, roots of f(x)=0 may still
exist between the two points.
Page 2 of 10
Annexure
f(x) f(x)
xl xu
x
x
xl xu
Figure 3: If the function does not change sign between two points, there may not be any
roots between the two points.
f(x)
xu x
xl
Figure 4: If the function changes sign between two points, more than one root may exist
between the two points.
Page 3 of 10
Annexure
Is the root now between xl and xm, or between xm and xu? Well, one can find the sign of
f(xl)f(xm), and if f(xl)f(xm)<0 then the new bracket is between xl and xm, otherwise, it is between
xm and xu. So, you can see that you are literally halving the interval. As one repeats this process,
the width of the interval [xl, xu] becomes smaller and smaller, and you can “zero” in to the root
of the equation f(x) = 0. The algorithm for the bisection method is given as follows.
1. Choose xl and xu as two guesses for the root such that f(xl) f(xu) < 0, or in other words,
f(x) changes sign between xl and xu.
2. Estimate the root, xm of the equation f (x) = 0 as the mid-point between xl and xu as
xl + xu
xm =
2
a. If f(xl) f(xm) < 0, then the root lies between xΡ and xm; then xl = xl ; xu = xm.
b. If f(xl ) f(xm) > 0, then the root lies between xm and xu; then xl = xm; xu = xu.
c. If f(xl) f(xm) = 0; then the root is xm. Stop the algorithm if this is true.
where
x new
m = estimated root from present iteration
x old
m = estimated root from previous iteration
5. Compare the absolute relative approximate error ∈a with the pre-specified relative error
tolerance ∈s . If ∈a > ∈s , then go to Step 3, else stop the algorithm. Note one should
also check whether the number of iterations is more than the maximum number of
Page 4 of 10
Annexure
iterations allowed. If so, one needs to terminate the algorithm and notify the user about
it.
Example
To find the inverse of a number ‘a’, one can use the equation
1
f (c ) = a − =0
c
Solution
1
f (c ) = a −
c
= ac − 1
Lets us assume
cl = 0, cu = 1
Iteration 1
The estimate of the root is
c + cu
cm = l
2
0 +1
=
2
Page 5 of 10
Annexure
= 0 .5
f (c m ) = f (0.5) = 2.5(0.5) − 1 = 0.25
f (cl ) f (c m ) = f (0) f (0.5) = (− 1)(0.25) < 0
Hence the root is bracketed between cm and cl, that is, between 0 and 0.5. So, the lower and
upper limit of the new bracket are
cl = 0, cu = 0.5
At this point, the absolute relative approximate error, ∈a cannot be calculated as we do not have
a previous approximation.
Iteration 2
The estimate of the root is
cl + cu
cm =
2
0 + 0.5
=
2
= 0.25
f (c m ) = f (0.25) = 2.5(0.25) − 1 = −0.375
f (c m ) f (cu ) = f (0.25) f (0.5) = (− 0.375)(0.25) < 0
Hence, the root is bracketed between cm and cu, that is, between 0.25 and 0.5. So the lower and
upper limit of the new bracket is
cl = 0.25, cu = 0.5
c mnew − c mold
∈a = × 100
c mnew
0.25 − 0.5
= × 100
0.25
= 100%
None of the significant digits are at least correct in the estimated root of
c m = 0.25
Page 6 of 10
Annexure
Iteration 3
cl + cu
cm =
2
0.25 + 0.5
=
2
= 0.375
f (c m ) = f (0.375) = 2.5(0.375) − 1 = −0.0625
f (c m ) f (cu ) = f (0.375) f (0.5) = (− 0.0625)(0.25) < 0
Hence, the root is bracketed between cm and cu, that is, between 0.375 and 0.5. So the lower and
upper limit of the new bracket is
cl = 0.375, cu = 0.5
c mnew − c mold
∈a = × 100
c mnew
0.375 − 0.5
= × 100
0.375
= 33.33 %
Still none of the significant digits are at least correct in the estimated root of the equation as the
absolute relative approximate error is greater than 5%.
Seven more iterations were conducted and these iterations are shown in the table below.
Page 7 of 10
Annexure
Iteration cl cu cm ∈a % f(cm)
Hence the number of significant digits at least correct is given by the largest value of ‘m’ for
which
∈a <∈s = 0.5 x10 2− m
So
m = 2.
The number of significant digits at least correct in the estimated root of 0.39941 is 2.
Page 8 of 10
Annexure
1
A singularity in a function is defined as a point where the function becomes infinite. For example, for a function
such as 1/x, the point of singularity is x=0 as it becomes infinite.
Page 9 of 10
Annexure
f(x)
f(x)
Figure 7: Function f ( x ) =
1
= 0 has no root but changes sign.
x
Page 10 of 10