0% found this document useful (0 votes)
75 views

Chapter Two

The document discusses numerical methods for finding roots of non-linear equations. It introduces methods such as bisection, secant, regula falsi, and Newton-Raphson. For each method, it provides examples of calculating roots of sample equations. The bisection method converges slowly but always finds the root, while methods like secant and Newton-Raphson converge faster but may not bracket the root. The document also discusses stopping criteria for iterative root-finding methods.

Uploaded by

Hanan Shayibo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

Chapter Two

The document discusses numerical methods for finding roots of non-linear equations. It introduces methods such as bisection, secant, regula falsi, and Newton-Raphson. For each method, it provides examples of calculating roots of sample equations. The bisection method converges slowly but always finds the root, while methods like secant and Newton-Raphson converge faster but may not bracket the root. The document also discusses stopping criteria for iterative root-finding methods.

Uploaded by

Hanan Shayibo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

NUMERICAL METHODS

CHAPTER TWO

ROOTS OF NON-LINEAR EQUATIONS

Introduction

A frequently occurring problem is to find the roots of equations of the form 𝑓(𝑥) = 0.

When f (x) is a polynomial of higher degree or a transcendental function ( i.e. f (x)

involves exponential, logarithmic or trigonometric functions), direct methods may not


be available. Hence we use numerical methods to approximate the roots of the equation
𝑓(𝑥) = 0.

Some of these Numerical methods are:

 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 ,

which converges to the exact root.

1
Stopping Criteria

We use one or more of the following criteria to terminate the iterations.

(i) f ( xn )  

(ii) xn1  xn  

xn1  xn
(iii) 
xn1

Definition: An approximate number is correct to n decimal places if its approximate


absolute error is less than or equal to 0.5x10  n . Hence for an n decimal place accuracy,
we continue computing the iterations until xn1  xn  0.5 10 n .

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

If f ( x1 )  0 , then x1 is the root of f ( x)  0 .

Otherwise, the root lies either in (a1 , x1 ) or in ( x1 , b1 ) (depending on the sign of

f (a) f (b) ).

Let [a 2 , b2 ] be the new interval that contains the root.

a2  b2
Again let x2  .
2

If f ( x2 )  0 , then x2 is the root of f ( x)  0 .

Otherwise, the root lies in (a2 , x2 ) or in ( x 2 , b2 ) .

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

ba
with an absolute error of at most .
2n

2. Thus, the number of iterations required to achieve an accuracy of  is given by


ba
 .
2n

Example 1: Perform five iterations of the Bisection Method to approximate the root [1,
2] of the equation x 3  x  1  0 .

Solution: Since f (1)  1  0 and f (2)  5  0 and f is continuous on [1, 2]

  c (1,2) such that f (c)  0

1 2 15
Let x1   1.5 and f (1.5)  0
2 8

 root lies between 1&1.5

1  1 .5 19
x2   1.25 and f (1.25)   0
2 64

 root lies between 1.25&1.5

1.25  1.5
x3   1.375 and f (1.375)  0
2

 root lies between 1.25&1.375

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

Exercise: Compute the next three iterations.

Answer: x6  1.328125 , x7  1.3203125 and x8  1.32421875 .

Example 2: Determine the minimum number of iterations necessary to approximate the


root of f ( x)  x 3  4 x 2  10  0 with a tolerance of   10 5 for a=1 and b=2.

ba 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

At least 17 iterations are required (necessary) to achieve the desired accuracy.

Exercise: Using the Bisection method, find a real root of the equation xe x  1 which lies
between 0 and 1 (compute five iterations).

Advantages and Disadvantages of the Bisection method

1. The method always converges to the exact root of f ( x)  0

2. the method is relatively slow to converge

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.

The slope of the secant line is given by

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

Solving for x2, we get

( x1  x0 )
x 2  x1  f ( x1 )
f ( x1 )  f ( x0 )

Once x2 is determined, it is used together with x1 to determine x3.

( 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)

Solution: Let 𝑓(𝑥) = cosx − xex

x0 = 0 ⟹ f(x0 ) = f(0) = 1and x1 = 1 ⇒ f(x1 ) = f(1) = −2.1780

Using Secant method we have

(𝑥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

⟹ 𝑥2 = 0.3147 and f(x2 ) = f(0.3147) = 0.5198

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)

⟹ 𝑥3 = 0.4467,f(x3 ) = f(0.4467) = 𝟎. 𝟐𝟎𝟑𝟔

Using Secant method again, we have

(𝑥3 − 𝑥2 ) (0.4467 − 0.3147)


𝑥4 = 𝑥3 − 𝑓(𝑥3 ) = 0.4467 − 𝑓(0.4467) = 𝟎. 𝟓𝟑𝟏𝟕
𝑓(𝑥3 ) − 𝑓(𝑥2 ) 𝑓(0.4467) − 𝑓(0.3147)

Similarly one can show that ⟹ 𝑥5 = 0.5169

Therefore the required solutions (the first four iterations) are

𝑥2 = 0.3147,𝑥3 = 0.4467, 𝑥4 = 0.5317and𝑥5 = 0.5169

6
Exercise: Compute the fifth and sixth iteration

Answer: 𝑥6 = 0.5177 and 𝑥7 = 0.5178

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.

Solution: x0 = 0, x1 = 1, f(x0) = f(0) = 1, f(x1) = f(1) = – 1

x2 = 0.5, f(x2) = f(0.5) = – 0.375.

Since, f(0) f(0.5) < 0, the root lies in the interval (0, 0.5).

x3= 0.36364, f(x3) = f(0.36364) = – 0.04283.

Since, f(0) f(0.36364) < 0, the root lies in the interval (0, 0.36364).

x4 =0.34870, f(x4) = f(0.34870) = – 0.00370.

Since, f(0) f(0.3487) < 0, the root lies in the interval (0, 0.34870).

x5= 0.34741, f(x5) = f(0.34741) = – 0.00030.

Since, f(0) f(0.34741) < 0, the root lies in the interval (0, 0.34741).

x6= 0.347306.

Now, | x6 – x5 | = | 0.347306 – 0.34741 | = 0.0001 < 0.0005.

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

Let x0 be the approximate root of f(x)=0 and x1=x0+h is exact root.

⟹ f(𝑥1 ) = f(x0 + ℎ) = 0

Expanding f(x0 + ℎ) by Taylor series, we obtain

ℎ2 ′′ ℎ3
0 = 𝑓(𝑥0 ) + ℎ𝑓 ′ (𝑥0 ) + 𝑓 (𝑥0 ) + 𝑓 ′′′ (𝑥0 ) + . . .
2! 3!

Since ℎ = 𝑥1 − 𝑥0 is small, neglecting the second and higher order derivatives

𝑓(𝑥0 ) + ℎ𝑓 ′ (𝑥0 ) = 0

𝑓(𝑥0 )
⟹h=−
𝑓 ′ (𝑥0 )

A better approximation than 𝑥0 is therefore given by 𝑥1 ,where

𝑥1 = 𝑥0 + ℎ

𝑓(𝑥0 )
⟹ 𝑥1 = 𝑥0 −
𝑓 ′ (𝑥0 )

Similarly, a better approximation than 𝑥1 is 𝑥2 is given by

𝑓(𝑥1 )
⟹ 𝑥2 = 𝑥1 −
𝑓 ′ (𝑥1 )

𝑓(𝑥 ) 𝑓(𝑥 )
⟹ 𝑥3 = 𝑥2 − 𝑓′ (𝑥2 ) ⟹ 𝑥4 = 𝑥3 − 𝑓′ (𝑥3 ) etc
2 3

8
In general,

𝑓(𝑥 )
⟹ 𝑥𝑛+1 = 𝑥𝑛 − 𝑓′ (𝑥𝑛 ) for n=0, 1, 2, 3 , . . .
𝑛

Example: Use Newton-Raphson method to find the root of 𝑥 3 − 2𝑥 − 5 = 0 correct to six


decimal places (take𝑥0 = 2).

Solution: let 𝑓(𝑥) = 𝑥 3 − 2𝑥 − 5 ⟹ 𝑓 ′ (𝑥) = 3𝑥 2 − 2

using Newton-Raphson, we have

𝑓(𝑥 ) 3 −2𝑥 −5
𝑥𝑛
⟹ 𝑥𝑛+1 = 𝑥𝑛 − 𝑓′ (𝑥𝑛 ) = 𝑥𝑛 − 𝑛
2 −2 for n=0,1,2,3, …….
𝑛 3𝑥𝑛

Hence

𝑓(𝑥0 ) 𝑥03 − 2𝑥0 − 5


⟹ 𝑥1 = 𝑥0 − = 𝑥0 −
𝑓 ′ (𝑥0 ) 3𝑥02 − 2

23 − 2(2) − 5 −1
= 2− = 2 − = 2.1000000
3(22 ) − 2 10

𝑓(𝑥1 ) 𝑥13 − 2𝑥1 − 5


𝑥2 = 𝑥1 − ′ = 𝑥1 −
𝑓 (𝑥1 ) 3𝑥12 − 2

2.1000003 − 2(2.1000000) − 5
= 2.1000000 − = 2.0945681211042 ≈ 2.0945681
3𝑥2.1000002 − 2

𝑓(𝑥2 ) 𝑥23 − 2𝑥2 − 5


⟹ 𝑥3 = 𝑥2 − = 𝑥2 − = 2.0945514816978 ≈ 2.0945515
𝑓 ′ (𝑥2 ) 3𝑥22 − 2

𝑓(𝑥3 ) 𝑥33 − 2𝑥3 − 5


⟹ 𝑥4 = 𝑥3 − ′ = 𝑥3 − = 2.0945514815423 ≈ 2.0945515
𝑓 (𝑥3 ) 3𝑥32 − 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).

4. Fixed point Iteration method

To describe this method for finding the roots of f ( x)  0 , we first rewrite this equation
in the form x   (x) .

Example: x 3  x 2  1  0 can be expressed as

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 )

where the sequence of approximations x0 , x1 , x2 , x3 , ...x n converge to the root of x   (x) .

Note: the sequence of approximations x0 , x1 , x2 , x3 , ...x n does not always converge to

some number  .

Example: consider x  10 x  1   ( x)

If we take x0  0 ,then

x1  2, x 2  101, x3  10101  1, etc.

10
Condition for convergence

Theorem: Let x   be a root of f ( x)  0 which is equivalent to x   (x) and I be an

interval containing  and  (x) is continuous in I. If  ' ( x)  1 for x  I ,then the

sequence of approximations x0 , x1 , x2 , x3 , ...x n will converge to  provided that the initial

approximation x0 is chosen in I.

Proof:  is a root of f ( x)  0

  is a root of x   (x)

    ( )

and x n   ( xn 1 ) where x n and xn 1 two successive approximations of 

 xn     ( xn1 )   ( )

 ( 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   ) (  )
'

If we let  ' ( x)  k  1 x  I ,then

xn    ( xn1   ) ' ( )  k xn1  

 xn    k xn1  

 xn    k xn1    k.k xn2    k.k.k xn3   ...

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 

Therefore, the sequence of successive approximations x0 , x1 , x2 , x3 , ...x n converge to the

root  if k<1

i.e.  ' ( x)  1

if k > 1 xn     as n  

 The sequence of successive approximations does not converge.

Example 1: Find the root of the equation f ( x)  x 3  x 2  1  0 on the interval[0, 1] correct

to three decimal places.

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

Let x0  0.75 be the initial approximation

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

Since|𝑥3 − 𝑥2 |0.0002 ≤ 0.5𝑥10−3 , the approximate root is 0.755correct to three decimal


places.

Example 2: Find the root of the equation cos x  3 x  1 correct to three decimal places on

[0, ] using iteration method.
2

Solution: let f ( x)  cos x  3x  1  0

Here f (0)  2  0

f ( 2 )  3 2  1  0


 Root lies between 0 and by IVT.
2

f ( x)  cos x  3x  1  0 can be rewritten as

x  13 (1  cos x) , Let  ( x)  13 (1  cos x)

sin x 1
 ( x) '     ' ( x)   1
3 3

1 
  ' ( x)   1x  [0, ]
3 2

13
Hence we can use iteration method

Let x0  0 be the initial approximation

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

Now |𝑥6 − 𝑥5 | = 0.0001 ≤ 0.0005 = 0.5𝑥10−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

You might also like