You are on page 1of 9

Chapter 03.

03 Bisection Method of Solving a Nonlinear Equation

After reading this chapter, you should be able to: 1. follow the algorithm of the bisection method of solving a nonlinear equation, 2. use the bisection method to solve examples of finding roots of a nonlinear equation, and 3. enumerate the advantages and disadvantages of the bisection method.

What is the bisection method and what is it based on? 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 n equation f ( x ) = 0 ! where f ( x ) is a real continuous function! has at least one root between x and xu if f ( x ) f ( xu ) < 0 ("ee #igure 1). $ote that if f ( x ) f ( xu ) > 0 ! there ma% or ma% not be an% root between x and xu (#igures 2 and 3). &f f ( x ) f ( xu ) < 0 ! then there ma% be more than one root between x and xu (#igure '). "o the theorem onl% guarantees one root between x and xu . Bisection method "ince the method is based on finding the root between two points! the method falls under the categor% of brac(eting methods. "ince the root is brac(eted between two points! x and xu ! one can find the mid) point! x m between x and xu . This gives us two new intervals 1. x and x m ! and 2. x m and xu .

03.03.1

03.03.2

*hapter 03.03

f (x)

xu

Figure 1 t least one root e+ists between the two points if the function is real! continuous! and changes sign.

f (x)

xu

Figure 2 &f the function f ( x ) does not change sign between the two points! roots of the equation f ( x ) = 0 ma% still e+ist between the two points.

,isection -ethod

03.03.3

f (x)

f (x )

xu

x xu

Figure 3 &f the function f ( x ) does not change sign between two points! there ma% not be an% roots for the equation f ( x ) = 0 between the two points.

f (x)

xu

Figure 4 &f the function f ( x ) changes sign between the two points! more than one root for the equation f ( x ) = 0 ma% e+ist between the two points. &s the root now between x and x m or between x m and xu . /ell! one can find the sign of f ( x ) f ( x m ) ! and if f ( x ) f ( x m ) < 0 then the new brac(et is between x and x m ! otherwise! it is between x m and xu . "o! %ou can see that %ou are literall% halving the interval. s one repeats this process! the width of the interval [ x ! xu ] becomes smaller and smaller! and %ou can 0ero in to the root of the equation f ( x ) = 0 . The algorithm for the bisection method is given as follows.

03.03.' Algorithm for the bisection method

*hapter 03.03

The steps to appl% the bisection method to find the root of the equation f ( x ) = 0 are 1. *hoose x and xu as two guesses for the root such that f ( x ) f ( xu ) < 0 ! or in other words! f ( x ) changes sign between x and xu . 2. 1stimate the root! x m ! of the equation f ( x ) = 0 as the mid)point between x and xu as x + xu xm 2 2 3. $ow chec( the following a) &f f ( x ) f ( x m ) < 0 ! then the root lies between x and x m 3 then x = x and xu = x m . b) &f f ( x ) f ( x m ) > 0 ! then the root lies between x m and xu 3 then x = x m and xu = xu . c) &f f ( x ) f ( x m ) = 0 3 then the root is x m . "top the algorithm if this is true. '. #ind the new estimate of the root x + xu xm 2 2 #ind the absolute relative appro+imate error as new old xm ) xm 2 100 a new xm where new xm 2 estimated root from present iteration old xm 2 estimated root from previous iteration 4. *ompare the absolute relative appro+imate error with the pre)specified relative a > error tolerance s . &f a s ! then go to "tep 3! else stop the algorithm. $ote one should also chec( whether the number of iterations is more than the ma+imum number of iterations allowed. &f so! one needs to terminate the algorithm and notif% the user about it. Exam le 1 5ou are wor(ing for 67O/$ T81 TO&91T *O-: $5; that ma(es floats for ,* commodes. The floating ball has a specific gravit% of 0.< and has a radius of 4.4 cm. 5ou are as(ed to find the depth to which the ball is submerged when floating in water. The equation that gives the depth x to which the ball is submerged under water is given b% >se the bisection method of finding roots of equations to find the depth x to which the ball is submerged under water. *onduct three iterations to estimate the root of the above equation. #ind the absolute relative appro+imate error at the end of each iteration! and the number of significant digits at least correct at the end of each iteration.
x 3 0.1<4 x 2 + 3.==3 10 ' = 0

,isection -ethod !olution

03.03.4

#rom the ph%sics of the problem! the ball would be submerged between x = 0 and x = 2 R ! where
R = radius of the ball!

that is

0 x 2R 0 x 2(0.044) 0 x 0.11

Figure " #loating ball problem. 9ets us assume


x = 0! xu = 0.11

*hec( if the function changes sign between x and xu .


f ( x ) = f (0) = (0) 3 0.1<4(0) 2 + 3.==3 10 ' = 3.==3 10 ' f ( xu ) = f (0.11) = (0.11) 3 0.1<4(0.11) 2 + 3.==3 10 ' = 2.<<2 10 '

8ence
f ( x ) f ( xu ) = f (0) f (0.11) = (3.==3 10 ' )(2.<<2 10 ' ) < 0 "o there is at least one root between x and xu ! that is between 0 and 0.11.

&teration 1 The estimate of the root is x +x xm = u 2


= 0 + 0.11 2 = 0.044

f ( x m ) = f ( 0.044) = ( 0.044) 0.1<4( 0.044) + 3.==3 10 ' = <.<44 10 4


3 2

f ( x ) f ( xm ) = f (0) f (0.044) = (3.==3 10 ' )( <.<44 10 ' ) > 0

8ence the root is brac(eted between x m and xu ! that is! between 0.044 and 0.11. "o! the lower and upper limit of the new brac(et is
x = 0.044! xu = 0.11

03.03.< t this point! the absolute relative appro+imate error have a previous appro+imation. &teration 2 The estimate of the root is x +x xm = u 2
=
a

*hapter 03.03 cannot be calculated as we do not

f ( x ) f ( x m ) = f ( 0.044) f ( 0.0?24) = <.<44 10 4 1.<22 10 ' < 0 8ence! the root is brac(eted between x and x m ! that is! between 0.044 and 0.0?24. "o the lower and upper limit of the new brac(et is
x = 0.044! xu = 0.0?24

0.044 + 0.11 2 = 0.0?24 f ( xm ) = f (0.0?24) = (0.0?24) 3 0.1<4(0.0?24) 2 + 3.==3 10 ' = 1.<22 10 '

) (

The absolute relative appro+imate error new old xm xm a = 100 new xm


= 0.0?24 0.044 100 0.0?24

at the end of &teration 2 is

$one of the significant digits are at least correct in the estimated root of x m = 0.0?24 because the absolute relative appro+imate error is greater than 4@. &teration 3 x +x xm = u 2
=

= 33.33@

0.044 + 0.0?24 2 = 0.0<?A4 f ( xm ) = f (0.0<?A4) = (0.0<?A4) 3 0.1<4(0.0<?A4) 2 + 3.==3 10 ' = 4.4<3 10 4

f ( x ) f ( xm ) = f (0.044) f (0.0<?A4) = (<.<44 104 ) ( 4.4<3 10 4 ) < 0

8ence! the root is brac(eted between x and x m ! that is! between 0.044 and 0.0<?A4. "o the lower and upper limit of the new brac(et is
x = 0.044! xu = 0.0<?A4

The absolute relative appro+imate error x new x old a = m new m 100 xm


= 0.0<?A4 0.0?24 100 0.0<?A4

at the ends of &teration 3 is

"till none of the significant digits are at least correct in the estimated root of the equation as the absolute relative appro+imate error is greater than 4@. "even more iterations were conducted and these iterations are shown in Table 1.

= 20@

,isection -ethod

03.03.A

Table 1 Boot of f ( x ) = 0 as function of number of iterations for bisection method. &teratio xu xm f (xm ) x a @ n 0.0000 ))))))))) 1 0.11 0.044 0 ) <.<44 104 2 0.044 0.11 0.0?24 33.33 1.<22 10 ' 0.0<?A 3 0.044 0.0?24 20.00 4.4<3 10 4 4 0.0<?A 0.0<1? ' 0.044 11.11 4 ? '.'?' 10< 0.0<1? 0.0<?A 0.0<43 4 4.2<3 2.4=3 10 4 ? 4 1 0.0<1? 0.0<43 0.0<34 < 2.A02 1.0?0' 10 4 ? 1 = 0.0<1? 0.0<34 0.0<2A A 1.3A0 3.1A< 10< ? = 3 0.0<1? 0.0<2A ? 0.0<23 0.<?=A ? 3 <.'=A 10A 0.0<2A 0.0<24 = 0.0<23 0.3'3< 1.2<4 10 < 3 2 0.0<24 0.0<2' 10 0.0<23 0.1A21 3.0A<? 10 A 2 1 t the end of 10th iteration!
a = 0.1A21@

8ence the number of significant digits at least correct is given b% the largest value of which
10 2 m a 0 .4

m for

0.1A21 0.4 10 2 m 0.3''2 10 2 m log(0.3''2) 2 m m 2 log(0.3''2) = 2.'<3

"o

m=2 The number of significant digits at least correct in the estimated root of 0.0<2'1 at the end of the 10 th iteration is 2.

Ad#antages of bisection method a) The bisection method is alwa%s convergent. "ince the method brac(ets the root! the method is guaranteed to converge. b) s iterations are conducted! the interval gets halved. "o one can guarantee the error in the solution of the equation.

03.03.? $rawbac%s of bisection method

*hapter 03.03

a) The convergence of the bisection method is slow as it is simpl% based on halving the interval. b) &f one of the initial guesses is closer to the root! it will ta(e larger number of iterations to reach the root. c) &f a function f ( x ) is such that it Cust touches the x )a+is (#igure <) such as
f ( x) = x 2 = 0

it will be unable to find the lower guess! x ! and upper guess! xu ! such that
f ( x ) f ( xu ) < 0 d) #or functions f ( x ) where there is a singularit% 1 and it reverses sign at the

singularit%! the bisection method ma% converge on the singularit% (#igure A). e+ample includes
1 x x = 2 ! xu = 3 are valid initial guesses which satisf% where f ( x ) f ( xu ) < 0 f ( x) =

8owever! the function is not continuous and the theorem that a root e+ists is also not applicable. f (x)

x Figure & The equation f ( x) = x 2 = 0 has a single root at x = 0 that cannot be brac(eted.

singularit% in a function is defined as a point where the function becomes infinite. #or e+ample! for a function such as 1 D x ! the point of singularit% is x = 0 as it becomes infinite.

,isection -ethod

03.03.=

f (x )

Figure ' The equation f ( x ) =

1 = 0 has no root but changes sign. x

$O$9&$1 B 1E> T&O$" Topic ,isection method of solving a nonlinear equation "ummar% These are te+tboo( notes of bisection method of finding roots of nonlinear equation! including convergence and pitfalls. -aCor Feneral 1ngineering uthors utar Gaw 7ate Hanuar% 30! 201' /eb "ite httpIDDnumericalmethods.eng.usf.edu

You might also like