Bisection Method
Bisection Method
09/17/2024 1
Basis of Bisection Method
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) < f(x)
0.
x
x
xu
Figure 1 At least one root exists between the two points if the
function is real, continuous, and changes sign.
2 http://numericalmethods.eng.usf.edu
Basis of Bisection Method
f(x)
x x
xu
x xu
x x
x xu
f x
Figure 3 If the function does not change sign between two
x equation
points, there may not be any roots forf the 0
between the two points.
4 http://numericalmethods.eng.usf.edu
Basis of Bisection Method
f(x)
xu x
x
f x
Figure 4 If the function changes sign between two points,
more than one root for thef x equation
0 may exist
between the two points.
5 http://numericalmethods.eng.usf.edu
Algorithm for Bisection
Method
6 http://numericalmethods.eng.usf.edu
Step 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. This was demonstrated in
Figure 1. f(x)
x
x
xu
Figure 1
7 http://numericalmethods.eng.usf.edu
Step 2
Estimate the root, xm of the equation f (x) = 0 as
the mid point between xl and xu as
f(x)
x xu
xm =
2
x xm
x
xu
Figure 5 Estimate of xm
8 http://numericalmethods.eng.usf.edu
Step 3
Now check the following
9 http://numericalmethods.eng.usf.edu
Step 4
Find the new estimate of the root
x xu
xm =
2
Find the absolute relative approximate error
x new x old
m
a m
new
100
x m
where
xmold previous estimate of root
xmnew current estimate of root
10 http://numericalmethods.eng.usf.edu
Step 5
Compare the absolute relative approximate error
a
with the pre-specified errortolerance
s .
Go to Step 2 using
Yes new upper and lower
Is a s ? guesses.
13 http://numericalmethods.eng.usf.edu
Example 1 Cont.
From the physics of the problem, the ball would be
submerged between x = 0 and x = 2R,
where R = radius of the ball,
that is
0 x 2 R
0 x 20.055
0 x 0.11
14 http://numericalmethods.eng.usf.edu
Example 1 Cont.
Solution
To aid in the
understanding of how
this method works to find
the root of an equation,
the graph of f(x) is shown
to the right,
fwhere
x x 3 0.165 x 2 3.993 10- 4
Hence
f xl f xu f 0 f 0.11 3.993 10 4 2.662 10 4 0
f xl f xm f 0 f 0.055 3.993 10 4 6.655 10 5 0
a
At this point, the absolute relative approximate error
cannot be calculated as we do not have a previous
approximation.
18 http://numericalmethods.eng.usf.edu
Example 1 Cont.
20 http://numericalmethods.eng.usf.edu
Example 1 Cont.
22 http://numericalmethods.eng.usf.edu
Example 1 Cont.
Iteration 3 x xu 0.055 0.0825
The estimate of the root xism 0.06875
2 2
f xm f 0.06875 0.06875 0.1650.06875 3.993 10 4 5.563 10 5
3 2
23 http://numericalmethods.eng.usf.edu
Example 1 Cont.
26 http://numericalmethods.eng.usf.edu
27 http://numericalmethods.eng.usf.edu
28 http://numericalmethods.eng.usf.edu
29 http://numericalmethods.eng.usf.edu
30 http://numericalmethods.eng.usf.edu
Table 1 Cont.
Hence the number of significant digits at least correct is given
by the largest value or m for which
a 0.5 10 2 m
0.1721 0.5 10 2 m
0.3442 10 2 m
log0.3442 2 m
m 2 log0.3442 2.463
So
m 2
The number of significant digits at least correct in the
estimated root of 0.06241 at the end of the 10th iteration is
2.
31 http://numericalmethods.eng.usf.edu
Advantages
Always convergent
The root bracket gets halved with
each iteration - guaranteed.
32 http://numericalmethods.eng.usf.edu
Drawbacks
Slow convergence
If one of the initial guesses is close
to the root, the convergence is
slower
33 http://numericalmethods.eng.usf.edu
Drawbacks (continued)
If a function f(x) is such that it just
touches the x-axis it will be unable
to find the lower and upper guesses.
f(x)
f x x 2
34 http://numericalmethods.eng.usf.edu
Drawbacks (continued)
Function changes sign but root does
not exist
1
f(x)
f x
x
x
35 http://numericalmethods.eng.usf.edu
Example 2
2. Find the root of f(x) = x2-3. Let the
accuracy/error of 0.002/0.2% and start
with the interval of [1,2].
f(a)=(1)2 – 3 = -2
f(b)=22 – 3 = 1
f(a).f(b)=(-2)(1) <0
Therefore, the root is lie between the
given interval.
36 http://numericalmethods.eng.usf.edu
1st iterartion:
c=(1+2)/2 =1.5
f(c)=1.52 – 3 = -0.75
f(a).f(c)=(-2)(-0.75) = 1.5>0
New int. [1.5,2]
2nd iteration:
c=(1.5+2)/2 = 1.75
f(c)=1.752 – 3 =0.0625
f(a).f(c)=(-0.75)(0.0625) = -0.0468<0
37
New int. [1.5,1.75] http://numericalmethods.eng.usf.edu
e=(cnew – cold)/cnew x100
e = (1.75-1.5)/1.75 x100=14.29%
3rd iteration:
c=(1.5+1.75)/2 = 1.625
f(c)=1.6252 – 3 =-0.3594
f(a)f(c)= (-0.75)(-0.3594) = 0.2695>0
NEW INT.[1.625,1.75]
e=(1.625-1.75)/1.625 x 100 = 7.69%
38 http://numericalmethods.eng.usf.edu
4th iteration:
c=(1.625+1.75)/2 =1.6875
f(c)=1.68752 – 3 = -0.1523
f(a)f(c)=(-0.3594)(-0.1523)=0.0547>0
New int.[1.6875,1.75]
e=(1.6875-1.625)/1.6875 x
100=3.704%
5th iteration:
c=(1.6875+1.75)/2 = 1.71875
f(c)=1.718752 – 3 =-0.0459
39 http://numericalmethods.eng.usf.edu
f(a)f(c) =(-0.1523)(-0.0459)=0.00699>0
New int.[1.71875, 1.75]
e=(1.71875-1.6875)/1.71875 x100 =
1.82%
6th iteration:
c=(1.71875+1.75)/2 = 1.7344
f(c)=1.73442 – 3 =0.0081
f(a)f(c)=(-0.0459)(0.0081)=-0.00037 <0
New int.[1.71875,1.7344]
e=(1.7344-1.71875)/1.7344
40 http://numericalmethods.eng.usf.edu
7th iteration:
c=(1.71875+1.7344)/2 = 1.7266
f(c) = 1.72662-3=-0.01894
f(a)f(c)=(-0.0459)(-
0.01894)=0.00087>0
New int.[1.7266,1.7344]
e=(1.7266-1.71875)/1.7266
x100=0.455%
8th iteration:
c=(1.7266+1.7344)/2 = 1.7305
41 2 http://numericalmethods.eng.usf.edu
f(a)f(c)=(-0.01894)(-0.00537) =
1.017x10-4>0
New int. [1.7305,1.7344
e=(1.7305-1.7266)/1.7305 x100 =
0.2254%
9th iteration:
c=(1.7305+1.7344)/2 = 1.73245
f(c) = 0.001383
f(a)f(c)=-0.00537(0.001383) =-
42 0.00023<0 http://numericalmethods.eng.usf.edu
e=l(1.73245-1.7305)l/1.73245 x 100
=0.1126%
ABSOLUTE ERROR<PRESCRIBED
ERROR
43 http://numericalmethods.eng.usf.edu
THE END
Exercise 1
1. Find the root of
f(x)=e-x(3.2sinx – 0.5 cosx) on the
interval [3,4] and absolute error
must be less than 0.1%.