Professional Documents
Culture Documents
Chapter 2
Graphical &
Bisection
Method
At the end of this chapter, students should be able to:
Describe root finding
Use graphical method to solve non-linear equations
Describe and derive the Bisection method of finding roots
Apply the Bisection method to reduce initial interval of uncertainty so as to attain
improved root estimates
2.1 Introduction
Chapter 2 shall discuss one of the most basic problems in numerical analysis,
that is solving non-linear equations also known as root finding. The problem
involves solving an equation of the form f ( x ) 0 . An equation of this form can be
either linear or non-linear. A solution to the equation (also called a root of the
equation or a zero of f) is a numerical value of x that satisfies the given equation.
The equation may also have several possible roots or have no solution at all. In
this chapter, the focus of the discussion will be on solving non-linear equations in
one variable.
13
SOLVING NONLINEAR EQUATIONS Part 2
Definition
Given an equation f ( x ) 0 , the function f (x ) is non-linear if it is not of the
form ax b .
Ex. f ( x ) tan x x , or f ( x ) e x 3 ln 2x
14
SOLVING NONLINEAR EQUATIONS Part 2
y = f(x)
y y
y = h(x) y = g(x)
0 0
x x
root root
(a) (b)
Figure 2.1
If a function f (x ) is continuous on the interval (a, b) and if f (a) and f (b) have
different signs (one positive and one negative) or f (a) f (b) 0 , then there exist
at least one real root in the interval (a, b).
y y
f(b) f(b)
0 0 a b x
a b x
f(a)
f(a)
root No root
f(a)
15
SOLVING NONLINEAR EQUATIONS Part 2
Take a note that the statement demands that the function f (x ) be continuous on
the given interval. Figure 2.2 illustrates two possible instances that may occur if
f (a) f (b) 0 . Figure 2.2(b) shows that f (a) f (b) 0 even though f (x ) is not
continuous (there exists no root between the values a and b).
Example 1
Show analytically that f ( x ) x 3 has at least one root in the interval [-1, 2].
Solution
Since f ( 1) f (2) 0 it can be concluded that there exists at least a root in the
interval [-1, 2].
Example 2
16
SOLVING NONLINEAR EQUATIONS Part 2
Solution
h( x ) x 3 x 1 h(2) 5 h(1) 1
Determine if h(a) h(b) 0
h(2) h(1) (5)(1) 5 0
Hence, there exists at least a root or one zero of h(x ) in the interval [-2, 1].
Warm up exercise
Determine the existence of a root for the following functions within the given
interval.
(i) f ( x) x 3 6x 16 ; [1, 2]
3
(ii) f ( x) cos x cos 3x ; 4, 4
17
SOLVING NONLINEAR EQUATIONS Part 2
18
SOLVING NONLINEAR EQUATIONS Part 2
Example 3
Use the graphical method to determine the interval which contains the real root
of f ( x ) e x x 2 .
Solution
f (x) ex x 2 ex x 2 0
In order to determine the interval of the root, let’s plot the graph. There
are two options to do this.
19
SOLVING NONLINEAR EQUATIONS Part 2
Based on Figure 2.3 it can be shown that there exists a root in [0, 1]. From the
illustrations, we can further conclude that the root of f is roughly close to the
value 0.5. This value is a rough approximation of the root.
Example 4
Solution
f(x) x 2 - x - 6
Tabulate the values of x versus f (x ) in (a, b).
Chose a suitable step-size.
x -4 -3 -2 -1 0 1 2 3 4 5
f(x) 14 6 0 -4 -6 -6 -4 0 6 14
20
SOLVING NONLINEAR EQUATIONS Part 2
y
20
15 y=f(x)
10
0 x
-5 -4 -3 -2 -1 0 1 2 3 4 5 6
-5
r1 r2
-10
Figure 2.4
Example 5
x
Graphically show that equation sinx - 0 has a solution between x 1 and
2
x 2.
Solution
x
sinx - 0
2
Break the equation into two parts or two functions h(x ) and g(x ) .
x
sinx
2
h(x) g(x)
where
x
h(x) sinx g(x)
2
Tabulate the values of x versus h(x ) and g(x )
Plot the graphs h(x ) and g(x ) using the tabulated values.
21
SOLVING NONLINEAR EQUATIONS Part 2
y
1.2
0.8
h(x)=sin x
0.6
x
0.4 g(x)
2
0.2
0 x
0 0.5 1 1.5 2 2.5
r
Figure 2.5
x
Figure 2.5 illustrates the graphs h( x ) sin x and g ( x ) being
2
plotted on the same axis and it can be observed that there is one
intersection point at x r which is close to 2. Therefore, it can be
concluded that there exists at least a root r such that r [1, 2] .
22
SOLVING NONLINEAR EQUATIONS Part 2
In the next section we are going to discuss three numerical methods of solving
non-linear equations or root finding:
(i) Bisection method
(ii) Newton’s method
(iii) Secant method
The numerical procedure for all the three methods is iterative in nature, or the
same process is repeated until a good approximation of the root is obtained.
Functional evaluation of f(x) at an improved estimation of the root should obtain a
value that is very near to the value zero.
r1 r2 r3
f(b)
x
a
0 b
f(a)
Figure 2.6
continuous on the interval (a, b) such that f (a) f (b) 0 . Hence, there exists at
least one value r in the interval (a, b) in which f (r ) 0 (r is the root). The
interval is then halved or divided into two subintervals by the midpoint of a and b.
Checking is done to locate in which of the two smaller subintervals the root is
23
SOLVING NONLINEAR EQUATIONS Part 2
Example 6
Show that f ( x ) x 3 has a root in the interval [-1, 2]. Apply Bisection method
with 3 iterations to reduce the interval of the root.
Solution
Identify the existence of a root
[-1, 2] a = -1 and b=2
ab
Compute c
2
1 2
c 0 .5 and f (0.5) 0.125
2
Determine
f (1) f (0.5) (1)(0.125) 0
24
SOLVING NONLINEAR EQUATIONS Part 2
i xi f ( xi ) xi 3 [ai , bi ] ci
0 -1 -1.0000
1 2 8.0000 [-1, 2] 0.5
2 0.5 0.1250 [-1, 0.5] -0.25
3 -0.25 -0.0156 [-0.25, 0.5] 0.125
Example 7
Solution
h( x ) x 3 x 1 h(2) 5 h(1) 1
h(2) f (1) (5)(1) 5 0
ab
Compute c
2
2 1
c 0.5 and h(0.5) 1.375
2
Determine :
h(2) f (0.5) (5)(1.375) 0
i xi h( x i ) x i 3 x i 1 [ai , bi ] ci
0 -2 -5.000
1 1 1.000 [-2, 1] -0.5
2 -0.5 1.375 [-2, -0.5] -1.250
3 -1.250 0.297 [-2, -1.25] -1.625
4 -1.625 -1.666 [-1.625, -1.25] -1.438
5 -1.438 -0.533 [-1.438, -1.25] -1.344
6 -1.344 -0.083 [-1.344, -1.25] -1.297
25
SOLVING NONLINEAR EQUATIONS Part 2
Example 8
Solution
i xi f ( x) e x x 2 [ai , bi ] ci
0 0.0000 -1.0000
1 1.0000 1.7183 [0, 1] 0.5000
2 0.5000 0.1487 [0, 0.5] 0.2500
3 0.2500 -0.4660 [0.250, 0.5] 0.3750
4 0.3750 -0.1700 [0.375, 0.5] 0.4375
5 0.4375 -0.0137 [0.4375, 0.5000] 0.4688
6 0.4688 0.0667 [0.4375, 0.4688] 0.4531
7 0.4531 0.0263 [0.4375, 0.4531] 0.4453
8 0.4453 0.0063 [0.4375, 0.4453] 0.4414
9 0.4414 -0.0037 [0.4414, 0.4453] 0.4434
10 0.4434 0.0013 [0.4414, 0.4434] 0.4424
11 0.4424 -0.0012 [0.4424, 0.4434] 0.4429
12 0.4429 0.0000 [0.4424, 0.4429] 0.4426
26
SOLVING NONLINEAR EQUATIONS Part 2
Warm up exercise
Let f ( x ) x 3 x 1 in [1, 2].
(i) Identify the existence of a root.
ab
(ii) Compute c and f(c).
2
(iii) Compute
(a) f(1).f(c)
(b) f(2).f(c)
(iv) Determine where the root lies.
(v) Find the root accurate to 2 significant digits.
Theorem
Let f a, b and suppose f(a).f(b) < 0. The Bisection method generates a
sequence c approximating r such that
E cr
ba
2n
If an error tolerance has been prescribed in advance, it is possible to determine
the number of iterations required in the Bisection method. Suppose it is required
that r - cn E . Then it is necessary to solve the following inequality for n.
27
SOLVING NONLINEAR EQUATIONS Part 2
Example 9
Determine approximately how many iterations are necessary to solve
f(x) x 3 4x 2 - 10 with 10-5 accuracy where a 1 and b 2 .
Solution
Identify the interval
[1, 2] a 1 and b 2
Identify the error
E 10 -5
Solve for n
ba
E
2n
E 10 5
2 1
n
10 5
2
1
2n 5
10
2 10 5
n
n log 2 log10 5
5
n
log 2
16.61
28
SOLVING NONLINEAR EQUATIONS Part 2
Example 10
Find a maximum bound for the number of iterations needed to achieve an
approximation with 10-4 accuracy to the solution x 3 - x - 1 0 , lying on
the interval [1, 2].
Solution
e 10 4
2 1
10 4
2n
2 n 10 4
n log 2 log10 4
n log 2 4
4
n
log 2
13.29
Hence, at least 14 iterations are required to achieve the desired accuracy.
Note that the accuracy of Bisection method is only dependent on its interval
and not the function.
Warm up exercise
Approximate the root of f ( x ) x 3 x 1 in [1, 2] accurate to 2 decimal
places.
(i) Identify the interval which contains the root.
(ii) Calculate the error using the error formula of the Bisection method.
(iii) Determine the required iterations.
29
SOLVING NONLINEAR EQUATIONS Part 2
Exercise 2
1. Given x 3 6x 16 0 .
a) show that there exists one real root in the interval (1, 2)
b) plot the graph and hence show and estimate the root.
2. Apply the Bisection method to the equation sin x 0.75 0 in the interval
[0.8, 0.9] and try to determine the root with three correct decimals.
3. Using the Bisection method determine the first four approximations of the actual
1
root of the equation x 3 0 in the interval [0, 1].
2
5. Show that x 3 x 2 0 has a root between 1 and 2. Use the Bisection method
to approximate the root accurate to two decimal places.
6. Using the Bisection method, solve x ln x 3 , given that the root is close to 2.
Obtain the root correct to two decimal places.
30