Chapter Two
Chapter Two
CHAPTER TWO
Introduction
A frequently occurring problem is to find the roots of equations of the form 𝑓(𝑥) = 0.
Bisection method
Secant method
Regula Falsi method
Newton-Raphson Method
Fixed point Iteration method
Examples:
1. x 3 2x 0 is an algebraic equation
2. tan( x) cos( x) 0 and e x 4 x are transcendental equations.
Numerical (or iterative) methods require one or more initial approximations to the exact
root of the equation f ( x) 0 and generate a sequence of approximations
x0 , x1 , x2 , x3 ,, xn ,
1
Stopping Criteria
(i) f ( xn )
(ii) xn1 xn
xn1 xn
(iii)
xn1
1. Bisection method
The method is based on the intermediate value theorem. If f (x) is continuous on the
interval [a, b] and f (a) f (b) 0 , then there exist at least one root in (a, b) .
a1 b1
Let a1 a , b1 b and let x1 .
2
f (a) f (b) ).
a2 b2
Again let x2 .
2
2
Let [a3 , b3 ] be the new interval that contains the root.
We repeat this process until the latest interval (which contains the root) is as small as
desired.
Remark: 1. At the end of the nth step, the bisection method gives an approximation xn
ba
with an absolute error of at most .
2n
Example 1: Perform five iterations of the Bisection Method to approximate the root [1,
2] of the equation x 3 x 1 0 .
1 2 15
Let x1 1.5 and f (1.5) 0
2 8
1 1 .5 19
x2 1.25 and f (1.25) 0
2 64
1.25 1.5
x3 1.375 and f (1.375) 0
2
1.25 1.375
x4 1.3125 and f (1.3125) 0
2
3
root lies between 1.3125&1.375
1.3125 1.375
x5 1.34375 and f (1.34375) 0
2
ba 2 1 1
Solution: n
n
10 5 n
10 5
2 2 2
2 n 10 5
5
n log 2 log 10
10 5
5
n 2
16.6
log 10
Exercise: Using the Bisection method, find a real root of the equation xe x 1 which lies
between 0 and 1 (compute five iterations).
2. Secant Method
The method uses two points in the neighborhood of the solution to determine a new
estimate for the solution.
4
The two points (say x0 and x1) are used to define a straight line (Secant), and the point
where the line intersects the x-axis (say x2) is the new estimate for the solution.
f ( x0 ) f ( x1 ) f ( x1 ) f ( x 2 ) f ( x0 ) f ( x1 ) f ( x1 ) 0
x0 x1 x1 x 2 x0 x1 x1 x 2
( x1 x0 )
x 2 x1 f ( x1 )
f ( x1 ) f ( x0 )
( x 2 x1 )
x3 x 2 f ( x2 )
f ( x 2 ) f ( x1 )
( x n x n 1 )
In general, x n 1 x n f ( x n ) for n=1, 2,3,4,. . .
f ( x n ) f ( x n 1 )
5
Example: Starting with x0 0 and x1 1 , perform four iterations of the Secant method
to determine the root of cosx − xex = 0( Make your calculations in four decimal places)
(𝑥1 − 𝑥0 ) (1 − 0)
𝑥2 = 𝑥1 − 𝑓(𝑥1 ) = 1 − 𝑓(1)
𝑓(𝑥1 ) − 𝑓(𝑥0 ) 𝑓(1) − 𝑓(0)
(1 − 0)
=1− (−2.1780) = 0.31466 ≈ 0.3147
−2.1780 − 1
Hence
(𝑥2 − 𝑥1 ) (0.3147 − 1)
𝑥3 = 𝑥2 − 𝑓(𝑥2 ) = 0.3147 − 𝑓(0.3147)
𝑓(𝑥2 ) − 𝑓(𝑥1 ) 𝑓(0.3147) − 𝑓(1)
(0.3147 − 1)
= 0.3147 − (0.5198) = 0.4467
0.5198 − (−2.1780)
6
Exercise: Compute the fifth and sixth iteration
Exercise: Determine the root of 𝑓(𝑥) = 𝑥 3 − 𝑒 −0.5𝑥 by using Secant method. Start with
𝑥1 = 0 and𝑥2 = 1, carry out the first five iterations by rounding to six decimal places.
Remark: In secant method, no attempt is made to ensure that the root is enclosed
between x n 1 and xn . If at each step we choose the interval which contains the root (by
IVT) to determine a root of the equation, the method is called Regula -Falsi method
(method of False position).
Example: Approximate the root on [0, 1] of the equation x3 – 3x+ 1 = 0 correct to three
decimal places, using the method of false position.
Since, f(0) f(0.5) < 0, the root lies in the interval (0, 0.5).
Since, f(0) f(0.36364) < 0, the root lies in the interval (0, 0.36364).
Since, f(0) f(0.3487) < 0, the root lies in the interval (0, 0.34870).
Since, f(0) f(0.34741) < 0, the root lies in the interval (0, 0.34741).
x6= 0.347306.
7
The root has been computed correct to three decimal places. The required root can be
taken as x 0.347 .
Note that the left end point x = 0 is fixed for all iterations.
Exercise: Approximate the root on [1, 2] of the equation x3 – 3x+ 1 = 0 correct to three
decimal places, using the method of false position.
3. Newton-Raphson Method
⟹ f(𝑥1 ) = f(x0 + ℎ) = 0
ℎ2 ′′ ℎ3
0 = 𝑓(𝑥0 ) + ℎ𝑓 ′ (𝑥0 ) + 𝑓 (𝑥0 ) + 𝑓 ′′′ (𝑥0 ) + . . .
2! 3!
𝑓(𝑥0 ) + ℎ𝑓 ′ (𝑥0 ) = 0
𝑓(𝑥0 )
⟹h=−
𝑓 ′ (𝑥0 )
𝑥1 = 𝑥0 + ℎ
𝑓(𝑥0 )
⟹ 𝑥1 = 𝑥0 −
𝑓 ′ (𝑥0 )
𝑓(𝑥1 )
⟹ 𝑥2 = 𝑥1 −
𝑓 ′ (𝑥1 )
𝑓(𝑥 ) 𝑓(𝑥 )
⟹ 𝑥3 = 𝑥2 − 𝑓′ (𝑥2 ) ⟹ 𝑥4 = 𝑥3 − 𝑓′ (𝑥3 ) etc
2 3
8
In general,
𝑓(𝑥 )
⟹ 𝑥𝑛+1 = 𝑥𝑛 − 𝑓′ (𝑥𝑛 ) for n=0, 1, 2, 3 , . . .
𝑛
𝑓(𝑥 ) 3 −2𝑥 −5
𝑥𝑛
⟹ 𝑥𝑛+1 = 𝑥𝑛 − 𝑓′ (𝑥𝑛 ) = 𝑥𝑛 − 𝑛
2 −2 for n=0,1,2,3, …….
𝑛 3𝑥𝑛
Hence
23 − 2(2) − 5 −1
= 2− = 2 − = 2.1000000
3(22 ) − 2 10
2.1000003 − 2(2.1000000) − 5
= 2.1000000 − = 2.0945681211042 ≈ 2.0945681
3𝑥2.1000002 − 2
Since|𝑥4 − 𝑥3 |0.000000 ≤ 0.5𝑥10−6 , the desired root is x=2.094552 correct to six decimal
places.
9
Exercise: Find the root of 𝑥 = 𝑒 −𝑥 using Newton-Raphson method correct to 3 decimal
places (Take𝑥0 = 1).
To describe this method for finding the roots of f ( x) 0 , we first rewrite this equation
in the form x (x) .
1
x (1 x) 2
( x)
1
x (1 x 3 ) 2 ( x)
1
x (1 x ) ( x)
2 3
Let x0 be the approximate value of the desired root . Successive approximations are
then given by
x1 ( x0 ) , x2 ( x1 ) , x3 ( x2 ) , x4 ( x3 ) ,…, x n ( x n 1 )
some number .
Example: consider x 10 x 1 ( x)
If we take x0 0 ,then
10
Condition for convergence
approximation x0 is chosen in I.
Proof: is a root of f ( x) 0
is a root of x (x)
( )
xn ( xn1 ) ( )
( x n 1 ) ( )
and by Mean Value Theorem , ' ( ) where xn 1
x n 1
( x n 1 ) ( ) ( x n 1 ) ' ( )
x n ( x n 1 ) ( )
'
xn k xn1
In general xn k n x0
11
as n , k n x0 0 ,(since 0<k<1)
xn 0 as n
lim xn 0
n
root if k<1
i.e. ' ( x) 1
if k > 1 xn as n
Solution: f ( x) x 3 x 2 1 0
x3 x 2 1 0
x 2 ( x 1) 1
1
x
x 1
1
let x ( x)
x 1
1 1 1
' ( x)
2 (1 x) 3 2 (1 x) 3
1 1
' ( x) 1 x [0,1]
2 (1 x) 3 2
12
Thus the iteration method can be applied
1
Hence x1 ( x0 ) 0.7559
0.75 1
1
x2 ( x1 ) 0.7547
0.7559 1
1
x3 ( x 2 ) 0.7549
0.7547 1
Example 2: Find the root of the equation cos x 3 x 1 correct to three decimal places on
[0, ] using iteration method.
2
Here f (0) 2 0
f ( 2 ) 3 2 1 0
Root lies between 0 and by IVT.
2
sin x 1
( x) ' ' ( x) 1
3 3
1
' ( x) 1x [0, ]
3 2
13
Hence we can use iteration method
Hence
1
x1 ( x 0 ) (1 cos 0) 0.6667
3
1
x2 ( x1 ) (1 cos 0.6667) 0.5953
3
1
x3 ( x 2 ) (1 cos 0.5953) 0.6093
3
1
x 4 ( x3 ) (1 cos 0.6093) 0.6067
3
1
x5 ( x 4 ) (1 cos 0.6067) 0.6072
3
1
x 6 ( x5 ) (1 cos 0.6072) 0.6071
3
Thus the correct root of the equation is 0.607 correct to three decimal places.
Exercise: Using fixed point iteration compute three iterations to find a real root of the
equation 𝑠𝑖𝑛𝑥 + 5𝑥 + 2 = 0 (take𝑥0 = 0).
14