0% found this document useful (0 votes)
285 views38 pages

Numerical Analysis I Chapter III - VI

The document describes methods for solving systems of linear equations. It defines a system of n linear equations with n unknowns and writes it in matrix form as Ax=b. Direct methods, like Cramer's rule, Gauss elimination, Gauss-Jordan, and matrix inversion can be used to exactly solve the system. Indirect iterative methods start with an initial approximation and generate a sequence of solutions that converge to the true solution. Jacobi and Gauss-Seidel methods are discussed as iterative techniques that convert the system into the form x=Tx+c to iteratively solve for the solution.

Uploaded by

Kidist Talu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
285 views38 pages

Numerical Analysis I Chapter III - VI

The document describes methods for solving systems of linear equations. It defines a system of n linear equations with n unknowns and writes it in matrix form as Ax=b. Direct methods, like Cramer's rule, Gauss elimination, Gauss-Jordan, and matrix inversion can be used to exactly solve the system. Indirect iterative methods start with an initial approximation and generate a sequence of solutions that converge to the true solution. Jacobi and Gauss-Seidel methods are discussed as iterative techniques that convert the system into the form x=Tx+c to iteratively solve for the solution.

Uploaded by

Kidist Talu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 38

Chapter III

Solving System of Linear Equations


Consider the system of n equations in n unknowns x1 , x2 , . . ., xn as follows

a11 x1  a12 x2  . . .  a1n xn  b1


a21 x1  a22 x2  . . .  a2n xn  b2 (1)

an1 x1  an 2 x2  . . .  ann xn  bn

Where a11 , . . . , a nn are given numbers called coefficients of the system,


b1 , b2 , . . ., bn are also given numbers. (*) is system of linear equation because the
variables x j ( j  1, . . ., n) appear in the first power only. The solution of (*) is the
number x j ( j  1, . . ., n) that satisfy all the n equations.

Ax  b (2)

 a11 a12 . . . a1n   x1   b1 


     

Where  a 21 a 22 . . . a 2 n   x2   b2 
A   , x   and b   (3)
        .  . 
     
 a a .. . a     
 n1 n2 nn   xn   bn 

(3.2) is called matrix form of the linear system (3.1)


(3.2) has a unique solution if det(A) different from zero.

Direct (Exact) method of solving system of linear equation


This method gives the solution after a certain amount of fixed computation.

Crammer’s rule
Gauss elimination
Gauss Jordan
Triangular factorization (LUD)
Matrix inversion

The above are direct methods for solving system of linear equations the detail you know
from your linear algebra course.

Indirect Direct (Iterative) method of solving system of linear equation

This is an iterative method. An iterative technique to solve the nn linear system
Ax  b starts with an initial approximation

1
 0
x1   x1 
   
 
to the solution and generates a
0
( 0) x2  x2 
x    x  . 
 .   
 0   x 
 xn   n 
 x1
1   x1
2 
   

sequence of vectors  xk 
k 1 
 x1

.

2

1




,
 x2

.

2

2

 , . .


. .
that converges to x.
 xn   xn 

In this section we discuss on the Jacobi and Gauss-Seidal Iterative Methods.

Iterative technique here involves a process that converts the system Ax  b into an
equivalent system of the form
x  Tx  c (4)
for some fixed matrix T and vector c as follows.
Solving the ith equation in Ax  b for xi to obtain (provided aii  0 )

x1 
1
  a12 x2  a13 x3  . . .  a1n xn   b1
a11 a11
1 b
x2  ( a21 x1  a23 x3  . . .  a2 n xn )  2 (5)
a22 a22

1 b
xn  (an1 x1  an 2 x2  . . .  an ( n 1) xn 1  n
ann ann

Matrix representation of (3.5) is


 a a13 a   b 
0  12  . . .  1n  x1   1 
 a11 a11 ann    a11 
 x1    x 2   b 
  a21 a23 a
 x2   0  . . .  2n  .   2 
. 
a22 a22 ann     a22 
. 
                   . 
    .   
 xn   an ( n 1)  
an1 a a    bn 
  n 2  n3 . . .  x n  a 
 ann ann a nn ann   nn 

And this is the same as, x  Tx  c where,


 x 1 
 

x= , T=
 x2 
 . 
 
 xn 
 
 a12 a13 a1n 
 0   . . .  
 a11 a11 an n 
 a2 1 a2 3 a2 n 
  0  . . .  
 a2 2 a22 ann 
                 
 
 an1 an 2 an 3 an ( n 1) 
    . . . 
 an n an n an n an n 
 b1 
 
 a 11 
 b2 
 
and c = 
 .
a2 2 

 
 bn 
 an n 
 

After the initial vector x ( 0) is selected, the sequence of approximate solution


vectors is generated by computing
x ( k )  Tx ( k 1)  c for each k  1,2,3,.... (6)
(3.6) is called Jacobi Iterative Method. It consists of solving the ith equation in Ax  b
for xi to obtain (provided aii  0 )

2
n  aij x j  bi
xi     a 
 a for i  1,2,..., n (7 )
j 1  ii  ii
j i

And generating each xi(k ) from the components of x ( k 1) for k  1 by


n
( k 1)
 (  aij x j )  bi
j 1
j i
xi( k )  for i  1,2,3,..., n (8)
aii

Note: - The absolute error or relative error of the approximate solution can be obtained
using either the l 2 norm or the l norm.
Definition: - The l 2 and l norms for the vector x  ( x1 , x2 ,....., xn ) t are defined by
1
n 2
x 2
   xi2  and x 
 max xi
i 1  ii n

Example: - solve the following linear system using Jacobi method accurate to within
10-2 in l 2 norm .
20 x1  x2  2 x3  17
3 x1  20 x2  x3  18
2 x1  3 x2  20 x3  25
Solution: - Solving the ith equation for xi (i  1,2,3) we get
1
x1  (17  x 2  2 x3 )
20
1
x2  (18  3x1  x3 )
20
1
x3  (25  2 x1  3x 2 )
20
And from Jacobi Method we have

1
x1( k )  (17  x2( k 1)  2 x3( k 1) )
20
1
x2( k )  ( 18  3 x1( k 1)  x3( k 1) )
20
1
x3( k )  ( 25  2 x1( k 1)  3x2( k 1) )
20

Taking x (0)  ( x10 , x20 , x30 ) t  (0,0,0) t

1
x1(1)  (17  x2( 0)  2 x3( 0) )  0.85
20
1
x2(1)  (18  3 x1( 0)  x3( 0) )  0.9
20
1
x3(1)  (25  2 x1( 0)  3x2( 0) )  1.25
20

3
Additional iterates, x ( k )  ( x1( k ) , x2( k ) , x3( k ) ) t , are generated in a similar manner and are
presented as in the table below

-------------------------------------------------------------
Iteration (k) x1k x2k x3k
-------------------------------------------------------------
1 0.85000 -0.90000 1.25000
2 1.02000 -0.96500 1.03000
3 1.00125 -1.00150 1.00325
4 1.00040 -1.00003 0.99965
5 0.99997 -1.00008 0.99996
6 1.00000 -1.00000 0.99999
7 1.00000 -1.00000 1.00000
---------------------------------------------------------------

Since x ( 4)  x (3)  0.0040  10  2 the approximation accurate to within 10 2 is


x (3)  (1.00125 ,  1.00150 , 1.00325) t

A possible improvement over Jacobi’s Method can be seen by reconsidering equation


(3.8). The component of x ( k 1) are used to compute xik . Since, for i  1,
x ( k 1) , . . . , xi(k1) have already been computed and are probably better approximation
to the actual solution x1 , x2 , . . . , xi 1 than x1( k 1) , x2( k 1) , . . . , xi(k11) , it seems
more reasonable to compute xik using these most recently calculated values. That is, as
soon as a new approximation for an unknown is found, it is immediately used in the next
step. This Modification is called The Gauss-Seidel Iterative Method and is illustrated
by the following example.

Example: - solve the following linear system using Gauss-Seidel method accurate to
within 10-2 in l 2 norm .
20 x1  x2  2 x3  17
3 x1  20 x2  x3  18
2 x1  3 x2  20 x3  25

Solution: - Solving the ith equation for xi (i  1,2,3) we get

4
1
x1  (17  x 2  2 x3 )
20
1
x2  (18  3x1  x3 )
20
1
x3  (25  2 x1  3x 2 )
20

Letting x (0)  ( x10 , x20 , x30 ) t  (0,0,0) t

1
x1(1)  (17  x2( 0)  2 x3( 0) )  0.85
20
1
x2(1)  ( 18  3 x1(1)  x3( 0) )  1.0275
20
1
x3(1)  ( 25  2 x1(1)  3 x2(1) )  1.01087
20

Additional iterates, x ( k )  ( x1( k ) , x2( k ) , x3( k ) ) t are generated in a similar manner and are
presented as in the table below

--------------------------------------------------------------
Iteration (k) x1k x2k x3k
---------------------------------------------------------------
1 0.85000 -1.02750 1.01087
2 1.00246 -0.99983 0.99978
3 0.99997 -1.00001 1.00000
4 1.00000 -1.00000 1.00000
---------------------------------------------------------------

Since x (3)  x ( 2 )  0.0025  10  2 the approximation accurate to within 10 2 is


x (3)  (1.00246 ,  0.99983, 0.99978) t

Remarks: -
1. Since the most recent approximation of the unknowns are used while proceeding
to the next step, the convergence in the Gauss-Seidel Method is faster than that of
Jacobi’s Meyhod

5
n

2. If A is strictly diagonally dominant ( i.e. a   a ), then for any choice of


ii
j 1
j i
ij

initial approximation, both the Jacobi and Gauss-Seidel Methods give sequences
of approximations  x ( k )  k 1 that converges to the unique solution of Ax  b .

Example: - Solve the following linear system accurate to within 10-2 in l 2 norm .
3 x1  x2  x3  1
3 x1  3x2  7 x3  4
3 x1  6 x2  2 x3  0
a. Using Jacobi Method
b. Using Gauss-Seidel Method

Solution: -
First we arrange the given system for diagonal dominancy

3 x1  x2  x3  1
3 x1  6 x2  2 x3  0
3 x1  3x2  7 x3  4

Solving the ith equation for xi (i  1,2,3) we get


1
x1  (1  x2  x3 )
3
1
x2  ( 3 x1  2 x3 )
6
1
x3  (4  3 x1  3 x2 )
7
Letting x (0)  ( x10 , x20 , x30 ) t  (0,0,0) t

a. Using Jacobi Method


1
x1(1)  (1  x2( 0)  x3( 0) )  0.33333
3
1
x2(1)  ( 3 x1( 0)  2 x3( 0) )  0
6
1
x3(1)  ( 4  3 x1( 0)  3 x2(0) )  0.57143
7
Additional iterates, x ( k )  ( x1( k ) , x2( k ) , x3( k ) ) t are generated in a similar manner and are
presented as in the table below

6
------------------------------------------------------------
Iteration (k) x1k x2k x3k
-------------------------------------------------------------
1 0.33333 0.00000 0.57143
2 0.14286 -0.35714 0.42857
3 0.07143 -0.21429 0.66327
4 0.04082 -0.25680 0.63265
5 0.03685 -0.23129 0.66399
6 0.03490 -0.23976 0.65476
7 0.03516 -0.23571 0.65922
8 0.03502 -0.23732 0.65738
------------------------------------------------------------

Since the x ( 7 )  x ( 6)  0.0060  10  2 the approximation accurate to within 10 2 is


x ( 6)  (0.0349 ,  0.23976 , 0.65476) t

b. Using Gauss-Seidel Method

1
x1(1)  (1  x2( 0)  x3( 0) )  0.33333
3
1
x2(1)  (3 x1(1)  2 x3(0) )  1.66667
6
1
x3(1)  (4  3 x1(1)  3x2(1) )  0.50000
7

---------------------------------------------------------------
Iteration (k) x1k x2k x3k
----------------------------------------------------------------
1 0.33333 -0.16667 0.50000
2 0.11111 -0.22222 0.61905
3 0.05291 -0.23280 0.64853
4 0.03956 -0.23595 0.65560
5 0.03615 -0.23661 0.65734
6 0.03535 -0.23679 0.65776
-----------------------------------------------------------------

Since x ( 5)  x ( 4 )  0.0039  10  2 the approximation accurate to within 10 2 is


x ( 4)  (0.03956 ,  0.23595 , 0.65560) t

Exercise: -

7
1. Solve the following linear system using Jacobi method with tolerance   0.01 .
2 x1  2 x3  5 x3  1
a) 4 x1  x2  x3  5
 x1  3 x2  x3  4

x 2  2 x3  0
1
x1  2 x2  x3  4
b) 2
1
 2 x1  x2  x3  4
2

 4 x2  8 x3  x4  11
10 x1  5 x2  6
c)
 x3  5 x4  11
5 x1  10 x2  4 x3  25

2. Repeat 1 Using the Gauss-Seidel Method

Solving Systems of non-linear equations using Newton’s Method

Theorem: - Taylor’s series for function of two variables.


f f 1 2 f 2 f 2 f 
f ( x  x, y  y )  f ( x, y )  x  y   2 ( x) 2  2 xy  ( y ) 2   .......
x x 2  x xy y 2

Consider the equations
f ( x, y )  0
(1)
g ( x, y )  0
If an initial approximation ( x0 , y0 ) to the solution has been found by graphical method
or otherwise, then a better approximation ( x1 , y1 ) can be obtained as follow:

Let for small h and k , ( x1 , y1 )  ( x0  h , y0  k ) be the correct root so that


f ( x0  h, y0  k )  0
(2)
g ( x 0  h, y 0  k )  0

Expanding each of the functions in (2) by Taylor’s series for function of two variables to
first degree term, we get approximately

f ( x0 , y0 )  hf x ( x0 , y0 )  kf y ( x0 , y0 )  0
(3)
g ( x0 , y0 )  hg x ( x0 , y0 )  kg y ( x0 , y0 )  0

8
Solving equation (3) for h and k , we get a new approximation to the root as
( x1 , y1 )  ( x0  h , y0  k )

In the next step (i.e. to find ( x2 , y 2 ) ) we substitute ( x1 , y1 ) instead of ( x0 , y0 ) in (3) to


find h and k and the second and better approximation to the solution becomes
( x2 , y 2 )  ( x1  h , y1  k )

This process is repeated till we get the values to the desired accuracy.

Note: -
1. This method will not converge unless the starting values of the root chosen are
close to the actual root.
2. The method can be extended to 3 equations in 3 unknowns. But it is very
cumbersome to obtain a meaningful solution unless the entire information about
the equations and their physical context is available.

Example: -Use Newton’s Method to compute x ( 2) for the following nonlinear equation.

x 2  y  11
x  y2  7
Solution: -

Initial approximation to the solution using the graphing facility of MATHLAB as below

9
20

10

D B
0
C A
-10

-20

-30

-40
-8 -6 -4 -2 0 2 4 6 8

To approximate the solution at A chose a point near A. Let ( x0 , y 0 )  (3.5,1.8)


f ( x, y )  x 2  y  11
g ( x, y )  y 2  x  7

f x ( x, y )  2 x , f y ( x, y )  1
g x ( x , y )  1 , g y ( x, y )  2 y

The Newton’s equations (3) will be


7 h  k  0.55
h  3.6k  0.26
Solving this we get h  0.0855 , k  0.0485
Therefore, the better approximation to the root is
( x1 , y1 )  ( x0  h, y0  k )  (3.5855,1.8485)
Repeating the above process that is, replacing ( x0 , y0 ) by ( x1 , y1 ) in the Newton’s
equation (3), we obtain ( x2 , y 2 )  (3.5844,1.8482)

To approximate the solution at B chose a point near A. Let ( x0 , y0 )  ( 2.5, 3) and check
that the first three approximations to the solution are

10
( x1 , y1 )  (3.017241, 2.163793)
( x2 , y 2 )  (2.998983 , 2.006434)
( x3 , y3 )  (2.999998, 2.000011)
Check also that at point B the exact solution is (3, 2).
Also approximate the solution at the points C and D.

Exercise: - Use Newton’s Method for system of nonlinear equations to solve the
following. Perform only two iterations in each case. Try to interpret each equation
graphically to obtain an initial approximation.

x2  y  5
a)
y2  x  3

x  2( y  1)
b)
y 2  3 xy  7

xy  x  9
c)
y2  x2  y2

x2  y2  4
d)
x 2  y 2  16

CHAPTER FOUR
FINITE DIFFERENCES
Forward and backward differences
Let y  f (x) be a function which take the set of discrete values y 0 , y1 , y 2 ,  , y n to the
corresponding values x 0 , x1 , x 2 ,  , x n of x , where xi  x0  ih , i  1,2,3,..., n and h
is the step length (or size). To determine the values of f ( x) or f '( x ) for some
intermediate or outside values of x , two types of differences are very useful namely
forward differences and backward differences.

11
Argument / x x0 x1 x2 x3  xn
Entry / y y0 y1 y2 y3  yn

Forward difference operators


If y 0 , y1 , y 2 ,  , y n denote a set of values of y, then
y1  y 0 , y 2  y1 , y 3  y 2 ,  , y n  y n 1 are called the forward differences of y and we

denote these differences by y 0 , y1 , y 2 ,  , y n 1 respectively and we have


y 0  y1  y 0 ,
y1  y 2  y1
y 2  y 3  y 2

y n  y n 1  y n

where  is called the forward difference operator and y 0 , y1 , y 2 ,  , y n are called
first forward differences and in general
y r  y r 1  y r
The differences of the first forward differences are called second forward differences and

are denoted by 2 y 0 , 2 y1 , 2 y 2 ,  , 2 y n i.e.


2 y0  y1  y0
2 y1  y 2  y1
2 y 2  y3  y 2 ....... etc and in general

2 y r  y r 1  y r

Similarly one can define third forward differences, fourth forward differences etc.
The following table which is called the forward difference table shows how the forward
differences of all orders can be formed from the following tabulated data.

X x0 x1 x2 x3 x4 x5 x6
Y=f(x) y0 y1 y2 y3 y4 y5 y6

x y  2 3 4 5 6
x0 y0 y 0 2 y0 3 y 0 4 y0 5 y0 6 y0
x1 y1 y1 2 y1 3 y1 4 y1 5 y1

12
x2 y2 y 2 2 y 2 3 y 2 4 y 2
x3 y3 y3 2 y3 3 y3
x4 y4 y 4 2 y 4
x5 y5 y5
x6 y6

Remark: - Any higher order forward differences can be expressed in terms of the entries
(or values of y) like
2 y0  (y0 )   ( y1  y0 )  y1  y 0   y 2  y1    y1  y 0   y 2  2 y1  y 0
3 y0  (2 y0 )  ( y 2  2 y1  y0 )  y 2  2y1  y0
 ( y3  y 2 )  2 y 2  y1   ( y1  y0 )
 y3  3 y 2  3 y1  y 0
 y0  (3 y0 )   y3  3 y 2  3 y1  y0   y3  3y 2  3y1  y0
4

 y 4  4 y3  6 y 2  4 y1  y

Generally,
 n  n  n  n
n y0    yn    yn1    yn2    yn3     1 k y0 , k  0,1,2,3,. . .
 0  1   2   3 

Example: - Construct the forward difference table for the data below

x 0 1 2 3 4
y 1.0 1.5 2.2 3.1 4.6

And find y 2 , 2 y 2 , 3 y1 and 4 y0


Solution: -
x y  2 3 4
0 1.0 0.5 0.2 0 0.4
1 1.5 0.7 0.2 0.4
2 2.2 0.9 0.6
3 3.1 1.5
4 4.6

You can read the above differences directly from the difference table as
y 2  0.9 , 2 y 2  0.6 , 3 y1  0.4 and 4 y0  0.4

But, 4 y 0 can also be found using the entries as

13
 4  4  4  4 4
4 y0    y 4    y3    y 2    y1    y0
0 1   2 3  4
 y4  4 y3  6 y2  4 y1  y0
 4.6  4(3.1)  6(2.2)  4(1.5)  1
 0.4

Exercise: - Given the set of values


x 10 15 20 25 30 35
Y=f(x) 19.97 21.51 22.47 23.52 24.65 25.89

Form the forward difference table and write the values of


y3 , 2 y 2 , 3 y1 , 4 y0 and 5 y0

Remark: -The operator  obeys the following laws


i )  ( f ( x )  g ( x ))  f ( x )  g ( x ) Distributive law
ii )  (cf ( x ))  cf ( x ) Cons tan t multiple law
iii ) m n f ( x )  m  n f ( x ) index law m, n  Z 
But
iv ) [ f ( x ). g ( x )]  f ( x ).g ( x ) Show this by example

Remark: - Given P( x)  an x n  an 1 x n 1  ....  a2 x 2  a1 x  a0 a polynomial of degree

n, the nth forward difference of p (x ) i.e. n p ( x)  a n n!h n and all higher order
differences of p(x) are zero.
Exercise: - Evaluate 10 (1  ax 2 )(1  bx 2 )(1  cx 2 )(1  dx 4 )
Answer = abcd (10!) h10

Backward difference operators.


If y 0 , y1 , y 2 ,  , y n denote a set of values of y, then the differences
y1  y 0 , y 2  y1 , y 3  y 2 ,  , y n  y n 1 are called first backward differences if they are

denoted by y1 , y 2 , y 2 ,  , y n respectively so that


y1  y1  y 0 , y 2  y 2  y1 , , y n  y n  y n 1 , where  is called the backward

difference operator. Similarly, the second and higher order backward differences are
obtained by:
 2 y n  y n  y n 1
 3 y n   2 y n   2 y n 1
 4 y n   3 y n   3 y n 1

 k y n   k 1 y n   k 1 y n 1

14
Moreover;
n  n   n  n 
n yn    yn    yn1    yn2    yn3      1 k y0 , k  0,1,2,3
0   1   2  3

The following table which is called the backward difference table shows how the
forward differences of all orders can be formed from the following tabulated data.

X x0 x1 x2 x3 x4 x5 x6
Y=f(x) y0 y1 y2 y3 y4 y5 y6

x Y  2 3 4 5 6
x0 y0
x1 y1 y1
x2 y2 y 2  2 y2
x3 y3 y 3  2 y3  3 y3
x4 y4 y 4  2 y4 3 y4  4 y4
x5 y5 y 5  2 y5  3 y5  4 y5  5 y5
x6 y6 y 6  2 y6  3 y6  4 y6  5 y6  6 y6

Example: - Write the forward difference table for the following data.

X 0 1 2 3 4 5
y 18 21 25 27 30 34

And find the values of y3 ,  2 y 2 ,  3 y 4 ,  4 y5 and  5 y5 from the table.


Solution: -
x Y  2 3 4 5
0.0 18
0.5 21 3
1.0 25 4 1
1.5 27 2 -2 -3
2.0 30 3 1 3 6
2.5 34 4 1 0 -3 -9

y3  2 ,  2 y 2  1 ,  3 y 4  3 ,  4 y5  3 and  5 y5  9

15
Exercise: - Form the table of backward differences of the function
f ( x)  x 3  3 x 2  5 x  7 for x  2 ,  1, 0 ,1, 2 , 3, 4

Exercise: - If u0  3 , u1  12 , u 2  81 , u3  2000 , u 4  100 , calculate

4u 0 and  4 y 4

Example: - Show that:


 1   f ( x)
a.   
 f ( x )  f ( x ) f ( x  h)
 f ( x ) 
b.  ln f ( x)  ln1  
 f ( x ) 

1  n  1  1  1 
c.  tan    tan  2 
 n   2n 
Solution: -
 1  1 1 f ( x )  f ( x  h)   f ( x  h)  f ( x )
a)     f ( x  h)  f ( x )  f ( x ) f ( x  h ) 
 f ( x )  f ( x ) f ( x  h)
 f ( x)

f ( x ) f ( x  h)

b) Exercise
1  n  1 1  n 
c) Let f (n)  tan   & take h=1.Then f (n  1)  tan  
 n   n  1
Now,
 n  1  n  1 
f (n)  f (n  h)  f (n)  tan 1    tan  
 n  1  n 
 n n 1 
  
 tan 1  n  1 n   tan 1  1 
1  n  n  1   2n 2 
 
 n 1 n 
 Let tan 1
x   & tan 1 y    tan   x & tan   y
tan   tan  x y
Now, tan(   )  
1  tan  tan  1  xy
 x y
 (   )  tan 1  
 1  xy 
 x y
 tan 1 x  tan 1 y  ta 1   
 1  xy 

16
1  n  1  1  1 
Thus,  tan    tan  2 
 n   2n 

CHAPTER FIVE
INTERPOLATION
Introduction
Suppose we are given the following values of y  f (x) for a set of values of x as given
by the table below

x x0 x1 x2 ……….. xn
Y = f(x) y0 y1 y2 ….……. yn
(1)

Then the process of finding the value of y corresponding to any value of x between
x0 and xn is called Interpolation, while the technique of computing the value of y

outside the range [ x0 , xn ] is called Extrapolation. The term Interpolation is often taken
to include Extrapolation.
If y  f (x) is known explicitly then the value of y corresponding to any value of x can
be easily found. Conversely, if y  f (x) is given with the help of tabulated data as in (1)
above, f (x ) is replaced by another function  (x ) which assumes the same values as
those of f (x ) at the tabulated set of points. Any other value may be calculated from
 (x ) which is known as the Interpolating function. If  (x ) is a polynomial then it is
called the Interpolating Polynomial and the process is called the polynomial
interpolation.

Newton’s Forward Difference Interpolation Formula

17
Given the tabulated data like (1) in it is to find a polynomial pn (x) of the n th degree

such that y and pn (x) agree at the tabulated points. For this let the values of x be

equidistant i.e. let xi  x  ih , i  1, 2 , 3 , , n .


Since pn (x) is a polynomial of the n th degree, it may be written as:
p n ( x )  a 0  a1 ( x  x0 )  a 2 ( x  x0 )( x  x1 )  a3 ( x  x0 )( x  x1 )( x  x 2 ) 
 ( 2)
   a n ( x  x0 )( x  x1 )( x  x 2 ) . . . ( x  x n 1 ) 

Where the constants a i , i  1, 2 , 3 ,  , n are to be determines using the idea that y and
pn (x) should agree at tabulated points. Thus
p n ( x0 )  a 0  y 0  a 0  y 0
pn ( x1 )  y1  a0  a1 ( x1  x0 )  y0  a1 ( x1  x0 )
y1  y 0 y 0
 a1  
x1  x0 h

pn ( x2 )  y 2  a0  a1 ( x2  x0 )  a2 ( x2  x0 )( x2  x1 )
y1  y0
 y 2  y0  2h  a2 2h.h
h
 y 2  2 y1  y0  2h 2 a2
y 2  2 y1  y0
 a2 
2h 2

2 y0
 a2 
2h 2
Similarly on substituting x  x3 , x4 , x5 , xn in ( 2), we get :

3 y 0 4 y 0 n y 0
a3  , a 4  ,  , a n 
3!h 3 4!h 4 n!h n
Substituting these values of a0 , a1 , a2 , a n in (2), we get :

y0 2 y0 3 y0
pn ( x)  y0  ( x  x0 )  ( x  x 0 )( x  x1 )  ( x  x0 )( x  x1 )( x  x2 )
h 2!h 2 3!h 3
(3)
n y0
 ( x  x0 )( x  x1 )( x  x2 )( x  xn 1 )
n!h n
Or, more specially, if it is required to evaluate pn (x) for x  x0  uh where u  R ,
then from (3)

18
x  x0  uh
x  x1  x0  uh  ( x0  h)  uh  h  h(u  1)
x  x2  x0  uh  ( x0  2h)  uh  2h  h u  2 

x  xn 1  x0  uh  ( x0  (n  1)h)  uh  ( n  1)h  h(u  ( n  1))

Therefore, (2) can be written as:


u u (u  1) 2 u (u  1)(u  2) 3
p n ( x)  y 0  y 0   y0   y0
1! 2! 3!
u (u  1)(u  2) (u  (n  1)) n
  y 0 ... (4)
n!
x  x0
where u 
h

(4) is called Newton-Gregory forward interpolation formula or simply Newton’s


forward interpolation formula and it used for interpolating the values of y near the
beginning of a set of tabulated values.

Newton’s Backward Difference Interpolation Formula


Instead of assuming pn (x) as in (2) if we choose it in the form:
pn ( x)  a0  a1 ( x  xn )  a2 ( x  xn )( x  xn 1 )  a3 ( x  xn )( x  xn 1 )( x  xn  2 )
   an ( x  xn )( x  xn 1 )( x  xn  2 )( x  x1 )

(5)
and then impose the condition that y & pn ( x) should agree at the tabulated points
x n , x n 1 , x n  2 ,  , x 2 , x1 , x 0 we obtain

u u (u  1) 2 u (u  1)(u  2) 3
p n ( x )  y n  y n   yn   yn
1! 2! 3!
u (u  1)(u  2)  (u  (n  1)) n
  y n … (6)
n!
x  xn
where u 
h

(6) is called Newton’s backward difference interpolation formula and it used for
interpolating the values of y near the end of a set of tabulated values.
Example: - From the following table estimate y when x  1.75 , x  1.85 and x  2.4 .
using Newton’s interpolation formula.

19
x 1.7 1.8 1.9 2.0 2.1 2.2 2.3
y  ex 5.474 6.050 6.686 7.389 8.166 9.025 9.974

Solution: -
Forming the difference table first,
x y Dy D2y D3 y D4 y D5 y D6 y
1.7 5.474
0.576
1.8 6.05 0.06
0.636 0.007
1.9 6.686 0.067 0
0.703 0.007 0.001
2 7.389 0.074 0.001 -0.002
0.777 0.008 -0.001
2.1 8.166 0.082 0
0.859 0.008
2.2 9.025 0.09
0.949
2.4 9.974
x y Vy V2y V3 y V4 y V5 y V6 y

x  1.75 is near the beginning of the data, therefore we use Newton’s forward formula.
x  x0
x0  1.7 , h  0.1 , u   0.5
h
u u (u  1) 2 u (u  1)(u  2) 3
y ( x)  p 6 ( x)  y 0  y 0   y0   y0
1! 2! 3!
u (u  1)(u  2)  (u  5) 6
  y0
n!
 y (1.75)  5.755006

x  1.85 is very near the beginning of the data than near the end, therefore we use
Newton’s forward formula.
x  x0
x0  1.8 , h  0.1 , u   0.5
h
u u (u  1) 2 u (u  1)(u  2) 3 u (u  1)(u  2)(u  3) 4
y ( x)  p5 ( x)  y 0 
y 0   y0   y0   y0
1! 2! 3! 4!
u (u  1)(u  2)  (u  4) 5
  y0
n!
 y (1.85)  6.359997

x  2.4 is very near the end of the data, therefore we use Newton’s backward formula.

20
x  x6
x6  2.3 , h  0.1 , u  1
h
u u (u  1) 2 u (u  1)(u  2) 3
y ( x )  p 6 ( x )  y n  y n   yn   yn
1! 2! 3!
u (u  1)(u  2)  (u  5) 6
  yn
n!
 y (2.4)  11.018021

Example: - From the following table, estimate the number of students who obtained
marks between 40 and 45.
Marks Number of students
30-40 31
40-50 42
50-60 51
60-70 35
70-80 31

Solution: - Forming the cumulative frequency table first


Marks < x 40 50 60 70 80
Number of students y(x) 31 73 124 159 190

We need to find y(45) that is equal to the number of students who got marks less than 45
and for this we use Newton’s forward difference formula(why?).
Forming the difference table first,
x y Dy D2y D3 y D4 y
40 31
42
50 73 9
51 -15
60 124 -16 37
35 12
70 159 -4
31
80 190

x  x0
x  45 , x0  40 , h  10 , u   0.5
h

21
u u (u  1) 2 u (u  1)(u  2) 3 u (u  1)(u  2)(u  3) 4
y ( x)  p 4 ( x)  y 0  y 0   y0   y0   y0
1! 2! 3! 4!

 y ( 45)  47.867  48

Since y ( 40) is 31, the number of students who scored between 40 and 45 is:
48 – 31 = 17
Exercise: -
1. The population of a certain city in the census was as under

Year(x) 1891 1901 1911 1921 1931


Population in 46 66 81 93 101
thousands(y)

Estimate the population in the year 1925.


Answer: - About 96.84 thousands

2. 4.8 , 8.4 , 14.5 , 23.6 , 36.2 , 52.8 , 73.9 are consecutive terms of a sequence
of
which 23.6 is the 6th term. Find the first and the tenth term of the sequence.
Answer: - tenth term = 100.000038

3. The following table gives the population of a town during six censuses. Estimate the
increase in the population during the period from 1976 to 1978.

Year(x) 1941 1951 1961 1971 1981 1991


Population in 12 15 20 27 39 52
thousands(y)

Answer: - About 2506

Lagrange’s Interpolation Formula


Newton’s forward and backward interpolation formulas posses the disadvantage of being
applicable only to equally spaced values of the arguments. Lagrange’s Interpolation
Formula can be applied whether the values of xi are equally spaced or not.

22
Let y  f (x) be a function which passes through (n+1) given points
( x0 , y0 ) , ( x1 , y1 ) ,, ( xn , y n ) . We can represent f (x ) as a polynomial in x of degree
n as follows.
pn ( x)  a0 ( x  x1 )( x  x2 )( x  xn )  a1 ( x  x0 )( x  x2 )( x  xn )
 a2 ( x  x0 )( x  x1 )( x  x3 )( x  xn )  an ( x  x0 )( x  x1 )( x  xn 1 ) ... (7)

where ai , i  1,2,3,..., n are coefficients whose values are to be determined here also

using the idea that y and pn (x) should agree at tabulated points. Thus

pn ( x0 )  a0 ( x0  x1 )( x0  x2 )( x0  xn )  y0
y0
 a0 
( x0  x1 )( x0  x2 )( x0  xn )

pn ( x1 )  a1 ( x1  x0 )( x1  x2 )( x1  xn )  y1
y1
 a1 
( x1  x0 )( x1  x2 )( x1  xn )

Preceding in this way we get an as


pn ( xn )  an ( xn  x0 )( xn  x1 )( xn  xn 1 )  y n
yn
 an 
( xn  x0 )( xn  x1 )( xn  xn 1 )

Substituting these values of ai ' s in (7)


( x  x1 )( x  x2 ) ( x  x n ) ( x  x0 )( x  x 2 ) ( x  xn )
p n ( x)  y0  y1
( x0  x1 )( x0  x2 ) ( x0  xn ) ( x1  x0 )( x1  x2 ) ( x1  xn )
( x  x0 )( x  x1 )  ( x  xn1 ) (8) is the
 yn (8)
( xn  x0 )( xn  x1 )  ( xn  x n1 )

called Lagrange’s interpolation formula.


Example: - Use the following table of values to find log10 656 and log10 660 using
Lagrange’s

X 654 658 659 661


x 2.8156 2.8182 2.8189 2.8202
log10

Solution: -

23
See that the arguments are not equally spaced.
( x  x1 )( x  x 2 )( x  x3 ) ( x  x0 )( x  x 2 )( x  x3 )
log10 656  y0  y1
( x0  x1 )( x0  x 2 )( x0  x3 ) ( x1  x0 )( x1  x 2 )( x1  x3 )
( x  x0 )( x  x1 )( x  x3 ) ( x  x0 )( x  x1 )( x  x 2 )
 y2  y3  2.8168
( x 2  x0 )( x 2  x1 )( x 2  x3 ) ( x3  x0 )( x3  x1 )( x3  x 2 )
log10 660  2.81957
Exercise: -
1. Use Lagrange’s interpolation formula to find f (6) and f (11)
x 2 5 7 10 12
f (x )
18 180 448 1210 2028
Answer: f(6) = 294 and f(11) = 1584
2. Find the Lagrange’s polynomial that passes through the points (0, 1), (1, 3) and (3, 2).
5 2 17
Answer : f  x    x  x 1
6 6

Newton’s Divided Difference Interpolation Formula


The Newton’s Divided Difference Interpolation Formula can also be applied whether
the values of xi are equally spaced or not. The Lagrange’s formula has the drawback
that if another interpolation value were inserted, then the interpolation coefficients are
required to be recalculated. This labor of re computing the interpolation coefficients is
saved by using Newton’s Divided Difference Interpolation Formula. Before deriving,g
this formula, we shall first define an operator called The Divided Difference Operator.

Given the tabulated data

x x0 x1 x2 x3 …………. xn
y=f(x) y0 y1 y2 y3 …………. yn

Then the first divided difference for the arguments x 0 and x1 is defined by the relation
y  y0
[ x 0 , x1 ]  1
x1  x 0
Similarly
y  y1 y  y1 y  y n 1
[ x1 , x 2 ]  2 , [ x 2 , x3 ]  3 , . . . , [ x n 1 , x n ]  n
x 2  x1 x3  x 2 x n  x n 1
Then the second divided difference for the arguments x 0 , x1 and x 2 is defined by the
relation

24
[ x1 , x 2 ]  [ x 0 , x1 ]
[ x 0 , x1 , x 2 ]  ,
x2  x0
[ x 2 , x3 ]  [ x1 , x 2 ] [ x3 , x 4 ]  [ x 2 , x 3 ]
Similarly , [ x1 , x 2 , x3 ]  , [ x 2 , x3 , x 4 ]  etc.
x3  x1 x4  x2

Then the third divided difference for the arguments x0 , x1 , x 2 and x3 is defined by
the relation
[ x1 , x2 , x3 ]  [ x0 , x1 , x2 ]
[ x0 , x1 , x2 , x3 ] 
x3  x0
[ x 2 , x3 , x 4 ]  [ x1 , x 2 , x3 ]
Similarly , [ x1 , x 2 , x3 , x 4 ]  ,
x 4  x1
and so on.
[ x , x , x ]  [ x 2 , x3 , x 4 ]
[ x 2 , x3 , x 4 , x5 ]  3 4 5 etc.
x5  x 2

Remarks: -

The divided differences are symmetrical in their arguments i.e. independent of the order
of the arguments for it is easy to write

y0 y1
[ x0 , x1 ]    [ x1 , x0 ]
x0  x1 x1  x0
y0 y1 y2
[ x0 , x1 , x 2 ]   
( x0  x1 )( x0  x 2 ) ( x1  x0 )( x1  x 2 ) ( x 2  x 0 )( x 2  x1 )
and so on.

Example: - Construct the forward difference table for the data below

x 5 7 11 13 17
y 150 392 1452 2366 5202

Solution: -
-----------------------------------------------------------------------------

x y D[1] D[2] D[3] D[4]


-----------------------------------------------------------------------------

5 150 121 24 1 0
7 392 265 32 1

25
11 1452 457 42
13 2366 709
17 5202
-----------------------------------------------------------------------------

Let y 0 , y1 , . . . , y n be the values of y  f (x) corresponding to the arguments


x 0 , x1 , . . . , x n . Then from the definition of divided differences, we have

y  y0
[ x , x0 ] 
x  x0
So that
y  y 0  ( x  x0 )[ x , x0 ] . . . (1)
[ x , x 0 ]  [ x 0 , x1 ]
Again [ x , x0 , x1 ] 
x  x1
Which gives
[ x , x 0 ]  [ x 0 , x1 ]  ( x  x1 )[ x , x 0 , x1 ]
Substituting this value of [ x , x 0 ] in (1), we get
y  y 0  ( x  x0 )[ x0 , x1 ]  ( x  x0 )( x  x1 )[ x , x 0 , x1 ] . . . ( 2)

[ x , x0 , x1 ]  [ x 0 , x1 , x 2 ]
Also [ x , x 0 , x1 , x 2 ] 
x  x2
Which gives
[ x , x0 , x1 ]  [ x0 , x1 , x 2 ]  ( x  x 2 )[ x , x0 , x1 , x 2 ]

Substituting this value of [ x , x 0 , x1 ] in (2), we get


y  y 0  ( x  x 0 )[ x 0 , x1 ]  ( x  x 0 )( x  x1 )[ x0 , x1 , x 2 ]  ( x  x 0 )( x  x1 )( x  x 2 )[ x , x0 , x1 , x 2 ]
Proceeding in this manner, we get

y  p n ( x)  y 0  ( x  x 0 )[ x 0 , x1 ]  ( x  x 0 )( x  x1 )[ x 0 , x1 , x 2 ]  ( x  x 0 )( x  x1 )( x  x 2 )[ x 0 , x1 , x 2 , x 3 ]
 . . .  ( x  x 0 )( x  x1 ) . . . ( x  x n 1 )[ x 0 , x1 , x 2 , . . . , x n ]
This is called Newton Divided Difference Interpolation Formula.

Example: - Given the data

x 5 7 11 13 17
Y=f(x) 150 392 1452 2366 5202

Evaluate f (9) and f (12)


Solution: -
Divided difference table
-----------------------------------------------------------------------------

26
x y D[1] D[2] D[3] D[4]
-----------------------------------------------------------------------------

5 150 121 24 1 0
7 392 265 32 1
11 1452 457 42
13 2366 709
17 5202
-----------------------------------------------------------------------------

y  p n ( x )  y 0  ( x  x 0 )[ x 0 , x1 ]  ( x  x 0 )( x  x1 )[ x 0 , x1 , x 2 ]  ( x  x 0 )( x  x1 )( x  x 2 )[ x 0 , x1 , x 2 , x 3 ]
 ( x  x 0 )( x  x1 )( x  x 2 )( x  x 3 )[ x 0 , x1 , x 2 , x 3 , x 4 ]
y (9)  810
y (12)  1872
y (15)  3600

Exercise: -
1. Find the Divided Difference Polynomial that passes through the points (-4, 1245),
(-1, 33), (0, 5), (2, 9) and (5, 1335).
Answer : f  x   3x 4  5 x 3  6 x 2  14 x  5

2. Use divided difference formula to find f (6) and f (11)


x 2 5 7 10 12
f (x ) 18 180 448 1210 2028

Answer: f(6) = 294 and f(11) = 1584

27
CHAPTER VI
Numerical Differentiation and Integration
Numerical Differentiation
Numerical differentiation is a process of computing derivatives of a function f (x) at
some desired values of x, when the function is defined by a set of tabulated data.
For this, we first replace the exact relation y  f (x) by the best interpolating formula
and then
dy
If the values of x are equidistant and is
dx
i. required near the beginning of the data we employ Newton’s forward formula
ii. required near the end of the data we employ Newton’s backward formula
If the values of x are not equidistant we use Lagrange’s formula as an interpolating
polynomial.
Derivative using Newton’s forward formula
u u (u  1) 2 u (u  1)(u  2) 3
y  y 0  y 0   y0   y0
1! 2! 3!
u(u  1)(u  2)(u  3) 4
  y 0  ....
4!
x  x0
where x  x0  uh  u 
h

dy dy du 1 dy
  
dx du dx h du
1 2u  1 2 3u 2  6u  2 3 4u 3  18u 2  22u  6 4 
 y 0   y0   y0   y 0  
h 2 3! 4! 

d2y 1  2 6u  6 3 12u 2  36u  22 4 


and 2
 2   y 0   y 0   y0  
dx h  3! 4! 

28
d 3x d 4x
Similarly we can proceed to obtain , ,...
dx 3 dx 4
dy d2y
If we want to find and at exactly x  x0  u  0
dx dx 2
dy 1 1 1 1 
 y0  2 y0  3 y0  4 y0  .......
dx x  x0 h  2 3 4 

d2y 1  2 11 4 5 
2
 2 
 y 0  3 y0   y0  5 y 0  .......
dx x  x0
h  12 6 

Derivative using Newton’s backward formula


u u (u  1) 2 u (u  1)(u  2) 3
y  y n  y n   yn   yn
1! 2! 3!
u (u  1)(u  2)(u  3) 4
  y n  ....
4!
xx
where x  x n  uh  u  n
h

dy dy du 1 dy
  
dx du dx h du
1 2u  1 2 3u 2  6u  2 3 4u 3  18u 2  22u  6 4 
 y n   yn   yn   y n  
h 2 3! 4! 

d2y 1  2 6u  6 3 12u 2  36u  22 4 


and 2
 2 
 y n   y 0   y 0  
dx h  3! 4! 

d 3x d 4x
Similarly we can proceed to obtain , ,...
dx 3 dx 4
dy d2y
If we want to find and at exactly x  x n  u  0
dx dx 2
dy 1 1 1 1 
 y n   2 y n   3 y n   4 y n  .......
dx x  x h 2 3 4 
n

d2y 1  2 11 4 5 
  yn  3 yn   y n   5 y n  .......
dx 2 x xn h 2  12 6 

dy d2y
Example: - Evaluate and at x  1.2 , x  2 & x  2.2 from the following
dx dx 2
table.

x 1.0 1.2 1.4 1.6 1.8 2.0 2.2


y 2.7183 3.3201 4.0552 4.9530 6.0496 7.3891 9.0250

29
Solution: - Forming the difference table

x y Dy D2y D3 y D4 y D5 y D6 y
1 2.7183
0.6018
1.2 3.3201 0.1333
0.7351 0.0294
1.4 4.0552 0.1627 0.0067
0.8978 0.0361 0.0013
1.6 4.953 0.1988 0.008 0.0001
1.0966 0.0441 0.0014
1.8 6.0496 0.2429 0.0095
1.3395 0.0535
2 7.3891 0.2964
1.6359
2.2 9.025
x y Vy V2y V3 y V4 y V5 y V6 y

dy 1 1 1 1 1 
 y 0  2 y 0  3 y 0  4 y 0  5 y 0   3.32032
dx x1.2 h  2 3 4 5 

dy 1 1 1 1 
 y5   2 y5   3 y5   4 y5   5 y   7.3895
dx x2 h  2 3 4 5 

dy 1 1 1 1 
 y 6   2 y 6   3 y6   4 y 6   5 y   6 y   9.8562
dx x2.2 h  2 3 4 6 6

Exercise: -
1. Given that

x 1.0 1.1 1.2 1.3 1.4 1.5 1.6


y 7.989 8.404 8.781 9.129 9.451 9.750 10.031

dy d2y
find the values of and at x  1.1 , 1.6 and 1.5
dx dx 2
2. Find the first and the second derivatives of the function tabulated below at the
points x  1.1 and 1.9

x 1.0 1.2 1.4 1.6 1.8 2.0


y 0.000 0.128 0.544 1.296 2.432 4.000

30
3. A slider machine moves along a fixed straight rod. Its distance y cm. along the
rod is given below for various values of the time t seconds. Find the velocity and
acceleration of the slider when t  0.1 , 0.5 and 0.6 seconds.

t 0.0 0.1 0.2 0.3 0.4 0.5 0.6


y 30.13 31.62 32.87 33.64 33.95 33.81 33.24

Numerical Integration
The process of integrating a definite integral from a set of tabulated values of the
integrand f(x) is called Numerical Integration. This process when applied to a function
of one variable is called Quadrature formula. In particular, this process can be used for
those definite integrals that have no explicit antiderivative or whose antidervative is not
easy to obtain.
6 1 2
e x sin x cos( x  3)
 e dx ,  cos( x )dx ,  ln x tan( x  3) dx , etc.
2
x 2
Like,
0 0 1

31
To apply numerical integration, we first represent f(x) by interpolation formula, for this
case we use Newton Forward Difference Interpolation Formula.

2 y 0 3 y 0 n y 0
f ( x)  y 0  uy 0  u (u  1)  u (u  1)(u  2)  ........u (u  1)(u  2)....(u  (n  1))
2! 3! n!
x  x0
where u 
h
b

Let I   f ( x) dx
a

Dividing the interval [a, b] into n subintervals of width h we form the following table

x x0 x1 x2 x3 …………. xn
y=f(x) y0 y1 y2 y3 …………. yn

Where xi  x 0  ih , i  0, 1, 2, 3, 4, ...........

Trapezoidal Rule
b

To approximate  f ( x)dx
a
using this rule, we first divide [a, b] into subintervals of step

size h with xi  x 0  ih , i  0, 1, 2, 3, 4, ........... and form the table of values as


follow

x x0 x1 x2 x3 …………. xn
y=f(x) y0 y1 y2 y3 …………. yn

For each interval [xi, xi+1] i=0, 1, 2, 3…, we approximate f(x) by a linear forward
difference interpolation formula
y

f(x)

…………

x
a=x0 x1 x2 x3 x4 xn-1 xn

32
b xn x1 x2 x3 xn


a
f ( x) dx  
x0
f ( x) dx  
x0
f ( x) dx  
x1
f ( x) dx  
x2
f ( x) dx  .....   f ( x)dx
xn 1
...... (1)

x1

To evaluate  f ( x)dx
x0

x  x0  uh  dx  hdu
x  x0  u  0 and x  x1  x 0  h  u  1
x1 1
1
 u2   1  h

x0
f ( x) dx  h  ( y 0  uy 0 ) du  h  y 0 u  y 0
0 
 h  y 0  y 0   [ y 0  y1 ]
2 0  2  2
x1
h
 f ( x)dx  2 [ y
x
0  y1 ] .................... ( 2)
0
To evaluate
x2

 f ( x)dx
x1

x  x1  uh  dx  hdu
x  x1  u  0 and x  x 2  u  1
x2 1
1
 u2   1  h
x f ( x ) dx  h 0 1
( y  u y1 ) du  h y
 1

u  y1  h  y1  y1   [ y1  y 2 ]
2 0  2  2
1
x2
h
 f ( x)dx  2 [ y
x
1  y2 ] .................... (3)
1
Similarly

x3
h
 f ( x)dx  2 [ y
x2
2  y3 ] .................... (4)

x4
h
 f ( x)dx  2 [ y
x3
3  y4 ] .................... (5)

.
.
.
xn
h
x
 f ( x ) dx 
2
[ y n 1  y n ] ..............
n 1

Substituting the results of (2), (3), (4)…, into (1) we get

33
b xn
h

a
f ( x)dx   f ( x)dx  2 [( y
x
0  y n )  2( y1  y 2  y3  .....  y n 1 )
0
And this is known as Trapezoidal Rule. This formula gives exact value if f(x) is a
polynomial function of degree at most 1.

Simpson’s 1/3 Rule


b

To approximate  f ( x)dx
a
using this rule subdivide [a, b] into an even number of

equally space subintervals.

x x0 x1 x2 x3 x4 …………. xn-2 xn-1 xn


y=f(x) y0 y1 y2 y3 y4 …………. yn-2 yn-1 yn

f(x)

..………..

x
a=x0 x2 x4 xn-2 b= xn

For each interval [x2i, x2i+2], i = 0, 1, 2…, we approximate f(x) by a quadratic Newton
Forward Difference Interpolating Polynomial.

For this

b xn x2 x4 x6 xn


a
f ( x )dx  
x0
f ( x)dx  
x0
f ( x)dx  
x2
f ( x )dx  
x4
f ( x)dx  ......   f ( x)dx
xn  2
...... (1)

x2

To evaluate  f ( x)dx
x0

x  x 0  uh  dx  hdu
x  x 0  u  0 and x  x 2  u  2

34
x2 2
u (u  1) 2 h

x
f ( x) dx  h  ( y 0  uy 0 
0
2!
 y 0 )du  [ y 0  4 y1  y 2 ]
3
........ ( 2)
0
x4

To evaluate  f ( x)dx
x2

x  x 2  uh  dx  hdu
x  x 2  u  0 and x  x 4  u  2
x4 2
u (u  1) 2 h

x
f ( x) dx  h  ( y 2  uy 2 
0
2!
 y 2 ) du  [ y 2  4 y 3  y 4 ]
3
........ (3)
2

Similarly
x6
h
 f ( x)dx  3 [ y
x
4  4 y5  y6 ] .......... .... ( 4)
4
.
.
xn
h
x
 f ( x)dx  3 [ y n2  4 y n 1  y n ]
n2

Substituting the results of (2), (3), (4)…, in (1) we get

b xn
h

a
f ( x)dx   f ( x)dx  3 [( y
x
0  y n )  4( y1  y3  .....  y n 1 )  2( y 2  y 4  .....  y n  2 )
0
and this is Simpson' s 1 / 3 Rule
Note: - This rule requires the division of [a, b] in to an even number of subintervals of
width h and this formula gives exact value if f(x) is a polynomial function of degree at
most 2.

Simpson’s 3/8 Rule


b

To approximate  f ( x)dx
a
using this rule subdivide [a, b] into equal subintervals of

number multiple of 3.

x x0 x1 x2 x3 x4 x5 x6 …………. xn-3 xn-2 xn-1 xn


y=f(x) y0 y1 y2 y3 y4 y5 y6 …………. yn-3 yn-2 yn-1 yn

35
y

f(x)

..………..

x
a=x0 x3 x6 xn-3 b= xn

For each interval [x3i, x3i+3], i = 0, 1, 2…, we approximate f(x) by Newton Forward
Difference Interpolating Polynomial of degree 3.

For this
b xn x3 x6 x9 xn


a
f ( x ) dx  
x0
f ( x ) dx  
x0
f ( x ) dx  
x3
f ( x) dx  
x6
f ( x ) dx  ......   f ( x)dx
xn 3
...... (1)

x3

To evaluate
x0
 f ( x)dx
x  x0  uh  dx  hdu
x  x0  u  0 and x  x3  u  3
x3 3
u (u  1) 2 u (u  1)(u  2) 3 3

x
f ( x) dx  h  ( y 0  uy 0 
0
2!
 y0 
3!
 y 0 )du  h[ y 0  3 y1  3 y 2  y 3 ] ........ ( 2)
8
0
x6

To evaluate
x3
 f ( x)dx
x  x3  uh  dx  hdu
x  x3  u  0 and x  x6  u  3
x6 3
u (u  1) 2 u (u  1)(u  3) 3 3

x
f ( x) dx  h  ( y 3  uy 3 
0
2!
 y3 
3!
 y 3 )du  h[ y 3  3 y 4  3 y 5  y 6 ]........ (3)
8
3
Similarly
x6
3
 f ( x)dx  8 h[ y
x
6  3 y 7  3 y 8  y 9 ] .......... ... ( 4)
3
.
.
.

36
xn
3
x
 f ( x)dx  8 h[ y n 3  3 y n  2  3 y n 1  y n ] .............
n 3

Substituting the results of (2), (3), (4)…, in (1) we get

b xn


a
f ( x)dx   f ( x)dx
x0

3h

[( y0  y n )  3( y1  y 2  y 4  y5  .....  y n 2  y n1 )  2( y3  y6  .....  y n3 )
8
and this is Simpson' s 3 / 8 Rule
Note: - While applying Simpson’s 3/8 rule the number of subintervals should be taken as
multiple of 3 and this formula give exact value if f(x) is a polynomial function of degree
at most 3.

Remark: - In every rule accuracy could be increased by decreasing the step size h.

6
dx
Example: - By considering six subintervals evaluate  2 , using
0 1 x

a. Trapezoidal rule
b. Simpson’s 1/3 rule
c. Simpson’s 3/8 rule

60 1
Solution: - Dividing [0, 6] into 6 subintervals means h   1 . And f ( x ) 
6 1 x2
x 0 1 2 3 4 5 6
y = f(x) 1 0.5 0.2 0.1 0.0588 0.0385 0.027

6
dx h
a.  1 x
0
2

2
[( y 0  y 6 )  2( y1  y 2  y 3  y 4  y 5 )]  1.4108

6
dx h
b.  1 x
0
2

3
[( y 0  y 6 )  4( y1  y 3  y 5 )  2( y 2  y 4 )  1.3662

6
dx 3h
c. 1 x
0
2

8
[( y 0  y 6 )  3( y1  y 2  y 4  y 5 )  2( y 3 )  1.3571

And from the following table we can see that accuracy in each method increases as h
decrease.
6
dx
Exact solution of  1 x
0
2
 [tan 1 x]60  tan 1 6  1.40564765

n h Trapezoidal Simpson’s 1/3 Simpson’s 3/8


6 1 1.41079867 1.3661735 1.3570808

37
12 0.5 1.40547621 1.403702 1.3996111
24 0.25 1.40560222 1.4056442 1.4055574
48 0.125 1.40563631 1.4056478 1.4056478

1
dx
Example: - Evaluate 1 x
0
using Simpson’s 1/3 rule for h = 0.25.

Solution: -
x 0 0.25 0.50 0.75 1.00
y = f(x) 1 0.8 0.6667 0.5714 0.5

1
dx h
 1  x  3 [( y
0
0  y 4 )  4( y1  y 3 )  2 y 2  0.69325399

And from the following table we can see that accuracy in each method increases as h
decrease.
1
dx
 1  x  [ln(1  x)]  ln 2  0.693147181
1
Exact solution of 0
0

n h Trapezoidal Simpson’s 1/3 Simpson’s 3/8


3 1/3 0.699999 0.69374996
4 0.25 0.697023809 0.69325399
5 0.2 0.69563496
6 1/6 0.69487738 0.69316983 0.69319534
12 1/12 0.693580866 0.69314873 0.69315046
24 1/24 0.69325578 0.69314724 0.69314742
48 1/48 0.693174362 0.69314718 0.6931473

Exercise: -
6

e
 x2
1. Evaluate dx using Simpson’s 1/3 rule for h = 1.
0
2

x
3
2. Evaluate cos x 2 dx for h = 0.5 using
1
a. Trapezoidal rule
b. Simpson’s 1/3 rule
c. Simpson’s 3/8 rule.

38

You might also like