SM 3
SM 3
(Programme); Part-III
I. Discipline Course
II. Mathematics
Introduction
The subject of numerical analysis deals with solving problems through numerical
computation. Numerical methods are useful to solve problems when the analytical methods
either fail to provide any solution or they become tedious to apply. Numerical methods
usually provide approximate solutions which can be made as accurate as desired. Use of
computers for numerical computations saves time and man power cost. Thus, the advent of
Computers has made numerical analysis an important area of study.
LESSON 1
1.1. Introduction
In numerical analysis a common problems is to find the roots of non-linear equations of the form f(x) = 0,
where f(x) is a polynomial or a transcendental function. Usually such equations are solved by numerical
method involving successing approximations.
y
y
(a0, f(a0))
(b0, f(b0))
x1 a0 x1 b0
x x
0 a0 x2 b0 0 x2
(a0, f(a0))
(b0, f(b0))
3
log (b0 − a0 ) − log ∈
i.e., n≥ log 2 ...(1.2)
Example 1. Using the bisection method determine a real root of the equation x3 – x2 – x – 3 = 0 to there
decimal places.
Solution. Let f(x) = x3 – x2 – x – 3.
Since f(2) < 0 and f(3) > 0, a root of the equation f(x) = 0 lies in the interval (2, 3).
Taking a0 = 2, b0 = 3 and using the bisection method, we obtain
2+3
x1 = = 2.5
2
The root now lies in the interval (2, 2.5) as f(2) < 0 and f(2.5) > 0.
2 + 2.5
∴ x2 = = 2.25
2
The process is repeated and the successive appoximations are obtained as in the following table.
ak −1 + bk − 1
k ak–1 bk–1 xk = f(xk)
2
1 2 3 2.5 >0
2 2 2.5 2.25 >0
3 2 2.25 2.125 <0
4 2.125 2.25 2.1875 >0
5 2.125 2.1875 2.1563 >0
6 2.125 2.1563 2.1407 >0
7 2.125 2.1407 2.1329 >0
8 2.125 2.1329 2.129 <0
9 2.129 2.1329 2.131 >0
10 2.129 2.131 2.130 <0
11 2.130 2.131 2.1305 >0
Thus, the root to three decimal places is 2.130 and eleven iterations were required to obtain it.
Example 2. Calculate 261/3 to two decimal places in the interval (2, 3), using the bisection method.
Also, determine the minimum number of iteration-steps required to obtain the result to three decimal places.
Solution. Let x = 261/3
⇒ x3 – 26 = 0
we take f(x) = x3 –26
4
Since f(2) < 0 and f(3) > 0, a root of the equation f(x) = 0 lies in the interval (2, 3). Using the bisection
method, we obtain
2+3
x1 = = 2.5 .
2
Since f(2.5) < 0, the root lies in (2.5, 3)
2.5 + 3
∴ x2 = = 2.75 .
2
Repeating the process we obtain the successive approximations as shown in the following table.
ak −1 + bk − 1
k ak–1 bk–1 xk = f(xk)
2
1 2 3 2.5 <0
2 2.5 3 2.75 <0
3 2.75 3 2.875 <0
4 2.875 3 2.9375 <0
5 2.9375 3 2.9687 >0
6 2.9375 2.9687 2.9531 <0
7 2.9531 2.9687 2.9609 <0
8 2.9609 2.9687 2.9648 >0
3−2
≤ 5 × 10–4
2n
104
⇒ 2n ≥
5
4 − log10 5
⇒ n ≥ log10 2
⇒ n ≥ 10.965
∴ The minimum no. of iteration steps = 11.
5
Let the tangent line intersects the x – axis at the point (x1, 0), then
0 – f(x0) = f ′(x0) (x1 – x0)
f ( x0 )
⇒ x1 = x0 − ...(1.4)
f ′( x0 )
We take x1 as the new approximation to the root. Next, we consider the tangent line to the curve at the
point (x1, f(x1)) and the process is repeated.
Thus, if xi is the ith approximate to the root, then the (i + 1)th approximation xi + 1 is given by
f ( xi )
xi + 1 = xi − , i = 0, 1, 2..... ...(1.5)
f ′( xi )
The iteration formula (1.5) is known as the Newton–Raphson iteration formula or the tangent formula.
(x0, f(x0))
(x1 , f(x1 ))
α
x
0 x2 x1 x0
Fig. 1.3
Aliter. The Newton-Raphson iteration formula can also he obtained analytically. Let xi be the ith
approximation of the root α of the equation f(x) = 0 in the interval I = (a, b), where f(x) is twice continuously
differentiable and f ′(x) ≠ 0 for x ∈ I. By using the Taylor’s theorem (see Appendix), we obtain.
1
0 = f(α) = f(xi) + (α – xi) f ′(xi) + (α – xi)2 f’″(ζi) ...(1.6)
2
Where ζi lies between xi and α. Neglecting the second degree term in α – xi, we obtain
f(xi) + (α –xi) f ′(xi) ≈ 0
f ( xi )
⇒ α ≈ xi − ...(1.7)
f ′( xi )
6
This gives the iteration formula
f ( xi )
xi + 1 = xi − , i = 0, 1, 2,... ...(1.8)
f ′( xi )
Example 3. Determine a real root of the equation x – e–x = 0, to there decimal places, using the Newton
Raphson method.
Solution. The given equation is
f (x) = x – e–x = 0
∴ f ′(x) = 1 + e–x
1 1
Since f(0) = –1 < 0 and f(1) = 1 – =1− = 0.632 > 0,
e 2.7182
The given equation has a root in the interval (0, 1) and 1 is nearer to the root than 0.
Taking x0 = 1 and using the Newton – Raphson iteration formula (1.5), we obtain.
− xi
xi − e
xi + 1 = xi − − xi
, i = 0, 1, 2....
1+ e
xi + 1
⇒ xi + 1 = , i = 0, 1, 2, ...
e xi + 1
x0 + 1 2
∴ x1 = x0
=
e +1 e+1
or x1 = 0.5379
x +1
x2 = x1
e 1 +1
1.5379
=
e0.537 + 1
⇒ x2 = 0.5670
Similarly, x3 = 0.5671
Hence, the root to three decimal places is 0.567
Example 4. Find an iterative formula based on the Newton-Raphson method for finding N , where N
is a positive real number. Hence calculate 18 .
Solution. Let x = N
⇒ x2 – N = 0
7
Taking f(x) = x2 – N, f ′(x) = 2x and applying the Newton-Raphson iteration formula (1.5), we obtain
xi2 − N
xi + 1 = xi − , i = 0, 1, 2 ,...
2 xi
xi2 + N
⇒ xi + 1 =
2 xi
1 N
or, xi + 1 = xi + , i = 0, 1, 2,...., ...(1)
2 xi
To calculate 18 , we have N = 18. Taking x0 = 4 and using the iteration formula (1), we obtain
1 N
x1 = x0 +
2 x0
1 18
= 4 +
2 4
∴ x1 = 4.25
1 18
x2 = 4.25 +
2 4.25
= 4.2426
1 18
x3 = 4.2426 +
2 4.2426
= 4.2426
∴ 18 ≈ 4.2426
en +1
lim = C, ...(1.9)
n→∞ e p
n
Where en is the error in the the nth approximation of the root and C is a positive constant.
8
The consent C is called the asymptotic error constant. Thus, for an iterative method with rate of
convergence p, the error at the (n + 1)th step is approximately proportional to the pth power of the error at
the nth step. That is
p
en +1 ≈ C en ...(1.10)
Rate of Convergence of the Newton – Raphson Method. Let α be a real root of the equation f(x) = 0
and xi = α + ei be the ith iterate (approximation) of the root α. From Newton- Raphson iteration formula, we
have
f ( xi )
xi+1 = xi − , i = 0, 1, 2, ... ...(1.11)
f ′( xi )
Substituting xi = α + ei, i = 0, 1, 2,..., in the above formula, we obtain
f (α + ei )
α + ei + 1 = α + ei −
f ′(α + ei )
Using the Taylor’s series (see Appendix) for f(α + ei) and f ′(α + ei), we obtain
ei2
f (α ) + ei f ′(α ) + f ′′(α ) + ...
2
ei +1 = ei −
ei2
f ′(α ) + ei f "(α ) + f ′′′ (α ) + ...
2
1
M1ei2 + ...
ei +
2
= ei − 1
,
2
1 + M1ei + M 2 ei + ...
2
f ′′(α )
where M1 = , M2 = f ′′′(α ) , f (α ) = 0, and f ′(α) ≠ 0
′
f (α ) f ′(α )
−1
1 2 1 2
⇒ ei + 1 = ei − ei + M1ei + ... 1 + M1e1 + M 2 ei + ...
2 2
1 2
= ei − ei + M1ei + ... [1 – M1ei + ...]
2
1 2
= ei − ei − M1ei + ...
2
1
∴ ei + 1 ≈ M1ei2
2
2 1
i.e., |ei + 1| ≈ C ei , C = M1
where
2
Hence, the rate of convergence of the Newton-Raphson method is 2.
9
Example 5. Determine the rate of convergence of the iterative method
x0 f ( xn ) − xn f ( x0 )
xn + 1 = , n ≥1,
f ( xn ) − f ( x0 )
to obtain a root of the equation f(x) = 0
Solution. Let α be the root of the equation f(x) = 0 and xn = α + en be the nth approximation of α. We
have
x0 f ( xn ) − xn f ( x0 )
xn + 1 = , n ≥1 ...(1)
f ( xn ) − f ( x0 )
( xn − x0 ) f ( xn )
or, xn + 1 = xn − , n ≥ 1.
f ( xn ) − f ( x0 )
(α + en − α − e0 ) f (α + en )
⇒ α + en + 1 = α + en − f (α + en ) − f (α + e0 )
(en − e0 ) f (α + en )
⇒ en + 1 = en − f (α + e ) − f (α + e ) , n ≥ 1. ...(2)
n 0
Expanding f(α + en) and f(α + eo) in Taylor’s series we obtain from (2)
e2
(en − e0 ) f (α ) + en f ′(α) + n f ′′(α) + ....
2
en + 1 = en −
en2
e02
f ( α ) + en f ′( α ) + f ′′( α ) + .... −
f ( α ) + e0 f ′( α ) + f ′′(α) + ....
2 2
e2
(en − eo ) en f ′(α) + n f ′′(α) + ....
2 ,
= en − 2 2
as f(α) = 0
e − eo
(en − eo ) f ′(α) + n f ′′(α) + ....
2
−1
2 f ′′(α ) f "(α)
⇒ en + 1 = en − en + en ′
+ .... 1 + (en + eo ) + ....
2 f ( α ) 2 f '(α)
2 f ′′(α ) f ′′(α)
= en − en + en + .... 1 − (en + eo ) 2 f ′(α) + ....
2 f ′(α)
f ′′(α)
⇒ en + 1 ≈ e0 en , f ′(α) ≠ 0
2 f ′(α)
or en + 1 ≈ C en , ...(3)
f ′′(α)
Where C = e0
2 f ′(α)
Hence, the iteration method has linear rate of convergence.
10
EXERCISES
1. Use the bisection method to determine a real root of the equation x3 + x2 + x + 7 = 0, to two decimal
places.
2. A root of the equation x4 – x3 – 2x2 –6x – 4 = 0 lies in the interval (2, 3). Using the bisection method,
(i) determine the root to two decimal places.
(ii) determine the minimum number of iterations required to obtain the root to three decimal places.
3. Determine a positive root α of the equation f(x) = x4 – x – 10 = 0, such that f (α) < 0.1, using the
bisection method.
4. Use the Newton-Raphson method to determine a real root of each of the following equations to
three decimal places:
(i) x4 – x – 10 = 0
(ii) x sinx + cosx = 0
(iii) ex = 2x + 1
5. By using the Newton-Raphson method, obtain the iteration formula
xk +1 = xk(2 – Nxk), k = 0, 1, 2, ...,
for finding the reciprocal of N > 0. Hence find 1/18.
6. By using the Newton-Raphson method, obtain the iteration formula
1 N
xk + 1 = 2 xk + 2 , k = 0,1, 2, ...,
3 xk
1 xn2
xn + 1 = xn 3 − , n ≥ 0,
2 a
for finding a.
ANSWERS
11
LESSON 2
2.1. Introduction
Consider the system of n linear equations in n unknowns x1, x2, ....., xn:
a11 x1 + a12 x2 + ... + a1n xn = b1
a21 x1 + a22 x2 + ... + a2n xn = b2
.
. ...(2.1)
.
an1x1 + an2x2 + ... + ann xn = bn
In matrix notation this system of equations may be written as
AX = B, ...(2.2)
Where
A = (aij)n×n
x1 b1
x b
2 2
. .
X = and B =
. .
. .
xn bn
The matrix A is called the coefficient matrix. The column vector X represents the solution set {x1, x2, ...,
xn} which is to be determined and the column vector B represents the known values on the right side of the
system (2.1).
The methods to solve the system of linear equations (2.1) may be classified into two types.
(i) Direct methods. These methods give the exact solution after a finite number of steps.
(ii) Iterative methods. These methods yield a sequence of approximate solutions, which converge to
the exact solution after large number of iterations.
12
2.2. Direct Methods
Cramer’s rule, matrix inversion method, Gauss elimination method, Gause-Jordan method,
triangularization method and Cholesky method are some of the commonly used direct methods. In all these
methods the coefficient matrix A is taken as a non singular matrix, i.e., det (A) ≠ 0. This condition is required
as the solution should be unique.
13
Example 6. Solve the following system of equations using the Gaussian elimination method:
x1 + x2 + x3 = 3
2x1 + 3x2 + x3 = 6
x1 – x2 + 2x3 = –3
Solution. The given equations are
x1 + x2 + x3 = 3
2x1 + 3x2 + x3 = 6
x1 – x2 + 2x3 = –3
At the first stage of elimination, we eliminate x1 from the second equation and the third equation. For
this, we multiply the first equation successively by m21 = 2 and m31 = 1 and subtract it from the second and
third equations respectively. We obtain the new system of equations :
x1 + x2 + x3 = 3
x2 – x3 = 0
– 2x2 + x3 = –6
At the second stage of elimination, we eliminate x2 from the third equation of the above system by
multiplying the second equation by m32 = –2 and subtracting it from the third equation. The resulting system
is obtained in the form:
x1 + x2 + x3 = 3
x2 – x3 = 0
–x3 = –6
Using back substitution, we obtain the solution
x1 = –9, x2 = 6, x3 = 6
Aliter: In the matrix notation the given system of equations may be written as
AX = B,
1 1 1
where A = 2 3 1
1 −1 2
x1 3
6
X = x2 and B =
x3 −3
1 1 1 3
[A|B] = 2 3 1 6
1 −1 2 −3
14
1 1 1 3 using the row operations
R 2 → R 2 − 2R1 ,
~ 0 1 −1 0 ,
0 −2 1 −6 R 3 → R 3 − R1 .
1 1 1 3
~ 0 1 −1 0 , using R 3 → R 3 − (−2) R 2 .
0 0 −1 −6
15
At the first step, we eliminate x from the second equation and the third equation, for this, we multiply
the first equation successively by the factors 3 and 2 and subtract it from the second and third equation
respectively. The resulting system of equations is abtained in the form :
x+ y + z = 6
oy + z = 2
–y+z =1
Here, the pivot element in the second equation is 0. Therefore, partial pivoting is useful in this case.
Interchanging the second equation and the third equation, we obtain the upper triangular system
x+ y + z = 6
–y + z = 1
z =2
Back substitution now gives the solution
x =3, y = 1 and z = 2.
Example 8. Solve the folowing equations using the Gaussian elimination method with scaling and
partial pivoting :
3x1 + 2x2 + 100x3 = 105
–x1 + 3x2 + 100x3 = 102
x1 + 2x2 – x3 = 2
Solution. The given equations are
3x1 + 2x2 + 100x3 = 105
–x1 + 3x2 + 100x3 = 102
x1 + 2x2 – x3 = 2
In the first equation and second equation the coefficient of x3 is large in magnitude as compared to the
other coefficients in the equation. Therefore, scaling is beneficial in this case.
For this purpose, we divide the first and the second equation by 100 and the third equation by 2. we
obtain
0.03x1 + 0.02x2 + 1.00x3 = 1.05
–0.01x1 + 0.03x2 + 1.00x3 = 1.02
0.50x1 + 1.00x2 – 0.50x3 = 1.00
Consider the augmented matrix
16
0.50 1.00 −0.50 1.00
[A|B] ~ −0.01 0.03 1.00 1.02
0.03 0.02 1.00 1.05
1 b
x1 = − (a12 x2 + a13 x3 + .... + a1n xn ) + 1
a11 a11
1 b
x2 = − ( a21 x1 + a23 x3 + .... + a2 n xn ) + 2
a22 a22
.
.
.
17
xn = − 1 ( an1 x1 + an 2 x2 + .... + an n − 1 xn − 1 ) + bn , ...(2.7)
ann ann
where the diagonal elements aii are non-zero pivotes.
The Jacobi iteration scheme is now defined as
1 b
x1( k + 1) = − (a12 x2( k ) + a13 x3( k ) + .... + a1n xn( k ) ) + 1
a11 a11
1 b
x2( k + 1) = − (a21 x1( k ) + a23 x3( k ) + .... + a2 n xn( k ) ) + 2
a22 a22
.
.
.
1 b
xn( k + 1) = − (an1 x1( k ) + an 2 x2( k ) + .... + an n − 1 xn( k−)1 ) + n ,
ann ann
k = 0, 1, 2, ..... ...(2.8)
In the matrix notation the Jacobi iteration scheme becomes
18
1
x3 = [3 − x1 − x2 ]
3
Now, applying the Jacobi iteration method, we obtain
1
x1( k + 1) = [4 − x2( k ) − 2 x3( k ) ]
4
1
x2( k + 1) = [7 − 3x1( k ) − x3( k ) ]
5
1
x3( k + 1) = [3 − x1( k ) − x2( k ) ] , k = 0,1, 2, .....
3
Starting with the initial vector
x1(0) 0
(0)
X (0) = x2 = 0 ,
(0) 0
x3
1
x1(1) = [4 − x2(0) − 2 x3(0) ] = 1
4
1 7
x2(1) = [7 − 3x1(0) − x3(0) ] =
5 5
1
x3(1) = [3 − x1(0) − x2(0) ] = 1
3
1
(1)
∴ X = 1.4
1
1 1
x1(2) = [4 − x2(1) − 2 x3(1) ] = [4 − 1.4 − 2] = 0.15
4 4
1 1
x2(2) = [7 − 3x1(0) − x3(0) ] = [7 − 3 − 1] = 0.6
5 5
1 1
x3(2) = [3 − x1(0) − x2(0) ] = [3 − 1 − 1.4] = 0.2
3 3
19
0.15
0.6
∴ X(2) =
0.2
1
x1(3) = [4 − 0.6 − 2(0.2)] = 0.75
4
1
x2(3) = [7 − 3(0.15) − 0.2] = 1.27
5
1
x3(3) = [3 − 0.15 − 0.6] = 0.75
3
0.75
1.27
∴ X(3) = .
0.75
4 1 2
A = 3 5 1
1 1 3
=L+D+U
where
0 0 0 4 0 0 0 1 2
3 0 0 0 5 0 0 0 1
L = ,D= , U =
1 1 0 0 0 3 0 0 0
14 0 0 0 1 2 0 1
4
1
2
0 3 0 1 3
H = –D–1(L + U) = − 0 1
5 = − 5 0 1
5
0 0 1
3 1 1 0 1 3 1
3 0
20
14 0 0 4 1
0 1 0 7 7 5
= 5 =
0 0 1 3 1
3
0 1
4
1
2 1
X ( k ) + 7 , k = 0,1, 2, ....
= − 35 0 1
5 5
1 3 1
3 0 1
0 1
4
1
2 0 1
X (1)
= − 35 0 1 0 + 7
5 5
3 0 0 1
1 1
3
1
= 1.4
1
0 1
4
1
2 1 1
(2) 1.4 + 7
X = − 35 0 1
5 5
3 0 1 1
1 1
3
0.15
= 0.6
0.2
0 1
4
1
2 0.15 1
(3) 0.6 + 7
X = − 35 0 1
5 5
1 3 1
3 0 0.2 1
0.75
= 1.27
0.75
21
2.3.2. Gauss-Seidel Iteration Method (Method of Successive Displacenents)
In this method we use the value of xi( k + 1) as soon as it has been calculated in the computation of all
the subsequent components of the vector X(k + 1) rather than waiting until the next iteration as done in the
Jacobi iteration method. We write the Gauss-Seidel itration scheme for the system of equations (2.1) or
(2.7) in the form
1 b
x1( k + 1) = − (a12 x2( k ) + a13 x3( k ) + .... + a1n xn( k ) ) + 1
a11 a11
1 b
x2( k + 1) = − (a21 x1( k + 1) + a23 x3( k ) + .... + a2 n xn( k ) ) + 2
a22 a22
.
.
.
1 b
xn( k + 1) = − (an1 x1( k + 1) + an 2 x2( k + 1) + .... + an n − 1 xn( k−1+ 1) ) + n ,
ann ann
k = 0, 1, 2, ..... ...(2.12)
For the matrix formulation, we rewrite the given system AX = B in the form
(L + D + U)X = B
or, (L + D)X = –UX + B
i.e., X = –(L + D)–1 UX + (L + D)–1B
This gives the scheme in the from
X(k + 1) = –(L + D)–1 UX(k)+ (L + D)–1B, k = 0, 1, 2,...
= HX(k) + C, k = 0, 1, 2,... ...(2.13)
–1 –1
Where the iteration matrix H = –(L + D) U and the column vector C = (L + D) B.
Example 10. Use the Gauss-Seidel iterative scheme for the solution of the following system of
equations
2x1 – x2 + 0x3 = 7
–x1 + 2x2 + x3 = 1
0x1 – x2 – 2x3 = 1
(0)
Starting with X = 0, perform three iteration.
Solution. We rewrite the equations as
1
x1 = [7 + x2 − 0 x3 ]
2
1
x2 = [1 + x1 + x3 ]
2
1
x3 = [1 − 0 x1 + x2 ]
2
22
Now, applying the Gauss-Seidel iterative scheme, we obtain
1
x1( k + 1) = [7 + x2( k ) − 0 x3( k ) ]
2
1
x2( k + 1) = [1 + x1( k + 1) + x3( k ) ]
2
1
x3( k + 1) = 1 − 0 x1( k + 1) + x2( k + 1) , k = 0,1, 2, .... ...(1)
2
0
X (0)
= 0
0
1 7
x1(1) = [7 + 0 − 0] =
2 2
1 7 9
x2(1) = 2 1 + 2 − 0 = 4
1 9 13
x3(1) = 2 1 − 0 + 4 = 8
7 2 3.5
9 = 2.25
∴ X(1) = 4
13 8 1.625
1
x1(2) = [7 + 2.25 − 0] = 4.625
2
1
x2(2) = [1 + 4.625 + 1.625] = 3.625
2
1
x3(2) = [1 − 0 + 3.625] = 2.3125
2
23
4.625
(2)
∴ X = 3.625
2.3125
5.3115
4.3125
X(3) =
2.6563
2 −1 0
A = −1 2 −1
0 −1 2
=L+D+U
where
0 0 0 2 0 0 0 −1 0
L = −1 0 0 , D =
0 2 0 , U =
0 0 −1
0 −1 0 0 0 2 0 0 0
2 0 0
L + D = −1 2 0
0 −1 2
12 0 0
–1 1 1 0
(L + D) = 4 2
18 1
4
1
2
12 0 0 0 −1 0
= − 14 1 0 0 0 −1
2
1 8 1
4
1 0
2 0 0
24
0 1
2 0
1 1
= 0 4 2
0 1
8
1
4
12 0 0 7 7 9
0 1 = 9 4
= 14 1
2
8
1 1
8
1 1 13
4 2
0 1
2 0 72
1 1 X(k ) + 9
= 0 4 2 4 , k = 0, 1, 2, ...
0 1
8
1
4 13 8
0 1
2 0 0 7 2 7 2
1 1 0 + 9 = 9
X(1) = 0 4 2 4 4
0 1
8
1 0
4 13 8 13 8
3.5
or X (1)
= 2.25
1.625
4.625
3.625
Similarly, X(2) =
2.3125
5.3115
and X(3) = 4.3125
2.6563
25
2.3.3. Convergence Analysis
For the convergence of the iteration method (2.6), we first study following important concepts.
Vector Norm. A real number || X || is called a norm of the vector X ∈ Rn, if for all X, Y ∈ Rn and α ∈ R.
(i) || X || ≥ 0,
(ii) || X || = 0 ⇔ X = 0,
(iii) || αX || = | α | || X ||
(iv) || X + Y|| ≤ || X || + |Y||.
The most commonly used norms are :
(i) Absolute norm (l1 norm)
x1
x
X =
2
For the vector
⋮
xn
n
|| X ||1 = ∑ | xi |
i =1
|| X ||2 = ∑ | xi |
i =1
|| X ||∞ = max
1≤i ≤ n
| xi |
0
1
X = −4
2
−1
We have || X ||1 = 0 + 1 + 4 + 2 + 1 = 8
|| X ||2 = [0 + 1 + 16 + 4 + 1]½ = 22
|| X ||∞ = 4
26
Eigenvalues and Eigenvectors of a Matrix. Consider a matrix A ∈ Rn × n. If for some scalar λ there
exists a non zero vector X ∈ Rn such that A X = λX , then λ is called an eigenvalue or a characteristic root
of A and X is an eigenvector corresponding to λ.
The problem of obtaining the eigenvalues and the corresponding eigenvectors of a matrix is known as
an eigenvalue problem. In order to have nontrivial solution X of AX = λX, we must have
det (A – λI) = 0 ...(2.14)
The equation (2.14) is called the characteristic equation of A and its n roots λ1, λ2, ..., λn are the n
eigenvalves of A. The set of all the eigen values of A is called the spectrum of A and it s denoted by σ(A).
The largest eigenvalue in modulus is called the spectral radius of A and it is dentoed by ρ(A). Hence
ρ(A) = max|λ| ...(2.15)
λ ∈ σ(A)
1 2 3
−4 2
A = 0
0 0 7
1– λ 2 3
i.e. 0 –4 − λ 2 =0
0 0 7−λ
or (1 – λ) (– 4 – λ) (7 – λ) = 0
Hence, the characteristic roots or the eigenvalues of A are 1, – 4 and 7. Also, the spectral radius of A is
ρ(A) = 7.
Matrix Norm. A real number ||A|| is called a norm of the matrix A ∈ R n× n , if for all A, B ∈ R n× n and
α∈R
(i) ||A|| ≥ 0
(ii) ||A|| = 0 ⇔ A = 0
(iii) ||α A|| = |α| ||A||
(iv) ||A + B|| ≤ ||A || + ||B||
(v) ||AB|| ≤ ||A|| ||B||
The most commonly used matrix norms are:
(i) Frobenius or Euclidean norm : For the square matrix A = (aij)n×n, the Frobenius norm ||A||f is
defined by
1/ 2
n
||A||f = ∑ | aij |2
i , j =1
27
(ii) Maximum norm
n
|| A ||∞ = max ∑ aik (maximum absolute row sum),
i
k =1
||A||1 = max
k
∑ aik (maximum absolute column sum).
i =1
4 −2
A=
1 1
(i) The Frobenius norm is
1/ 2
2 2
||A||f = ∑ |aij |
i , j =1
= [16 + 4 + 1+ 1]1/2
= 22
(ii) Maximum norm
2
|| A ||∞ = max
i
∑ | aik |
k =1
= max (4 + 2, 1 + 1)
= max (6, 2)
=6
2
||A||1 = max ∑ | aik |
k
i =1
= max (4 + 1, 2 + 1)
= max (5, 3)
=5
(iii) To determine the spectral norm ||A||2, we have
4 1 4 −2 17 –7
ATA = =
–2 1 1 1 –7 5
28
∴ |ATA – λI| = 0
17 – λ −7
=0
−7 5−λ
⇒ (17 – λ) (5 – λ) – 49 = 0
⇒ λ = 11 ± 85
∴ ρ(ATA) = 11 + 85
= 11 + 85
= 20.22
Theorem 2.1. For a matrix A of order n × n,
lim A k = 0
k →∞
≤ klim
→∞
||A||k
= 0 , if ||A|| < 1.
∴ || lim A k || = 0
k →∞
Also, let λ1, λ2, ..., λn be the eigenvalues of A and for simplicity we assume that all of them are distinct.
We write
A = S–1 DS,
Where S is a similarity transformation and D is the diagonal matrix having the eigenvalues of A on the
disgonal. The eigenvalues of Ak are λ1k , λ 2k , ..., λ kn .
∴ Ak = S–1Dk S,
29
λ1k 0
k
λ 2
where Dk =
⋱
0 λ k
n
This yields
Definition. A square matrix A = (aij)n×n is said to be strictly diagonally dominant if for each i = 1,2, ...,
n,
n
| aii | > ∑ | aij |
j =1
j≠i
Now for the convergence of the iteration method (2.6), we consider the sequence of error vectors
e(k) = X(k) – X, k = 0, 1, 2, ... ....(2.16)
(k) (k–1)
Since, X = HX + C = k = 0, 1, 2, ...
X = HX + C
(k)
∴ X – X = H (X(k –1) – X)
or e(k) = H e(k–1)
= H(He(k–2) = H2 e(k–2)
= ...
= Hk(e0) ...(2.17)
⇒ klim e( k ) = 0 ⇔ lim H k = 0
→∞ k →∞
Hence, for any choice of the initial vector X(0), the sequence of approximations {X(k)} converges to the
exact solution X iff
lim H k = 0
k →∞
30
n aij
∴ ||H|| < 1 if ∑a < 1, 1 ≤ i ≤ n
j =1 ii
j ≠i
n
or ||H|| < 1 if ∑ | aij |<|aii | , 1 ≤ i ≤ n. ...(2.19)
j =1
n ≠i
Thus the Jacobi iteration method (2.9) converges for any choice of the initial vector X(0), if the coefficent
matrix A is strictly diagonally dominant. Similarly it can be proved that, if A is strictly diagonally dominant,
then the Gauss–Seidel iteration method (2.13) converges for any initial vector X(0).
Definition : The number
v = log10 ρ(H)
is called the rate of convergence of the iteration method
X(k+1) = HX(k) + C, k = 0 1, 2, ....
Example 14. For the following system of equations.
2x1 – x2 = 7
– x1 + 2x2 – x3 = 1
– x2 + 2x3 = 1,
Find the spectral radius of the iteration matrices of the Jacobi and the Gauss-Seidel iteration schemes
and hence find the rate of converges of these schemes.
Solution. The given equations are
2x1 – x2 + 0x3 = 7
– x1 + 2x2 – x3 = 1
0x1 – x2 + 2x3 = 1
The coefficent matrix is
2 –1 0
A = −1 2 −1 = L + D + U
0 −1 2
12 0 0 0 –1 0
1 0 –1 0 –1
= –0 2
0 0 1
2 0 –1 0
0 1
2 0
1
= 12 0 2
0 1
2 0
31
∴ |H – λI| = 0
–λ 1
2 0
⇒ 1
2 –λ 1
2 =0
0 1
2 –λ
1
⇒ – λ λ2 – = 0
2
1
or λ = 0, ±
2
Therefore, the spectral radius of the Jacobi iteration matrix is
1
ρ(H) =
2
The rate of convergence of the Jacobi iteration scheme is
vj = – log 10 ρ(H)
(
= – log10 1/ 2 ≈ 0.1505 )
The iteration matrix for the Gauss-Seidel iteration scheme is
H = – (L + D)–1 U
−1
2 0 0 0 −1 0
= – −1 2 0 0 0 −1
0 −1 2 0 0 0
12 0 0 0 −1 0
0 0 0 −1
= – 14 1
2
1 8 1
4
1 0
2 0 0
0 1
2 0
1 1
= 0 4 2
0 1
8
1
4
–λ 1
2 0
∴ |H – λI| = 0 ⇒ 0 1
4 −λ 1
2 =0
0 1
8
1
4 –λ
32
1
2
1
⇒ –λ 4 – λ – =0
16
1
⇒ λ = 0, λ =
2
Thus , the spectral radius of the Gauss-Seidel iteration matrix is
1
ρ(H) =
2
and the rate of convergence is
vGS = – log10 ρ(H)
= – log10 (1/2)
≈ 0.3010
In this example, we note that both the Jacobi and the Gauss-Seidel iteration schemers converge as ρ(H)
< 1 for both the schemes, although the coefficient matrix A is not strictly diagonally dominant.
EXERCISES
1. Solve the following systems of equations using the Gaussian elimination method.
(a) 2x1 + x2 +x3 = 10
3x1 + 2x2 + 3x3 = 18
x1 + 4x2 + 9x3 = 16
(b) 4x1 – 2x2 + x3 = 15
– 3x1 – x2 + 4x3 = 8
x1 – x2 + 3x3 = 13
2. Solve the following systems of equations by the Gaussian elimination method with partial pivoting.
(a) x1 + x2 – 2x3 = 3
4x1 – 2x2 + x3 = 5
3x1 – x2 + 3x3 = 8
(b) x1 + x2 – x3 = 2
2x1 + 3x2 + 5x3 = –3
3x1 + 2x2 – 3x3 = 6
3. Sole the following system of equations by the Gaussian elimination method with scaled partial
pivoting:
0.6 x1 + 3x2 + 2x3 = 6.2
x1 + 0.5x2 + 2x3 = – 0.5
2x1 + 4x2 + 0.7x3 = 14.6
33
4. Solve the system
(i) 5x1 + x2 + 2x3 = 10
–3x1 + 9x2 + 4x3 = –14
x1 + 2x2 – 7x3 = –33,
(ii) 27 x + 6y – z = 85
6x + 15y + 2z = 72
x + y + 54z = 110
using both the Jacobi method and the Gauss-Seidel method. Take X(0) = 0 and perform three itera-
tions in each case.
5. For the following system of equations
4 x1 + x2 + 2x3 = 4
3x1 + 5x2 + x3 = 7
x1 + x2 + 3x3 = 3
(a) Show that the Gauss – Seidel iteration scheme conrerges.
(b) Starting with the initial vector X(0) = 0, iterate three times by the Gauss-Seidel iteration scheme.
(c) Find the spectral radius of the iteration matrix and hence find the rate of convergence.
6. Determine the convergence factor for the Jacobi and the Gauss-Seidel methods for the system
4 0 2 x 4
0 5 2 y –3
=
5 4 10 z 2
ANSWERS
1. (a) x1 = 7, x2 = –9, x3 = 5
(b) x1 = 2, x2 = –2, x3 = 3
2. (a) x1 = 22/9, x2 = 3, x3 = 11/9
(b) x1 = 1, x2 = 0, x3 = –1
3. x1 = 2, x2 = 3, x3 = – 2
4. (i) By Jacobi Method :
X(1) = [2 –1.556 4.714]T
X(2) = [0.425 –2.984 4.556]T
X(3) = [0.775 –3.438 3.922]T
By Gauss-Seidel Method :
X(1) = [2 –0.889 4.746]T
X(2) = [0.279 –3.572 3.734]T
X(3) = [1.221 –2.808 4.086]T
34
(ii) By Gauss-Seidel Method :
X(1) = [3.15 3.54 1.92]T
X(2) = [2.43 3.57 1.926]T
X(3) = [2.423 3.574 1.926]T
5. (a) The Gauss-Seidel iteration scheme converges, as the coefficient matrix is strictly diagonally
dominant.
(b) X(1) = [1 4/5 2/5]T
X(2) = [3/5 24/25 12/25]T
X(3) = [13/25 124/125 62/125]T
(c) Spectral radius ρ = 0.2
Rate of convergence VGS = 0.6989
35
LESSON 3
INTERPOLATION
3.1. Introduction
Let (x0, y0), (x1, y1), (x2, y2), ..., (xn, yn) be the set of tabular values satisfying the relation y = f(x);
x0 ≤ x ≤ xn, where the explicit nature of f (x) is not known. It is required to find an approximating function
P(x), such that
P(xi), = yi, i = 0, 1, 2, ..., n. ...(3.1)
Such a process is known as interpolation. If P(x) is a polynomial, then the process is called polynomial
interpolation and P(x) is called the interpolating polynomial of f(x) and the tabular points xi are also known
as nodes, arguments or abscissas. In some cases the values of the derivatives. f (k)(x), k = 1, 2,...., n are also
known at the points x0, x1, x2,...., xn. Then, P(x) is said to interpolate f(x) if
P(xi) = f (xi)
P(k)(xi) = f (k)(xi), i = 0, 1, 2, ....,n. ...(3.2)
Once an interpolating polynomial P(x) is obtained, it may be used to obtain the approximate values of
f(x) at the points between consecutive tabular points. We now discuss Lagrange’s and Newton’s methods of
constructing interpolating polynomial.
3.2. Lagrange Interpolation
Let the values of f(x) are known at the n + 1 points x0, x1,...,xn. We determine interpolating
polynomial Pn(x) of degree at most n, such that
Pn(xi) = f(xi), i = 0, 1,..., n ...(3.3)
Let Pn(x) = A0 (x – x1) (x – x2)...(x – xn)
+ A1(x – x0) (x – x2)...(x – xn)
+ .........................................
+ An (x – x0) (x – x1) ... (x – xn–1), ...(3.4)
where Ai’s are the constants to be determined.
To obtain A0, we substitute x = x0 in (3.4) and use (3.3), we obtain
f(x0) = Pn(x0)
= A0 (x0 – x1) (x0 – x2)...(x0 – xn)
f ( x0 )
∴ A0 = ( x − x ) ( x − x )...( x − x ) ...(3.5)
0 1 0 2 0 n
f ( x1 ) ,
A1 =
( x1 − x0 ) ( x1 − x2 )...( x1 − xn )
36
f ( x2 ) ,
A2 =
( x2 − x0 ) ( x2 − x1 ) ( x2 − x3 )...( x2 − xn )
.
.
.
f ( xn ) .
An = ...(3.6)
( xn − x0 ) ( xn − x1 )...( xn − xn − 1 )
Now, substituting the values of A0, A1, ..., An from (3.6) in (3.4), we obtain the Lagrange interpolating
polynomial in the form
( x − x1 ) ( x − x2 ) ... ( x − xn )
Pn(x) = f ( x0 )
( x0 − x1 ) ( x0 − x2 ) ... ( x0 − xn )
( x − x0 ) ( x − x2 ) ... ( x − xn )
+ ( x − x ) ( x − x ) ... ( x − x ) f ( x1 )
1 0 1 2 1 n
+ .........................................
( x − x0 ) ( x − x1 ) ... ( x − xn − 1 )
+ ( x − x ) ( x − x ) ... ( x − x ) f ( xn ). ...(3.7)
n 0 n 1 n n −1
or
n
Pn(x) = ∑ li ( x) f ( x1 ) , ...(3.8)
i=0
where
( x − x0 ) ( x − x1 ) ... ( x − xi − 1 ) ( x − xi + 1 ) ... ( x − xn )
li(x) = ( x − x ) ( x − x ) ... ( x − x ) ( x − x ) ... ( x − x ) ...(3.9)
i 0 i 1 i i −1 i i +1 i n
The polynomials li(x) are called the Lagrange fundamental polynomials or the Lagrange interpola-
tion coefficients. Also
0, i ≠ j
li(xj) = ...(3.10)
1, i = j
If we take n = 1 in (3.7), we obtain interpolating polynomial P1(x) as
( x − x1 ) ( x − x0 )
P1(x) = ( x − x ) f ( x0 ) + ( x − x ) f ( x1 ) , ...(3.11)
0 1 1 0
which is linear therefore, the interpolation in this case is called linear interpolation.
Similarly taking n = 2 in (3.7), we obtain interpolating polynomial, P2(x) for quadratic interpolation.
37
( x − x1 ) ( x − x2 ) ( x − x0 ) ( x − x2 )
P2(x) = ( x − x ) ( x − x ) f ( x0 ) + ( x − x ) ( x − x ) f ( x1 )
0 1 0 2 1 0 1 2
( x − x0 ) ( x − x1 )
+ ( x − x ) ( x − x ) f ( x2 ) ...(3.12)
2 0 2 1
Example 15. Find the quadratic interpolating polynomial for f(x) corresponding to the following data :
x 2 3 –1
f(x) 1 2 3
Solution. Using Lagrange interpolation, we obtain the quadratic interpolating polynomial P2(x) in the
form
( x − x1 ) ( x − x2 )
P2(x) = ( x − x ) ( x − x ) f ( x0 )
0 1 0 2
( x − x0 ) ( x − x2 )
+ ( x − x ) ( x − x ) f ( x1 )
1 0 1 2
( x − x0 ) ( x − x1 )
+ ( x − x ) ( x − x ) f ( x2 )
2 0 2 1
( x − 3) ( x + 1) ( x − 2) ( x + 1) ( x − 2) ( x − 3)
P2(x) = (2 − 3) (2 + 1) (1) + (3 − 2) (3 + 1) (2) + (−1 − 2) (−1 − 3) (3)
1
∴ P2(x) = (5 x 2 − 13 x + 18)
12
Example 16. Use Lagrange interpolation to estimate log10301 from the following table :
Solution. Using Lagrange interpolating polynomial (3.7) to estimate f(x) = log10x at x = 301, we obtain
( x − x1 ) ( x − x2 ) ( x − x3 ) ( x − x0 ) ( x − x2 ) ( x − x3 )
log10x ≈ ( x − x ) ( x − x ) ( x − x ) f ( x0 ) + ( x − x ) ( x − x ) ( x − x ) f ( x1 )
0 1 0 2 0 3 1 0 1 2 1 3
38
( x − x0 ) ( x − x1 ) ( x − x3 ) ( x − x0 ) ( x − x1 ) ( x − x2 )
+ f ( x2 ) + f ( x3 )
( x2 − x0 ) ( x2 − x1 ) ( x2 − x3 ) ( x3 − x0 ) ( x3 − x1 ) ( x3 − x2 )
Here, x = 301, x0 = 300, x1 = 304, x2 = 305, x3 = 307, f(x0) = 2.4771, f(x1) = 2.4829,
f(x2) = 2.4843 and f(x3) = 2.4871
( − 3) ( − 4) ( − 6) (1) ( − 4) ( − 6)
log10301 ≈ (2.4771) + (2.4829)
( − 4) ( − 5) ( − 7) (4) ( −1) ( − 3)
(1) ( − 3) ( − 6) (1) ( − 3) ( − 4)
+ (5) (1) ( − 2) (2.4843) + (7) (3) (2) (2.4871)
= 2.4786
f ( x1 ) − f ( x0 )
i.e., f [x0, x1] = ...(3.13)
x1 − x0
The second order divided difference of f(x) relative to x0, x1, x2 is defined as
f [ x1 , x2 ] − f [ x0 , x1 ]
f [x0, x1, x2] = x2 − x0 ...(3.14)
Similarly, the nth order divided difference of f(x) relative to x0, x1, ......, xn is defined as
f [ x1 , x2 ,..., xn ] − f [ x0 , x1 ,..., xn − 1 ]
f [x0, x1,...., xn] = ...(3.15)
xn − x0
f ( x1 ) − ( x0 )
f [x0, x1] =
h
f ( x0 + h) − f ( x0 )
=
h
1
= ∆ f ( x0 ) ...(3.17)
h
39
where ∆f(x0) = f(x0 + h) – f(x0), ...(3.18)
and it is known as the first order forward difference of f(x) relative to x0 and x1 = x0 + h.
The operator ∆ (delta) is known as Newton's forward difference operator.
Similarly
f [ x1 , x2 ] − f [ x0 , x1 ]
f [x0, x1, x2] = x2 − x0
1 1
∆ f ( x0 ) , using (3.17)
1
= ∆ f ( x ) −
2h h 1
h
1
= ∆ ( f ( x1 ) − f ( x0 ))
2h 2
1
= ∆ ( ∆ f ( x0 ) )
2h 2
1 2
∴ f [x0, x1, x2] = ∆ f ( x0 ) , ...(3.19)
2h 2
where ∆2 f(x0) is known as the second order forward difference of f(x) relative to x0, x1 and x2. In
general
1
f [x0, x1,..., xn] = n
∆ n f ( x0 ) , n ≥ 1, ...(3.20)
nh
Where ∆n f(x0) denotes the nth order forward difference of f(x) relative to x0, x1,...,xn.
Example 16. Prove that the second order divided difference of f(x) = x3 relative to x, y, z, is x + y + z.
Solution. For f (x) = x3, we have
f [ y , z ] − f [ x, y ]
f [x, y, z] = z−x
1 f ( z ) − f ( y ) f ( y ) − f ( x)
= −
z − x z−y y−x
1 z 3 − y 3 y 3 − x3
= z−x z−y − y−x
1
= z − x ( z + y + zy ) − ( y + x + yx)
2 2 2 2
1
= z 2 − x 2 + zy − yx)
z−x
40
1
= z − x [ ( z − x) + ( x + y + z ) ]
=x+y+z
Example 17. For f (x) = 1/x, show that nth order divided difference
(− 1)n
f [x0, x1,..., xn] =
x0 x1 ... xn
Solution. For f (x) = 1/x, we have
1 1 1
f [x0, x1] = x − x x − x
1 0 1 0
−1
= ...(i)
x1 x0
That is, the desired result is true for n = 1. Let it is true for n = m. That is
(− 1) m
f [x0, x1,...,xm] = ...(ii)
x0 x1 x2 ... xm
Now, for n = m + 1
f [ x1 , x2 ,..., xm + 1 ] − f [ x0 , x1 ,..., xm ]
f [x0, x1,...,xm + 1] =
xm + 1 − x0
1 (−1) m (−1) m
−
= x
m + 1 − x0 x1 x2 − xm + 1 x0 x1 − xm , using (ii)
(−1)m + 1
=
x0 x1 ... xm + 1
(−1) n
f [x0, x1,..., xn] = x x ... x
0 1 n
Newton's Divided Difference Interpolation. From the definition of divided differences, we have
f ( x0 ) − f ( x)
f [x, x0] = x0 − x
f ( x) − f ( x0 )
= x − x0
⇒ f (x) = f (x0) + (x – x0) f [x, x0]
or f (x) = f [x0] + (x – x0) f [x, x0] ...(3.21)
41
We now write f[x, x0] in terms of f[x, x0, x1]
f [ x0 , x1 ] − f [ x, x0 ]
f[x, x0, x1] = x1 − x
f [ x, x0 ] − f [ x0 , x1 ]
= x − x1
⇒ f[x, x0] = f[x0, x1] + (x – x1) f[x, x0, x1] ...(3.22)
Substituting this value of f[x, x0] in (3.21), we obtain
f(x) = f[x0] + (x – x0) f[x0, x1] + (x – x0) (x – x1) f[x, x0, x1] ...(3.23)
Again, writing f[x, x0, x1] in terms of f[x, x0, x1, x2] and using its value in (3.23), we obtain
f(x) = f [x0] + (x – x0) f[x0, x1] + (x – x0) (x – x1) f[x0, x1, x2]
= +(x – x0) (x – x1) (x – x2) f [x, x0, x1, x2] ...(3.24)
Proceeding in this way we finally obtain
f(x) = f[x0] + (x – x0) f[x0, x1] + (x – x0) (x – x1) f[x0, x1, x2]
+ ...........................................................................................
+ (x – x0) (x – x1) ... (x – xn – 1) f[x0, x1,..., xn] ...(3.25)
+ (x – x0) (x – x1) ... (x – xn) f[x, x0, x1,..., xn]
or f (x) = Pn(x) + E(f, x)
where
Pn(x) = f[x0] + (x – x0) f[x0, x1] + (x – x0) (x – x1) f[x0, x1, x2]
+ ...........................................................................................
+ (x – x0) (x – x1) ... (x – xn – 1) f[x0, x1,..., xn] ...(3.26)
We note that Pn(xi)= f(xi), i = 0, 1, 2, ..., n.
That is, Pn(x) is an interpolating polynomial of f(x), interpolating at x0, x1..., xn. It is known as Newton’s
divided difference interpolating polynomial. The remainder term
E(f, x) = (x – x0) (x – x1)...(x – xn) f[x, x0, x1,..., xn] ...(3.27)
is known as the error term associated with the interpolation of f(x) by Pn(x).
In the case of equally spaced arguments, using the relations (3.20) in (3.26), we obtain the interpolating
polynomial
( x − x0 ) ( x − x0 ) ( x − x1 ) 2
Pn(x) = f ( x0 ) + ∆f ( x0 ) + ∆ f ( x0 )
h 2 h2
+ ...........................................................................................
( x − x0 ) ( x − x1 ) ... ( x − xn −1 ) n
+ ∆ f ( x0 ) ...(3.28)
n hn
It is known as the Newton – Gregory forward difference interpolating polynomial and it is useful
for estimating the values of f (x)in the begining of the given data set.
42
Uniqueness of The Interpolating Polynomial. For a function f (x) with x0, x1,...,xn as interpolating
points, we may obtain interpolating polynomial in several forms. We now prove that they are identical.
Suppose Pn(x) and Qn(x) are two polynomials of degree ≤ n, such that
Pn (xi) = Qn (xi) = f (xi), i = 0, 1, ..., n.
Consider the polynomial
Dn(x) = Pn(x) – Qn(x)
Dn(x) is a polynomial of degree ≤ n, such that
Dn(xi) = Pn(xi) – Qn(xi)
= 0, i = 0, 1,...,n
That is, Dn(x) is a polynomial of degree ≤ n having n + 1 distinct zeroes.
∴ Dn(x) ≡ 0
or Pn(x) ≡ Qn(x).
Example 18. Find the Newton’s divided difference interpolating polynomial for the following data set :
x 1 3 4
f (x) 1 27 64
Solution. Using the given data, we obtain the following divided difference table :
13
3 27 8
37
4 64
43
Example 19. From the following data set estimate f(0.15) :
Solution. Since the arguments are equally spaced, we shall use Newton – Gregory forward difference
interpolating polynomial (3.28) to estimate f (0.15).
The forward difference table is :
0.1 1.40
0.16
0.20 0.0
0.24 0.0
0.28
0.5 2.28
Since, x0 = 0.1, h = 0.1 and x = 0.15, therefore the Newton – Gregory forward difference interpolating
polynomial is given as
= 1.475
Hence, f(0.15) ≈ 1.475.
44
F(t) = f (t ) − Pn (t ) − (t − x ) (t − x ) ... (t − x ) ,
f ( x) − Pn ( x)
( x − x0 ) ( x − x1 ) ... ( x − xn )
0 1 n
...(3.29)
where x ≠ xi, i= 0, 1,...,n.
By construction F(t) has n + 1 continous derivatives on I. Also, F(t) vanish at the n + 2 points x0, x1,...,xn,
x in I. Applying the Rolle's theorem (see Appendix), f ′(t) vanishes at least n + 1 times in I, f ″(t) vanishes at
least n times in I and finally, f (n + 1)(t) vanishes at least once in I. Let ξ be one such point.
∴ F(n + 1)(ξ) = 0
( n + 1) f ( x) − Pn ( x )
or f (n + 1)(ξ) – Pn (ξ ) − n +1= 0
( x − x0 ) ( x − x1 ) ... ( x − xn )
( x − x0 ) ( x − x1 ) ... ( x − xn ) (n+1)
∴ f(x) – Pn(x) = n +1 f (ξ)
( x − x0 ) ( x − x1 ) ... ( x − xn ) (n+1)
or E(f, x) = n +1 f (ξ), (ξ) ∈ I. ...(3.30)
If x = x0, x1,..., xn, then both sides of (3.30) vanish for arbitrary ξ. Hence, the formula (3.30) is true for
all x ∈ I.
From the two forms (3.27) and (3.30) of E(f, x), we obtain the relation
f ( n + 1) (ξ )
f[x, x0, x1..., xn] = , ξ = ξ ( x) ∈ I ...(3.31)
n +1
( x − x0 ) ( x − x1 )
E(f, x) = f ′′(ξ ) , ξ ∈ ( x0 , x1 ) ...(3.32)
2
1
⇒ E( f , x ) ≤ max ( x − x0 )( x − x1 max f ′′(ξ )
2 x0 ≤ x ≤ x1 x0 ≤ ξ ≤ x1
1
E( f , x) ≤ ( x − x )2 max f ′′(ξ ) ...(3.33)
8 1 0 x0 ≤ ξ ≤ x1
This gives a bound on the truncation error. Further, to determine the step size h for constructing equally
spacced nodal points a = x0, x0 + h,..., x0 + nh = b in an interval [a, b], so that the maximum truncation error
in the linear interpolation of f(x) does not exceed a given ∈ > 0, we have from (3.33)
45
h2
E( f , x ) ≤ max f ′′(ξ ) , h = x1 − x0 .
8 a ≤ξ ≤b
h2
max f ′′(ξ ) ≤ ∈ ...(3.34)
8 a ≤ξ ≤b
Similarly, for n = 2 (case of quadratic interpolation), the formula for truncation error E( f, x) is given by
( x − x0 ) ( x − x1 ) ( x − x2 )
E(f, x) = f ′′′(ξ ), ξ ∈ ( x0 , x2 ) ...(3.35)
3
1
⇒ E( f , x ) ≤ max ( x − x0 ) ( x − x1 ) ( x − x2 ) max f ′′′(ξ ) . ...(3.36)
6 x0 ≤ x ≤ x2 x0 ≤ ξ ≤ x2
∴ max ( x − x0 ) ( x − x1 ) ( x − x2 ) = h3 max t (t 2 − 1)
x0 ≤ x ≤ x2 −1 ≤ t ≤ 1
2 h3
= . ...(3.37)
3 3
Thus, from (3.36) and (3.37), we obtain a bound on the truncation error in the from
h3
E( f , x ) ≤ max f ′′′(ξ ) . ...(3.38)
9 3 x0 ≤ ξ ≤ x2
The step size h for constructing equally spaced nodal points in an interval [a, b], so that the maximum
truncation error in the quadratic interpolation of f(x) does not exceed ∈ > 0, is then given by
h3
max f ′′′(ξ ) ≤ ∈ . ...(3.39)
9 3 a ≤ξ ≤b
Example 20. Let f(x) = log (1 + x), x0 = 1 and x1 = 1.1. Use linear interpolation to calculate an approxi-
mate value of f(1.04) and obtain a bound on the truncation error.
Solution. Using Lagrange interpolation, we obtain the linear interpolating polynomial P1(x) in the form
x − x1 x − x0
P1(x) = x − x f ( x0 ) + x − x f ( x1 )
0 1 1 0
46
1.04 − 1.1 1.04 − 1
P1(x) = log (2.00) + log (2.10)
1 − 1.1 1.1 − 1
0.06 0.04
= (0.6931) + (0.7419)
0.1 0.1
= 0.7126
∴ f(1.04) ≈ 0.7126
1
E ( f , x) ≤ ( x1 − x0 )2 max | f ′′(ξ ) |
8 x0 ≤ ξ ≤ x1
1
∴ f ′(x) = ,
1+ x
−1
f ″(x) =
(1 + x) 2
1 2 −1
∴ E( f , x ) ≤ 8 ( x1 − x0 ) x max 2
0 ≤ ξ ≤ x1 (1 + ξ )
(0.1)2 1
= max
8 1 ≤ ξ ≤ 1.1 (1 + ξ )2
0.01 1
=
8 4
= 0.0003125
Example 21. Determine the maximum step size that can be used in the tabulation of f(x) = ex in [0, 1],
so that the error in the linear interpolation of f(x) does not exceed 5 × 10–4. Determine also the maximum
step size if quadratic interpolation is used.
47
Solution. Let h be the desired step size in the case of linear interpolation of f(x) = ex in [0, 1]. Then
h2
max f ′′( x) ≤ 5 × 10− 4
8 0 ≤ x ≤1
h2
⇒ max e x ≤ 5 × 10− 4
8 0 ≤ x ≤1
h2 e
or, ≤ 5 × 10− 4
8
40 × 10− 4
⇒ h2 ≤
e
h3
max f ′′′ ( x ) ≤ 5 × 10− 4
9 3 0 ≤ x ≤1
h3
⇒ max e x ≤ 5 × 10− 4
9 3 0 ≤ x ≤1
h3
or, ≤ 5 × 10− 4
9 3
45 3 × 10− 4
i.e. h3 ≤
e
∴ Maximum h ≈ 0.1421
Example 22. For the linear interpolation of f(x) relative to the equally spaced nodal points, show that
the error does not exceed 1/8 of the second difference.
Solution. Let E(f, x) be the error in the linear interpolation of f(x) relative to the equally spaced points x0
and x1 = x0 + h. Then
48
∆ 2 f ( x0 )
≈ (x – x0) (x – x1) , by using (3.19).
2 h2
∆ 2 f ( x0 )
⇒ |E(f, x)| ≤ max ( x − x0 ) ( x − x1 )
x0 ≤ x ≤ x1 2h 2
h 2 ∆ 2 f ( x0 )
= 4 , h = x1 – x0
2h 2
∆ 2 f ( x0 )
∴ E( f , x ) ≤ .
8
EXERCISES
1. Find the unique interpolating polynomial P(x) of degree at most 2, such that
P(0) = 1, P(1) = 3, P(3) = 55
using
(i) Lagrange interpolation
(ii) Newton’s divided difference interpolation.
Evaluate P(2).
2. Estimate f(3) from the following data set :
x 0 1 2 4 5 6
f(x) 1 14 15 5 6 19
using
(i) Lagrange interpolation.
(ii) Newton's divided difference inter polation.
3. The values of f(x) for x = 0, 1, 2, 3, 4, 5, 6 are given by
x 0 1 2 3 4 5 6
f(x) 1 4 17 46 97 176 289
Estimate the value of f(2.3) using only five of the given values.
4. Prove that the second order divided difference of f(x) = x2. relative to x, y, z is independent of x, y, z.
5. If f(x) = 1/x2, find the divide difference f[x1, x2, x3, x4].
49
6. Using sin (0.1) = 0.09983 and sin (0.2) = 0.19867, find an approximate value of sin (0.15) by
Lagrange interpolation. Obtain a bound on the truncation error.
7. Determine the step size that can be used in the tabulation of f(x) = sin x in [1, 3], so that the error in
the linear interpolation of f(x) does not exceed 5 × 10–5.
8. If f(x) = x2 logx, 5 ≤ x ≤ 10 and the function values are rounded to 5 decimals, determine the
maximum step size that can be used in the tabulation of f(x) so that the interpolation error in the
quadratic interpolation of f(x) does not exceed 10–5.
ANSWERS
x1 x2 x3 + x2 x3 x4 + x3 x4 x1 + x4 x1 x2 .
5. f [x1, x2, x3, x4] = −
( x1 x2 x3 x4 ) 2
6. 0.14925, 0.00025.
7. Step size h ≤ 0.02.
8. 0.0730.
50
LESSON 4
NUMERICAL INTEGRATION
4.1. Introduction
We recall that if f(x) is continuous on [a, b] and F(x) is an antiderivative of f(x) (i.e. F′(x) = f(x)), then by
the Fundamental Theorem of Calculas (see Appendix)
b
∫a f ( x) dx = F(b) – F(a) ...(4.1)
Many definite integrals can be evaluated by using this formula. But it is not always so easy and some-
time even not possible to find an antiderivative of f (x) which is expressible in terms of elementary func-
2
tions. A simple example is f (x) = e− x . Moreover, in many cases f (x) is not known explicitely but it is
defined in terms of discrete data. In such situations, integrals are evaluated by numerical methods, to get
approximate values to the desired level of accuracy. This process is known as numerical integration or
numerical quadrature. We now discuss some of these methods.
n
f (x) = ∑ li ( x) f ( xi ) + E( f , x), x∈[a, b], ...(4.2)
i=0
where
( x − x0 ) ( x − x1 ) ... ( x − xi − 1 ) ( x − xi + 1 ) ... ( x − xn )
li(x) = ( x − x ) ( x − x ) ... ( x − x ) ( x − x ) ... ( x − x ) , ...(4.3)
i 0 i 1 i i −1 i i +1 i n
( x − x0 ) ( x − x1 ) ... ( x − xn ) ( n + 1)
E(f, x) = f (ξ ), a < ξ < b
n +1
π ( x) f ( n + 1) (ξ )
= n +1 ...(4.4)
n
b b
∫a i∑
b
∫a f ( x) dx = li ( x) f ( xi ) dx + ∫ E( f , x) dx
a
=0
n
∑ ( ∫a li ( x)dx ) f ( xi ) + ∫a E( f , x)dx
b b
=
i=0
51
n
∑ λi ( xi ) + R,
b
∴ ∫a f ( x ) dx =
i=0
...(4.5)
b b
where λi =
∫a li ( x) and R = ∫a E( f , x) dx ...(4.6)
The coefficients λi, i = 0, 1, ...,n are called the weights of the integration formula. Further, if π(x) does
not change sign in [a, b] and f (n + 1)(x) is continuous in [a, b] then using the mean value theorem of integral
calculas (see Appendix), we can express the associated error in the form
f ( n + 1) (η) b
n + 1 ∫a
R = π( x) dx, η ∈ ( a, b). ...(4.9)
Definition : An integration method of the form (4.7) is said to be of order p or has degree of precision
p, if it produces exact results for all polynomials of degree at most p, but fails to give exact results for at least
one polynomials of degree p + 1.
Newton-Cotes Integration formulas : If the nodal points a = x0, x1,..., xn = b are equally spaced, then
the integration formula (4.7) and (4.10) are called closed Newton – Cotes integration formula. They are
called “closed” since the end points a and b are the extreme abscissas in the formula.
Taking h = (b – a)/h, x = a + sh and xi = a + ih, from (4.3) we have
s ( s − 1) ... ( s − i + 1) ( s − i − 1) ... ( s − n)
li (a + sh) =
i (i − 1) ... (1) ( −1) ... ( − ( n − i ))
( −1) n − i
= i n − i s ( s − 1) ... ( s − i + 1) ( s − i − 1) ... ( s − n) ...(4.11)
52
∴ From (4.6) and (4.11), we obtain
b
λi = ∫a li ( x) dx
n
= h ∫ li (a + sh) ds ...(4.12)
0
(− 1) n − i h n
or, λi = i n−i ∫0 s(s − 1) ... ( s − i + 1) ( s − i − 1) ... (s − n)ds
Also, π(x) = (x – x0) (x – x1)... (x – xn)
= hn + 1 s(s – 1)... (s – n)
b
∴ R = ∫a E( f , x) dx
b π ( x) f ( n + 1) (ξ )
= ∫a n +1
dx
hn + 2 n
R = n + 1 ∫0 s ( s − 1) ... ( s − n) f
( n + 1)
i.e., (ξ ) ds, a < ξ < b. ...(4.13)
Thus, we have the closed Newton – Cotes integration formula in the form
n
b
∫a f ( x) dx ≈ ∑ λi f ( xi ) ...(4.14)
i=0
where the weights λi’s are given by (4.12) and the associated errors given by (4.13).
Trapezoidal Rule. Taking n = 1 in the Newton – Cotes integration formula (4.14), we obtain
b
∫a f ( x)dx ≈ λ0 f(x0) + λ1f(x1)
= λ0f(a) + λ1 f(b), as x0 = a, x1 = b,
1 h
where λ0 = − h ∫ ( s − 1) ds =
0 2
1 h
λ1 = h ∫ s ds =
0 2
and h =b–a
b b−a
⇒ ∫ a f ( x)dx ≈
2
[ f ( a ) + f (b ) ] ...(4.15)
Geometrically, in this integration rule, the area bounded by the curve y = f(x), the ordinates x = a and
x = b, and the x-axis is approximated by the area of the trapezoid with width b – a and ordinates f(a), f(b).
Hence, this rule is known as the trapezoidal rule.
53
The error term associated with the trapezoidal rule (4.15) is obtained from (4.13) by setting n = 1.
That is
3 1
R = h
2 ∫0
s( s − 1) f ′′(ξ ) ds ...(4.16)
h3 1
R = f ′′(η) ∫ s ( s − 1) ds, η ∈ ( a, b).
2 0
h3
i.e., R = − f ′′(η)
12
( a − b )3
R = − f ′′(η) ...(4.17)
12
Thus, the trapezoidal rule is exact for polynomials of degree at most 1 and hence it is of order 1.
Q(b, f(b))
P(a, f(a))
S R x
0 a b
Let the interval [a, b] be divided into n equal subintervals (x0, x1), (x1, x2), ..., (xn–1, xn), where x0 = a and
xn = b and xi = x0 + ih, i = 0, 1, 2,...,n. We write
b
I = ∫a f ( x)dx
x1 x2 xn
= ∫x0
f ( x) dx + ∫
x1
f ( x) dx + ... + ∫
xn − 1
f ( x) dx ...(4.18)
Using trapezoidal rule (4.15) to evaluate each of the integrals on the right hand side of (4.18), we
obtain
h
I =
2
[ ( f0 + f1 ) + ( f1 + f 2 ) + ... + ( f n −1 + f n ) ]
h
= [ f + 2 ( f1 + f 2 + ... + f n −1 ) + f n ) ] ,
2 0
...(4.19)
54
where fk = f(xk), k = 0, 1, 2,...,n. The formula (4.19) is known as the composite trapezoidal rule.
The associated error in this formula becomes
h3
R = [ f ′′ (η1 ) + f ′′ (η2 ) + ... + f ′′ (ηn ) ] , ...(4.20)
12
where xi – 1 ≤ ηi ≤ xi, i = 1, 2, ..., n.
h3 n
Then |R| ≤ f ′′(η) ...(4.21)
12
(b − a ) 2
or |R| ≤ h f ′′(η) ...(4.22)
12
Example 23. Evaluate the integral
1 dx
∫0 1 + x
using the composite trapezoidal rule with 2, 4 and 8 equal subintervals.
Solution. (i) When n = 2, we have h = 1/2 and the three node are 0, 1/2 and 1. Using the campsite
trapezoidal rue (4.19), we obtain
1
f (0) + 2 f + f (1)
1
I =
4 2
1
1 + +
4 1
=
4 3 2
= 0.7083
(ii) When n = 4, we have h = 1/4 and the five nodes are 0, 1/4, 1/2, 3/4 and 1. Therefore
1
f (0) + 2 f + f + f + f (1)
1 1 3
I =
8 4 2 4
1
1 + 2 + + +
4 2 4 1
=
8 5 3 7 2
= 0.6970
(iii) When n = 8, we have h = 1/8 and the nine nodes are 0, 1/8, 1/4, 3/8, 1/2, 5/8, 3/4, 7/8 and 1.
Therefore,
55
1
f (0) + 2 f + f + f + f + f + f + f + f (1)
1 1 3 1 5 3 7
I=
16 8 4 8 2 8 4 8
1
1 + 2 + + + + + + +
8 4 8 2 8 4 8 1
=
16 9 5 11 3 13 7 15 2
= 0.6941
The exact value the integral is I = log2 = 0.693147.
Simpson’s 1/3 Rule. If we take n = 2 in the Newton-Cotes integration formula (4.14), we obtain
2
b
∫a f ( x)dx = ∑ λi f ( xi ),
i =0
h = (b – a)/2, x0 = a, x1 = (a + b)/2, x2 = b
h 2 h
λ0 = ∫
2 0
( s − 1)( s − 2)ds =
3
2 4h
λ1 = − h ∫ s( s − 2) ds =
0 3
h 2 h
λ2 =
2 ∫ 0
s( s − 1) ds =
3
b
∴ I = ∫a f ( x)dx
h 4h a + b h
f (a) + + f (b)
3 2 3
= f
3
h
f (a ) + 4 f
a+b
=
3 + f (b)
2
b−a
f (a ) + 4 f
a+b
i.e., I =
6 + f (b) ...(4.23)
2
This rule is known as Simpson’s 1/3 rule or simply simpson’s rule.
The error associated with this rule is given by
h4 2
3 ∫0
R = s( s − 1)( s − 2) f ′′′(ξ)ds ...(4.24)
Since s(s – 1)(s – 2) changes sign in (0, 2), mean value theorem of integral calculus cannot be used
to evaluate the error R in (4.24)
Further the rule is exact for polynomials of degree ≤ 2, we write
C
R = f ′′′(η), η ∈ (a, b) ...(4.25)
3
56
2
b 3
where C = ∫ x dx − ∑ λi xi3 ...(4.26)
a
i =0
b 3 b−a 3 a + b + b3
3
⇒ C = ∫ a
x dx −
6
a + 4 2
=
4
( b − a 4 ) − b −4 a a3 + b3 + a 2b + ab2
1 4
1 4 b−a
=
4
( b − a 4 ) − 4 (a + b)(a 2 + b2 )
1 4 1
=
4
( b − a 4 ) − (b 4 − a 4 )
4
=0
This shows that the rule is exact for polynomials of degree three also. Hence, the error takes the
form
C iv
R = f (η), η ∈ ( a, b) ...(4.27)
4
b 4 b−a 4 a + b + b4
4
where C = ∫ a
x dx −
6
a + 4 2
1 5 b−a
= (b − a 5 ) − [4a 4 + ( a 4 + 4a 3b + 6a 2 b 2 + 4ab3 + b 4 ) + 4 b 4 ]
5 24
− (b − a) 4
= [ a − 4a 3b + 6a 2b 2 − 4ab3 + b 4 ]
120
(b − a )5
i.e., C = − ...(4.28)
120
∴ The error term in the Simpson's rule becomes
(b − a )5 iv
R = − f (η)
2880
− h5 iv
or, R = f (η) . ...(4.29)
90
From here, we note that Simpson's rule is of order 3.
57
To obtain the composite Simpson's rule, we divide the interval [a, b] into an even number of
subintervals of equal length. If we divide the interval [a, b] into 2n subintervals each of length h = (b – a)/2n,
we obtain 2n +1 abscissas a = x0, x1, x2,..., x2n = b, xi = x0 + ih, i = 0, 1,..., 2n.
We write
b x2 x4 x2 n
I = ∫a f ( x) dx = ∫
x0
f ( x) dx + ∫
x2
f ( x) dx + ... + ∫
x2 n − 2
f ( x) dx ...(4.30)
Using Simpson’s rule (4.23) to evaluate each of the integrals on the right hand side of (4.30), we
obtain
h
I = [( f + 4 f1 + f 2 ) + ( f 2 + 4 f3 + f 4 ) + ... + ( f 2 n − 2 + 4 f 2 n − 1 + f 2 n )]
3 0
h
or, I = [( f + 4( f1 + f 3 + ... + f 2 n − 1 ) + 2 ( f 2 + f 4 + ... + f 2 n − 2 ) + f 2 n ] ,
3 0
...(4.31)
which is the composite Simpson's rule. It should be noted that this rule requires the division of the
interval [a, b] into an even number of subintervals of equal length.
The error associated with (4.31) becomes
− h5
R = f iv (η1 ) + f iv (η2 ) + ... + f iv (ηn ) ...(4.32)
90
where x2i – 2 ≤ ηi ≤ x2i, i = 1, 2,..., n.
If f iv(η) = amax f iv ( x) ,
≤x≤b
we can write
nh5 iv
|R| ≤ f (η)
90
(b − a )5 iv
= f (η)
2880 n
(b − a ) 4 iv
or |R| ≤ h f (η) ...(4.33)
180
1
Example 24. Using Simpson’s rule, evaluate the intigral
3
1 dx
I = ∫ 01 + x
starting with h = 0.5, continually halving the value of h and calculating I, until the value of I is
obtained correct to three decimal places of accuracy.
58
Solution. (i) Starting with h =0.5, we have n = 2 and the three abscissas are 0, 1/2 and 1. Using the
Simpson’s rule (4.23) we obtain
1 1
I = f (0) + 4 f 2 + f (1)
6
1 8 1
1+ +
6 3 2
=
= 0.6944
(ii) When h = 0.5/2 = 1/4, we have n = 4 and the five abscissas are 0, 1/4. 1/2, 3/4 and 1. Using the
Composite Simpson's rule (4.31), we obtain
1
f (0) + 4 f + f + 2 f + f (1)
1 3 1
I =
12 4
4 2
1
1 + 4 + + 2 +
4 4 2 1
=
12 5 7 2
3
= 0.6932
(iii) When h = 1/8, we have n = 8 and the nine abscissas are 0, 1/8, 1/4, 3/8, 1/2, 5/8, 3/4, 7/8 and 1.
Therefore using the composite Simpson’s rule (4.31) once again, we obtain
1 f 1 + f 3 + f 5 + f 7 + 2 f 1 + f 1 + f 3 + f (1)
I= f (0) + 4 8 8 8 4 2 4
24 8
1
1 + 4 + + +
8 8 8 8 4 2 4 1
=
24 + 2 5 + 3 + 7 + 2
9 11 13 15
= 0.6931
Hence, up to three decimal places of accuracy I = 0.693.
Example 25. A solid of revolution is formed by rotating about the x-axis the area between the x-axis, the
lines x = 0 and x = 1, and a curve through the points with the following coordinates :
Estimate the volume of the solid formed, giving the answer to three decimal places.
Solution. If V is the volume of the solid formed then
1
V = π ∫ y 2 dx
0
59
π (0.25)
V = [ 1 + 4(0.9793 + 0.8261) + 2 (0.9195) + 0.7081 ]
3
Hence, up to three decimal places
V = 2.819.
n
b
∫a f ( x) dx ≈ ∑ λi f ( xi ) , ...(4.34)
i=0
The abscissas xi are selected as equally spaced points in the interval [a, b] and the weights λi are then
determined by using integration. The degree of precision of the formula is n when n is odd and n + 1 when
n is even. In this section we shall develop the concept of Gaussian quadrature. In this approach, the abscissas
as well as the weights are determined so as to obtain the highest possible degree of precision.
We first transform the interval of integration [a, b] to [–1, 1], using the transformation
b−a t + b+ a.
x = ...(4.35)
2 2
This gives
b b−a 1 b − a t +b + a dt.
∫a f ( x) dx =
2 ∫−1 f 2 2
(4.36)
n
1
∫−1 f ( x) dx ≈ ∑ wi f ( xi ) , ...(4.37)
i=0
where all the abscissas and weights are unknown. We consider the following easses.
(i) One-point formula. Taking n = 0 in (4.37), we obtain
1
∫−1 f ( x) dx ≈ w0 f ( x0 ) ,
w0 and x0 are two unknown here. Making the formula exact for f(x) = 1, x, we obtain
f(x) = 1 : w0 = 2
f(x) = x : w0 x0 = 2
∴ w0 = 2 and x0 = 0
Hence, the formula is given by
1
∫−1 f ( x) dx ≈ 2f(0) ...(4.38)
60
and the associated error R is given by
C
R = f ′′(ξ ) , −1 < ξ < 1 ,
2
where the error constant
1 2
∫−1x dx − 2[0] = 3
2
C =
1
∴ R = f ′′(ξ ) , −1 < ξ < 1 , ...(4.39)
3
(ii) Two-point Formula Taking n = 1 in (4.37), we have
1
∫−1 f ( x) dx ≈ w0 f (x0) + w1 f (x1) , ...(4.40)
Where w0, w1, x0 and x1 are four unknowns. Making the formula exact for f(x) = 1, x, x2, and x3, we
obtain
f(x) = 1 : w0 + w1 = 2 ...(4.41 a)
f(x) = x : w0x0 + w1x1 = 0 ...(4.41 b)
2
f(x) = x2 : w0 x02 + w1 x12 = ...(4.41 c)
3
w1 x13 + w1 x1 x02 = 0
or w1x1 (x1 – x0) (x1 + x0) = 0
Since w1 ≠ 0, x0 ≠ x1 ≠ 0, we obtain x1 = –x0
∴ From (4.41 b) and (4.41 a), we obtain w0 = w1 = 1.
Using (4.41 c), we obtain
x02 = 1/3
or x0 = ± 1 3 and x1 = ∓ 1 3.
1 1 + f 1 .
∫−1 f ( x) dx ≈ f −
3
3
...(4.42)
dx − +
1 1 1
∫−1 x
4
C =
9 9
61
2 2 8
= − =
5 9 45
The error associated with the formula (4.42) is then given by
C iv 1 iv
R = f (ξ ) = f (ξ ), −1 < ξ < 1. ...(4.43)
4 135
(iii) Three-point Formula. Taking n = 2 in (4.37), we obtain
1
∫−1 f ( x) dx ≈ w0 f(x0) + w1 f(x1) + w2 f(x2). ...(4.44)
There are six unknown w0, w1, w2, x0, x1 and x2 and the formula can be made exact for polynomials of
degree at most five. For f(x) = 1, x, x2, x3, x4 and x5, we obtain the system of equations.
f(x) = 1 : w0 + w1 + w2 = 2 ...(4.45 a)
f(x) = x : w0x0 + w1x1 + w2x2 = 0 ...(4.45 b)
2
f(x) = x2 : w0 x02 + w1 x12 + w2 x22 = ...(4.45 c)
3
2
f(x) = x4 : w0 x04 + w1 x14 + w2 x24 = ...(4.45 e)
5
( ) (
w1 x13 x12 − x0 2 + w2 x23 x2 2 − x0 2 ) =0
Further, eliminating the first term from these two equations,
we obtain
( ) (
w2 x23 x2 2 − x0 2 − w2 x2 x12 x2 2 − x0 2 = 0)
⇒ (
w2 x2 x2 2 − x0 2 ) ( x22 − x12 ) = 0
Since x0, x1 and x2, are distinct, we obtain
w2x2(x2 + x0) (x2 + x1) = 0
⇒ x2 = – x0 or x2 = – x1, as w2 ≠ 0 and let x2 ≠ 0.
Taking x2 = – x0, from (4.45 b) and (4.45 d), we obtain
(w0 – w2) x0 + w1x1 = 0
(w0 – w2) x03 + w1 x13 = 0
62
Eliminating the first term, we have
w1x1 (x12 – x02) = 0
Since, w1 ≠ 0, x1 ≠ x0, x1 ≠ – x0, we obtain x1 = 0
Hence, (w0 – w2) x0 = 0 or w0 = w2, as x0 ≠ 0.
Now (4.45 c) and (4.45 e) yield
2 2
2w0 x02 = , 2 w0 x04 =
3 5
3
⇒ x02 =
5
3
or x0 = ±
5
3
Then x2 = ∓
5
1 1 3 3
∫−1 f ( x) dx ≈ 9 5 f
− 5 + 8 f (0) + 5 f 5
...(4.46)
Similarly, taking x2 = – x1, we obtain x0 = 0 and x2 = ± 3 5 . This yeilds the same formula (4.46).
1 3
6 6
1 3
C = ∫ −1 x 6 dx − 5 −
9 5
+ 0+5
5
2 6 8
−
= =
7 25 175
∴ The error in this formula becomes
C (6)
R = f (ξ )
6
1
or R = f (6) (ξ ) , − 1 < ξ < 1. ...(4.47)
15750
Example 26. Evaluate the integral
2 2 x dx
I = ∫1 1 + x4 ,
using one-point, two-point and three-point Ganssian quadrature rules. Compare with the exact solution.
63
Solution. We have
2 2 x dx
I = ∫1 1 + x4
To transform the interval of integration [1, 2] to [–1, 1], we substitute x = At + B. This gives
1 = – A + B, 2 = A + B
⇒ A = 1/2 and B = 3/2
∴ x = (t + 3)/2 and dx = dt/2.
1 8(t + 3) dt 1
∴ I = ∫−116 + (t + 3)4 = ∫−1 f (t ) dt.
(i) Using the one-point Gaussian quadrature rule (4.38), we obtain
24
I ≈ 2f(0) = 2 16 + 81
or I ≈ 0.4948
(ii) Using the two-point Ganssian quadrature rule (4.42), we obtain
−1 + f 1
I ≈ f ≈ 0.3842 + 0.1592
3 3
or I ≈ 0.5434
(iii) Using the three-point Ganssian quadrature rule (4.46), we obtain
1 3 3
I ≈ 9 5 f − 5 + 8 f (0) + 5 f 5
1
= [5(0.4393) + 8 (0.2474) + 5(0.1379)] ≈ 0.5406
9
The exact value of I is given by
I = tan–1(4) – π/4
= 0.5404
EXERCISES
1. Evaluate the integral
1 dx
I = ∫0 1 + x ,
using (i) the trapezoidal rule, (ii) the Simpson's rule.
2. Compute the value of the integral
1 dx
I = ∫0 1 + x 2 ,
using the composite trapezoidal rule with h = 0.5, 0.25 and 0.125. Hence, obtain an approximate
value of π from the formula
64
π 1 dx
4
= ∫0 1 + x 2
when h = 0.125
3. Evaluate the integral
2
∫0 e dx ,
x
I =
using the composite Simpson’s rule with h = 1/2. Compare with the exact solution.
4. Evaluate the integral
π
I = ∫ 0 sin x dx ,
Using (i) the composite trapezoidal rule,
(ii) the composite Simpson's rule,
with h = π/4. Compare with the exact solution.
5. Evaluate the integral
2 dx
I = ∫0 3 + 4 x ,
using two-point and three-point Gaussian quadrature rules.
6. Evaluate the integral
1 dx
I = ∫0 1 + x ,
by subdividing the interval [0, 1] into two equal parts and then applying the three-point Gaussian
quadrature formula
7. Evaluate the integral
π /2
I = ∫0 sin x dx ,
ANSWERS
65
APPENDIX
1. Rolle’s Theorem. If f (x) is continuous in [a, b] differentiable in (a, b) and f (a) = f (b) = 0, then
there exists at least one number c ∈ (a, b) with f ′(c) = 0.
2. Taylor’s Theorem. If f (x) is continuous and possess continuous derivatives of order n + 1 in an
interval that includes x = a, then in that interval
( x − a)2
f (x) = f (a) + (x – a) f ′(a) + f ′′(a) + ...
2
( x − a)n ( n)
+ f ( a) + R n ( x),
n
where the remainder term Rn(x) can be expressed in the form
( x − a)n +1 ( n+1)
Rn (x) = f (ξ ), a < ξ < x.
n +1
3. Taylor’s Series. If f (x) possess continuous derivatives of all orders in the interval [a, b] so that we
have
( x − a)2
f (x) = f (a) + (x – a) f ′(a) + f ′′(a) + ...
2
( x − a)n n
+ f ( a) + R n ( x)
n
and if
lim R n ( x) = 0
n →∞
then, we have
( x − a)2
f (x) = f (a) + (x – a) f ′(a) + f ′′(a) + ...
2
4. Fundamental Theorem of Calculas. If f (x) is continuous in [a, b] and F(x) exists such that
F′(x) = f(x), then
b
∫a f ( x)dx = F (b) – F(a)
5. Mean value Theorem of Integral Calculas. If f(x) is continuous in [a, b], g(x) in integrable in
[a, b] and g(x) does not change sign in [a, b], then
b b
∫a f ( x) g ( x)dx = f (ξ ) ∫ g ( x) dx
a
66