0% found this document useful (0 votes)
4 views65 pages

Numerical Copy

This chapter discusses the approximation of functions using polynomials, specifically focusing on the construction of interpolating polynomials through distinct tabular points. It introduces the Lagrange interpolating polynomial and its fundamental polynomials, detailing how to derive linear and quadratic interpolating polynomials. Additionally, the chapter addresses the error of interpolation and provides examples to illustrate the application of Lagrange's formula in finding approximate values and bounds on errors.

Uploaded by

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

Numerical Copy

This chapter discusses the approximation of functions using polynomials, specifically focusing on the construction of interpolating polynomials through distinct tabular points. It introduces the Lagrange interpolating polynomial and its fundamental polynomials, detailing how to derive linear and quadratic interpolating polynomials. Additionally, the chapter addresses the error of interpolation and provides examples to illustrate the application of Lagrange's formula in finding approximate values and bounds on errors.

Uploaded by

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

In this chapter, we discuss the problem of approximating a given function by polynomials.

There are two main uses of these approximating polynomials. The first use is to reconstruct
the function f(x) when it is not given explicitly and only values of f(x) and/ or its certain order
derivatives are given at a set of distinct points called nodes or tabular points. The second use
is to perform the required operations which were intended for f(x), like determination of roots,
differentiation and integration etc. can be carried out using the approximating polynomial
P(x). The approximating polynomial P(x) can be used to predict the value of f(x) at a non-
tabular point. The deviation of P(x) from f(x), that is f(x) – P(x), is called the error of approxi-
mation.
Let f(x) be a continuous function defined on some interval [a, b], and be prescribed
at n + 1 distinct tabular points x0, x1,..., xn such that a = x0 < x1 < x2 < ... < xn = b. The distinct
tabular points x0, x1,..., xn may be non-equispaced or equispaced, that is xk+1 – xk = h, k = 0, 1,
2, , n –1. The problem of polynomial approximation is to find a polynomial Pn(x), of degree
n, which fits the given data exactly, that is,
Pn(xi) = f(xi), i = 0, 1, 2, , n. (2.1)
The polynomial Pn(x) is called the interpolating polynomial. The conditions given in
(2.1) are called the interpolating conditions.
Remark 1 Through two distinct points, we can construct a unique polynomial of degree 1
(straight line). Through three distinct points, we can construct a unique polynomial of degree
2 (parabola) or a unique polynomial of degree1 (straight line). That is, through three distinct
points, we can construct a unique polynomial of degree 2. In general, through n + 1 distinct
points, we can construct a unique polynomial of degree n. The interpolation polynomial
fitting a given data is unique. We may express it in various forms but are otherwise the same
polynomial. For example, f(x) = x2 – 2x – 1 can be written as
x2 – 2x – 1 = – 2 + (x – 1) + (x – 1) (x – 2).
Let the data

x x0 x1 x2 ... xn

f(x) f(x0) f(x1) f(x2) ... f(xn)

be given at distinct unevenly spaced points or non-uniform points x0, x1,..., xn. This data may
also be given at evenly spaced points.
For this data, we can fit a unique polynomial of degree n. Since the interpolating
polynomial must use all the ordinates f(x0), f(x1),... f(xn), it can be written as a linear combina-
tion of these ordinates. That is, we can write the polynomial as
Pn(x) = l0(x) f(x0) + l1(x) f(x1) + ... + ln(x) f(xn)
= l0(x) f0 + l1(x) f1 + ... + ln(x) f(xn) (2.2)
where f(xi) = fi and li(x), i = 0, 1, 2, ,n are polynomials of degree n. This polynomial fits the
data given in (2.1) exactly.
At x = x0, we get
f(x0) Pn(x0) = l0(x0) f(x0) + l1(x0) f(x1) + ... + ln(x0) f(xn).
This equation is satisfied only when l0(x0) = 1 and li(x0) = 0, i 0.
At a general point x = xi, we get
f(xi) Pn(xi) = l0(xi) f(x0) + ... + li(xi) f(xi) + ... + ln(xi) f(xn).
This equation is satisfied only when li(xi) = 1 and lj(xi) = 0, i j.
Therefore, li(x), which are polynomials of degree n, satisfy the conditions

0, i j
li(xj) = 1, i j. (2.3)

Since, li(x) = 0 at x = x0, x1,..., xi–1, xi + 1, ..., xn, we know that


(x – x0), (x – x1),..., (x – xi–1), (x – xi+1),..., (x – xn)
are factors of li(x). The product of these factors is a polynomial of degree n. Therefore, we can
write
li(x) = C(x – x0) (x – x1)...(x – xi–1) (x – xi+1)...(x – xn)
where C is a constant.
Now, since li(xi) = 1, we get
li(xi) = 1 = C(xi – x0) (xi – x1)...(xi – xi–1) (xi – xi+1)...(xi – xn).
1
Hence, C= .
(xi x0 ) (xi x1 )...( x i xi 1 ) ( xi x i 1 )...( x i xn )

( x x 0 ) ( x x1 )...( x x i 1 )( x x i 1 )...( x x n )
Therefore, li(x) = (2.4)
( x i x 0 ) ( x i x1 )...( x i x i 1 ) ( x i x i 1 )...( x i x n )

Note that the denominator on the right hand side of li(x) is obtained by setting x = xi in
the numerator.
The polynomial given in (2.2) where li(x) are defined by (2.4) is called the Lagrange
interpolating polynomial and li(x) are called the Lagrange fundamental polynomials.
We can write the Lagrange fundamental polynomials li(x) in a simple notation.
Denote w(x) = (x – x0) (x – x1)...(x – xn)
which is the product of all factors. Differentiating w(x) with respect to x and substituting x = xi
we get
w (xi) = (xi – x0) (xi – x1)...(xi – xi–1) (xi – xi+1)...(xi – xn)
since all other terms vanish. Therefore, we can also write li(x) as

w( x )
li(x) = . (2.5)
(x xi ) w ( xi )

Let us derive the linear and quadratic interpolating polynomials.


Linear interpolation
For n = 1, we have the data
x x0 x1
f(x) f(x0) f(x1)
The Lagrange fundamental polynomials are given by

( x x1 ) (x x0 )
l0(x) = , l (x) = . (2.6)
( x 0 x1 ) 1 ( x1 x 0 )

The Lagrange linear interpolation polynomial is given by


P1(x) = l0(x) f(x0) + l1(x) f(x1). (2.7)
Quadratic interpolation
For n = 2, we have the data
x x0 x1 x2
f(x) f(x 0) f(x1) f(x2)
The Lagrange fundamental polynomials are given by

(x x1 ) ( x x 2 ) (x x0 ) (x x2 ) (x x 0 ) ( x x1 )
l0(x) = , l (x) = , l (x) = .
(x0 x1 ) ( x 0 x 2 ) 1 ( x1 x 0 ) ( x1 x 2 ) 2 (x2 x 0 ) ( x 2 x1 )
The Lagrange quadratic interpolation polynomial is given by
P1(x) = l0(x) f(x0) + l1(x) f(x1) + l2(x) f(x2). (2.8)
Error of interpolation
We assume that f(x) has continuous derivatives of order up to n + 1 for all x (a, b).
Since, f(x) is approximated by Pn(x), the results contain errors. We define the error of interpo-
lation or truncation error as
E(f, x) = f(x) – Pn(x). (2.9)
Without giving the derivation, we write the expression for the error of interpolation as
E(f, x) = f(x) – Pn(x)

(x x 0 ) ( x x1 )...( x xn ) w( x )
= f (n+1) ( ) = f (n+1) ( ) (2.10)
( n 1) ! ( n 1) !
where min(x0, x1,..., xn, x) < < max(x0, x1,..., xn, x).
Since, is an unknown, it is difficult to find the value of the error. However, we can find
a bound of the error. The bound of the error is obtained as

1
E(f, x) = (x – x0) (x – x1)...(x – xn) f (n+1) ( )
(n 1) !

1
max ( x x0 ) (x x1 ) ...( x xn ) max f (n 1)
(x)
(n 1) ! a x b a x b

(2.11)
Note that in (2.11), we compute the maximum absolute value of
w(x) = (x – x0)(x – x1)...(x – xn), that is max w(x) and not the maximum of w(x).
Since the interpolating polynomial is unique, the error of interpolation is also unique,
that is, the error is same whichever form of the polynomial is used.

Example 2.1 Using the data 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 error at x = 0.15.

Solution We have two data values. The Lagrange linear polynomial is given by

( x x1 ) (x x0 )
P1(x) = f(x0) + f(x1)
( x 0 x1 ) ( x1 x 0 )

( x 0.2) ( x 0.1)
= (0.09983) + (0.19867).
( 0.1 0.2) ( 0.2 0.1)

( 0.15 0.2) ( 0.15 0.1)


Hence, f(0.15) = P1(0.15) = (0.09983) + (0.19867)
( 0.1 0.2) ( 0.2 0.1)
= (0.5) (0.09983) + (0.5) (0.19867) = 0.14925.
The truncation error is given by

(x x0 ) (x x1 ) (x 0.1) ( x 0.2 )
T.E = f ( )= (– sin ), 0.1 < < 0.2.
2 2
since f(x) = sin x. At x = 0.15, we obtain the bound as
(0.15 0.1) (0.15 0.2)
T.E = (– sin ) = 0.00125 sin
2
and T.E = 0.00125 sin 0.00125 max sin x
0.1 x 0.2

= 0.00125 sin (0.2) = 0.00125(0.19867) = 0.00025.


Example 2.2 Use Lagrange’s formula, to find the quadratic polynomial that takes the values

x 0 1 3

y 0 1 0 (A.U Nov/Dec. 2005)

Solution Since f0 = 0 and f2 = 0, we need to compute l1(x) only. We have

(x x0 ) (x x2 ) x ( x 3) 1
l1(x) = (3x – x2).
( x1 x 0 ) ( x1 x 2 ) (1) ( 2) 2

The Lagrange quadratic polynomial is given by

1 1
f(x) = l1(x) f(x1) = (3x – x2) (1) = (3x – x2).
2 2
Example 2.3 Given that f(0) = 1, f(1) = 3, f(3) = 55, find the unique polynomial of degree 2 or
less, which fits the given data.

Solution We have x0 = 0, f0 = 1, x1 = 1, f1 = 3, x2 = 3, f2 = 55. The Lagrange fundamental


polynomials are given by
(x x1 ) ( x x 2 ) ( x 1) ( x 3 ) 1 2
l0(x) = (x – 4x + 3).
(x0 x1 ) ( x 0 x 2 ) ( 1) ( 3 ) 3

(x x0 ) ( x x2 ) x ( x 3) 1
l1(x) = (3x – x2).
( x1 x 0 ) ( x1 x 2 ) (1) ( 2) 2

(x x 0 ) ( x x1 ) x ( x 1) 1 2
l2(x) = (x – x).
(x2 x 0 ) ( x 2 x1 ) (3) ( 2) 6
Hence, the Lagrange quadratic polynomial is given by
P2(x) = l0(x) f(x0) + l1(x) f(x1) + l2(x) f(x2)

1 2 1 55 2
= (x – 4x + 3) + (3x – x2) (3) + (x – x) = 8x2 – 6x + 1.
3 2 6
Example 2.4 The following values of the function f(x) = sin x + cos x, are given

x 10° 20° 30°

f(x) 1.1585 1.2817 1.3660

Construct the quadratic Lagrange interpolating polynomial that fits the data. Hence, find
f ( /12). Compare with the exact value.

Solution Since the value of f at /12 radians is required, we convert the data into radian
measure. We have

x0 = 10° = = 0.1745, x1 = 20° = = 0.3491, x2 = 30° = = 0.5236.


18 9 6
The Lagrange fundamental polynomials are given by

(x x1 ) ( x x 2 ) ( x 0.3491) ( x 0.5236 )
l0(x) =
(x0 x1 ) ( x 0 x 2 ) ( 01746
. ) ( 0.3491)

= 16.4061 (x2 – 0.8727x + 0.1828).

(x x0 ) (x x2 ) (x 0.1745 ) ( x 0.5236 )
l1(x) =
( x1 x 0 ) ( x1 x 2 ) ( 0.1746) ( 0.1745)

= – 32.8216(x2 – 0.6981x + 0.0914).

(x x 0 ) ( x x1 ) (x 0.1745 ) ( x 0.3491)
l2(x) =
(x2 x 0 ) ( x 2 x1 ) ( 0.3491) ( 0.1745)

= 16.4155(x2 – 0.5236x + 0.0609).


The Lagrange quadratic polynomial is given by
P2(x) = l0(x) f(x0) + l1(x) f(x1) + l2(x) f(x2)
= 16.4061(x2 – 0.8727x + 0.1828) (1.1585) – 32.8616 (x2 – 0.6981x
+ 0.0914) (1.2817) + 16.4155(x2 – 0.5236x + 0.0609) (1.3660)
= – 0.6374x2 + 1.0394x + 0.9950.
f( /12) = f(0.2618) = 1.2234.
The exact value is f(0.2618) = sin(0.2618) + cos(0.2618) = 1.2247.

Example 2.5 Construct the Lagrange interpolation polynomial for the data

x –1 1 4 7

f (x) –2 0 63 342

Hence, interpolate at x = 5.
Solution The Lagrange fundamental polynomials are given by
( x x1 ) ( x x 2 ) ( x x 3 ) ( x 1) ( x 4 ) ( x 7 )
l0(x) =
(x 0 x1 ) ( x 0 x 2 ) (x 0 x3 ) ( 1 1) ( 1 4 ) ( 1 7 )
1
=– (x3 – 12x2 + 39x – 28).
80
(x x0 ) ( x x 2 ) (x x3 ) ( x 1) ( x 4 ) ( x 7)
l1(x) =
( x1 x 0 ) ( x1 x 2 ) ( x1 x 3 ) (1 1) (1 4 ) (1 7)

1
= (x3 – 10x2 + 17x + 28).
36
( x x 0 ) ( x x1 ) ( x x 3 ) ( x 1) ( x 1) ( x 7)
l2(x) =
( x 2 x 0 ) ( x 2 x1 ) ( x 2 x 3 ) ( 4 1) ( 4 1) ( 4 7)

1
=– (x3 – 7x2 – x + 7).
45
( x x 0 ) ( x x1 ) ( x x 2 ) ( x 1 ) ( x 1) ( x 4 )
l3(x) =
( x 3 x 0 ) ( x 3 x1 ) ( x 3 x 2 ) ( 7 1) ( 7 1 ) ( 7 4 )

1
= (x3 – 4x2 – x + 4).
144
Note that we need not compute l1(x) since f(x1) = 0.
The Lagrange interpolation polynomial is given by
P3(x) = l0(x) f(x0) + l1(x) f(x1) + l2(x) f(x2) + l3(x) f(x3)
1 1
=– (x3 – 12x2 + 39x – 28) (– 2) – (x3 – 7x2 – x + 7) (63)
80 45
1
+ (x3 – 4x2 – x + 4) (342)
144

1 7 171 3 49 171 39 7 171 7 49 171


= x3 + x2 + x+
40 5 72 10 5 18 40 5 72 10 5 8
= x3 – 1.
Hence, f(5) = P3(5) = 53 – 1 = 124.

Remark 2 For a given data, it is possible to construct the Lagrange interpolation polynomial.
However, it is very difficult and time consuming to collect and simplify the coefficients of xi, i
= 0, 1, 2, , n. Now, assume that we have determined the Lagrange interpolation polynomial
of degree n based on the data values (xi, f(xi)), i = 0, 1, 2, , n at the (n + 1) distinct points.
Suppose that to this given data, a new value (xn+1, f(xn+1)) at the distinct point xn+1 is added at
the end of the table. If we require the Lagrange interpolating polynomial for this new data,
then we need to compute all the Lagrange fundamental polynomials again. The nth degree
Lagrange polynomial obtained earlier is of no use. This is the disadvantage of the Lagrange
interpolation. However, Lagrange interpolation is a fundamental result and is used in prov-
ing many theoretical results of interpolation.
Remark 3 Suppose that the data (xi, f(xi)), i = 0, 1, 2, , n, is given. Assume that a new value
(xn+1, f(xn+1)) at the distinct point xn+1 is added at the end of the table. The data, (xi, f(xi)),
i = 0, 1, 2, , n + 1, represents a polynomial of degree (n + 1). If this polynomial of degree
(n + 1) can be obtained by adding an extra term to the previously obtained nth degree inter-
polating polynomial, then the interpolating polynomial is said to have the permanence property.
We observe that the Lagrange interpolating polynomial does not have the permanence property.
Divided differences
Let the data, (xi, f(xi)), i = 0, 1, 2, , n, be given. We define the divided differences as follows.
First divided difference Consider any two consecutive data values (xi, f(xi)), (xi+1, f(xi+1)). Then,
we define the first divided difference as
f ( xi 1 ) f ( xi )
f [xi, xi+1] = , i = 0, 1, 2, , n – 1. (2.12)
xi 1 xi

f ( x1 ) f ( x0 ) f ( x2 ) f ( x1 )
Therefore, f [x0, x1] = , f[x1, x2] = etc.
x1 x0 x2 x1

f ( xi ) f ( xi 1 )
Note that f [xi, xi+1] = f [xi+1, xi] = .
xi xi 1 xi 1 xi
We say that the divided differences are symmetrical about their arguments.
Second divided difference Consider any three consecutive data values (xi, f(xi)), (xi+1, f(xi+1)),
(xi+2, f(xi+2)). Then, we define the second divided difference as
f [ xi 1 , x i 2 ] f [ xi , x i 1 ]
f [xi xi+1, xi+2] = i = 0, 1, 2, ,n–2 (2.13)
xi 2 xi

f [ x1, x 2 ] f [ x0 , x1 ]
Therefore, f [x0, x1, x2] = etc.
x2 x0
We can express the divided differences in terms of the ordinates. We have

1 f2 f1 f1 f0
f [x0, x1, x2] =
x2 x0 x2 x0 x1 x0

f0 f1 1 1 f2
=
( x0 x1 )( x0 x2 ) ( x2 x0 ) x2 x1 x1 x0 ( x2 x0 )( x2 x1 )

f0 f1 f2
=
( x0 x1 )( x0 x2 ) ( x1 x0 )( x1 x2 ) ( x2 x0 )( x2 x1 )
Notice that the denominators are same as the denominators of the Lagrange funda-
mental polynomials. In general, we have the second divided difference as
f [ xi 1 , x i 2 ] f [ xi , x i 1 ]
f [xi xi+1, xi+2] =
xi 2 xi
fi fi 1 fi 2
=
( xi xi 1 )( xi xi 2 ) ( xi 1 xi )( xi 1 xi 2 ) ( xi 2 xi )( xi 2 xi 1 )
The nth divided difference using all the data values in the table, is defined as
f [ x1 , x 2 ,..., x n ] f [ x 0 , x1 ,..., x n 1]
f [x0, x1, ..., xn] = (2.14)
xn x0
The nth divided difference can also be expressed in terms of the ordinates fi. The de-
nominators of the terms are same as the denominators of the Lagrange fundamental polyno-
mials.
The divided differences can be written in a tabular form as in Table 2.1.

x f(x) First d.d Second d.d Third d.d

x0 f0
f [x0, x1]
x1 f1 f [x0, x1, x2]
f [x1, x2] f [x0, x1, x2, x3]
x2 f2 f [x1, x2, x3]
f [x2, x3]
x3 f3

Example 2.6 Find the second divided difference of f(x) = 1/x, using the points a, b, c.

Solution We have
f (b) f ( a) 1 1 1 a b 1
f [a, b] = ,
b a b a b a (b a) ab ab

f (c) f (b) 1 1 1 b c 1
f [b, c] = ,
c b c b c b (c b)bc bc

f [b, c] f [ a, b] 1 1 1 c a 1
f [a, b, c] = .
c a c a bc ab (c a) abc abc
Example 2.7 Obtain the divided difference table for the data

x –1 0 2 3

–8 3 1 12 (A.U Nov/Dec 2006)


Solution We have the following divided difference table for the data.

x f(x) First d.d Second d.d Third d.d

–1 –8
3 8
= 11
0 1

1 11
0 3 =–4
2 1

1 3 4 4
1 =2
2 0 3 1
11 1
2 1 4
3 0

12 1
= 11
3 2
3 12

We mentioned earlier that the interpolating polynomial representing a given data values is
unique, but the polynomial can be represented in various forms.
We write the interpolating polynomial as
f(x) = Pn(x)
= c0 + (x – x0) c1 + (x – x0)(x – x1) c2 + ... + (x – x0)(x – x1)...(x – xn–1) cn. (2.15)
The polynomial fits the data Pn(xi) = f(xi) = fi.
Setting Pn(x0) = f0, we obtain
Pn(x0) = f0 = c0
since all the remaining terms vanish.
Setting Pn(x1) = f1, we obtain
f1 c0 f1 f0
f1 = c0 + (x1 – x0) c1, or c1 = = f [x0, x1].
x1 x0 x1 x0
Setting Pn(x2) = f2, we obtain
f2 = c0 + (x2 – x0) c1 + (x2 – x0)(x2 – x1) c2,
f2 f0 ( x2 x0 ) f [ x0 , x1 ]
or c2 =
( x2 x0 )( x2 x1 )
1 f1 f0
= f2 f0 ( x2 x0 )
( x2 x0 )( x2 x1 ) x1 x0
f0 f1 f2
=
( x0 x1 )( x0 x2 ) ( x1 x0 )( x1 x2 ) ( x2 x0 )( x2 x1 )

= f [x0, x1, x2].


By induction, we can prove that
cn = f [x0, x1, x2, ..., xn].
Hence, we can write the interpolating polynomial as
f(x) = 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] (2.16)
This polynomial is called the Newton’s divided difference interpolating polynomial.

Remark 4 From the divided difference table, we can determine the degree of the interpolat-
ing polynomial. Suppose that all the kth divided differences in the kth column are equal (same).
Then, all the (k + 1)th divided differences in the (k + 1)th column are zeros. Therefore, from
(2.16), we conclude that the data represents a kth degree polynomial. Otherwise, the data
represents an nth degree polynomial.

Remark 5 Newton’s divided difference interpolating polynomial possesses the permanence


property. Suppose that we add a new data value (xn+1, f(xn+1)) at the distinct point , at the
end of the given table of values. This new data of values can be represented by a (n + 1)th
degree polynomial. Now, the (n + 1)th column of the divided difference table contains the
(n + 1)th divided difference. Therefore, we require to add the term
(x – x0)(x – x1)...(x – xn–1)(x – xn) f [x0, x1, ....., xn, xn+1]
to the previously obtained nth degree interpolating polynomial given in (2.16).
Example 2.8 Find f(x) as a polynomial in x for the following data by Newton’s divided differ-
ence formula

x –4 –1 0 2 5

f(x) 1245 33 5 9 1335

(A.U Nov/Dec. 2004)


Solution We form the divided difference table for the data.
The Newton’s divided difference formula gives
f(x) = f(x0) + (x – x0) f [x0, x1] + (x – x0)(x – x1) f [x0, x1, x2]
+ (x – x0)(x – x1)(x – x2 f [x0, x1, x2, x3]
+ (x – x0)(x – x1)(x – x2)(x – x3) f [x0, x1, x2, x3, x4]
= 1245 + (x + 4)(– 404) + (x + 4)(x + 1)(94) + (x + 4)(x + 1) x (– 14)
+ (x + 4)(x + 1) x (x – 2)(3)
= 1245 – 404x – 1616 + (x2 + 5x + 4)(94) + (x3 + 5x2 + 4x)(– 14)
+ (x4 + 3x3 – 6x2 – 8x)(3)
= 3x4 – 5x3 + 6x2 – 14x + 5.

x f(x) First d.d Second d.d Third d.d Fourth d.d

–4 1245
– 404
–1 33 94
– 28 – 14
0 5 10 3
2 13
2 9 88
442
5 1335

Example 2.9 Find f(x) as a polynomial in x for the following data by Newton’s divided differ-
ence formula

x –2 –1 0 1 3 4

f(x) 9 16 17 18 44 81

Hence, interpolate at x = 0.5 and x = 3.1.


Solution We form the divided difference table for the given data.
Since, the fourth order differences are zeros, the data represents a third degree polyno-
mial. Newton’s divided difference formula gives the polynomial as
f(x) = f(x0) + (x – x0) f [x0, x1] + (x – x0)(x – x1) f [x0, x1, x2]
+ (x – x0)(x – x1) (x – x2) f [x0, x1, x2, x3]
= 9 + (x + 2)(7) + (x + 2)(x + 1)(– 3) + (x + 2)(x + 1) x(1)
= 9 + 7x + 14 – 3x2 – 9x – 6 + x3 + 3x2 + 2x = x3 + 17.
Hence, f(0.5) = (0.5)3 + 17 = 17.125.
f(3.1) = (3.1)3 + 17 = 47.791.
x f(x) First d.d Second d.d Third d.d Fourth d.d

–2 9
7
–1 16 –3
1 1
0 17 0 0
1 1
1 18 4 0
13 1
3 44 8
37
4 81

Example 2.10 Find f(x) as a polynomial in x for the following data by Newton’s divided differ-
ence formula

x 1 3 4 5 7 10

f(x) 3 31 69 131 351 1011

Hence, interpolate at x = 3.5 and x = 8.0. Also find, f (3) and f (1.5).
Solution We form the divided difference table for the data.

x f(x) First d.d Second d.d Third d.d Fourth d.d

1 3
14
3 31 8
38 1
4 69 12 0
62 1
5 131 16 0
110 1
7 351 22
220
10 1011

Since, the fourth order differences are zeros, the data represents a third degree
polynomial. Newton’s divided difference formula gives the polynomial as
f(x) = f(x0) + (x – x0) f [x0, x1] + (x – x0)(x – x1) f [x0, x1, x2]
+ (x – x0)(x – x1)(x – x2) f [x0, x1, x2, x3]
= 3 + (x – 1)(14) + (x – 1)(x – 3)(8) + (x – 1)(x – 3)(x – 4)(1)
= 3 + 14x – 14 + 8x2 – 32x + 24 + x3 – 8x2 + 19x – 12 = x3 + x + 1.
Hence f(3.5) P3(3.5) = (3.5)3 + 3.5 + 1 = 47.375,
f(8.0) P3(8.0) = (8.0)3 + 8.0 + 1 = 521.0.
Now, P 3(x) = 3x2 + 1, and P 3(x) = 6x.
Therefore, f (3) P (3) = 3(9) + 1 = 28, f (1.5) P (1.5) = 6(1.5) = 9.
Inverse interpolation
Suppose that a data (xi, f(xi)), i = 0, 1, 2, , n, is given. In interpolation, we predict the
value of the ordinate f(x ) at a non-tabular point x = x In many applications, we require the
value of the abscissa x for a given value of the ordinate f(x ). For this problem, we consider the
given data as ( f (xi), xi), i = 0, 1, 2, , n and construct the interpolation polynomial. That is, we
consider f(x) as the independent variable and x as the dependent variable. This procedure is
called inverse interpolation

1. Give two uses of interpolating polynomials.


Solution The first use is to reconstruct the function f(x) when it is not given explicitly
and only values of f(x) and/ or its certain order derivatives are given at a set of distinct
points called nodes or tabular points. The second use is to perform the required opera-
tions which were intended for f (x), like determination of roots, differentiation and inte-
gration etc. can be carried out using the approximating polynomial P(x). The approxi-
mating polynomial P(x) can be used to predict the value of f(x) at a non-tabular point.
2. Write the property satisfied by Lagrange fundamental polynomials li(x).
Solution The Lagrange fundamental polynomials li(x) satisfy the property
li(x) = 0, i j
= 1, i = j
3. Write the expression for the bound on the error in Lagrange interpolation.
Solution The bound for the error in Lagrange interpolation is given by
1
| E(f, x) | = | (x – x0)(x – x1)...(x – xn) | | f (n+1) ( ) |
(n 1) !
1
max |( x x 0 )( x x1 ) ... ( x x n )| max | f ( n 1)
( x )|
(n 1) ! a x b a x b

4. What is the disadvantage of Lagrange interpolation?


Solution Assume that we have determined the Lagrange interpolation polynomial of degree
n based on the data values (xi, f(xi)), i = 0, 1, 2, , n given at the (n + 1) distinct points.
Suppose that to this given data, a new value (xn+1, f(xn+1)) at the distinct point xn+1 is
added at the end of the table. If we require the Lagrange interpolating polynomial of
degree (n + 1) for this new data, then we need to compute all the Lagrange fundamental
polynomials again. The nth degree Lagrange polynomial obtained earlier is of no use.
This is the disadvantage of the Lagrange interpolation.
5. Define the permanence property of interpolating polynomials.
Solution Suppose that a data (xi, f(xi)), i = 0, 1, 2, , n, is given. Assume that a new
value (xn+1, f(xn+1)) at the distinct point xn+1 is added at the end of the table. The data,
(xi, f(xi)), i = 0, 1, 2, , n + 1, represents a polynomial of degree (n + 1). If this polynomial
of degree (n + 1) can be obtained by adding an extra term to the previously obtained nth
degree interpolating polynomial, then the interpolating polynomial is said to have the
permanence property.
6. Does the Lagrange interpolating polynomial have the permanence property?
Solution Lagrange interpolating polynomial does not have the permanence property.
Suppose that to the given data (xi, f(xi)), i = 0, 1, 2, , n, a new value (xn+1, f(xn+1)) at the
distinct point xn+1 is added at the end of the table. If we require the Lagrange interpolat-
ing polynomial for this new data, then we need to compute all the Lagrange fundamen-
tal polynomials again. The nth degree Lagrange polynomial obtained earlier is of no
use.
7. Does the Newton’s divided difference interpolating polynomial have the permanence
property?
Solution Newton’s divided difference interpolating polynomial has the permanence
property. Suppose that to the given data (xi, f(xi)), i = 0, 1, 2, , n, a new data value (xn+1,
f(xn+1)) at the distinct point xn+1 is added at the end of the table. Then, the (n + 1) th
column of the divided difference table has the (n + 1)th divided difference. Hence, the
data represents a polynomial of degree (n + 1). We need to add only one extra term
(x – x0)(x – x1)...(x – xn) f[x0, x1, ... xn + 1] to the previously obtained nth degree divided
difference polynomial.
8. Define inverse interpolation.
Solution Suppose that a data (xi, f(xi)), i = 0, 1, 2, , n, is given. In interpolation, we
predict the value of the ordinate f(x ) at a non-tabular point x = x . In many applications,
we require the value of the abscissa x for a given value of the ordinate f(x ). For this
problem, we consider the given data as ( f (xi), xi) , i = 0, 1, 2, , n and construct the
interpolation polynomial. That is, we consider f(x) as the independent variable and x as
the dependent variable. This procedure is called inverse interpolation

1. Use the Lagrange’s formula to find the quadratic polynomial that takes these values

x 0 1 3

y 0 1 0

Then, find f(2). (A.U Nov/Dec. 2005)


2. Using Lagrange interpolation, find the unique polynomial P(x) of degree 2 or less such
that P(1) = 1, P(3) = 27, P(4) = 64.
3. A third degree polynomial passes through the points (0, – 1), (1, 1), (2, 1), and (3, 2).
Determine this polynomial using Lagrange’s interpolation. Hence, find the value at 1.5.
4. Using Lagrange interpolation, find y(10) given that
y(5) = 12, y(6) = 13, y(9) = 14, y(11) = 16.
5. Find the polynomial f(x) by using Lagrange’s formula and hence find f(3) for

x 0 1 2 5

f(x) 2 3 12 147

(A.U Apr/May 2005)


6. Using Lagrange’s method, fit a polynomial to the data

x 0 1 2 4

y – 12 0 6 12

Also find y at x = 2. (A.U Nov/Dec. 2006)


7. Using Lagrange interpolation, calculate the profit in the year 2000 from the following
data.

Year 1997 1999 2001 2002

Profit in lakhs of Rs. 43 65 159 248

(A.U Nov/Dec. 2004)


8. Given the values

x 14 17 31 35

f(x) 68.7 64.0 44.0 39.1

find f(27) by using Lagrange’s interpolation formula.


(A.U May/Jun 2006, Nov/Dec. 2006)
9. From the given values, evaluate f(9) using Lagrange’s formula.

x 5 7 11 13 17

f(x) 150 392 1452 2366 5202

(A.U Nov/Dec. 2003)


10. From the given values, evaluate f(3) using Lagrange’s formula.

x –1 2 4 5

f(x) –5 13 255 625


11. Find the missing term in the table using Lagrange’s interpolation

x 0 1 2 3 4

y 1 3 9 – 81

12. Obtain the root of f(x) = 0 by Lagrange’s interpolation given that


f(30) = – 30, f(34) = – 13, f(38) = 3, f(42) = 18. (A.U Nov/Dec. 2004)
13. Using the Lagrange interpolation with the truncation error, show that the Lagrange
interpolation polynomial for f(x) = xn+1 at the points x0, x1, , xn is given by xn+1 – (x –
x0)(x – x1)...(x – xn).
3 1 1
14. Show that (A.U Nov/Dec. 2004)
abcd a abcd
15. If f(x) = 1/x2, find the divided difference f [x1, x2, x3, x4].
16. Calculate the nth divided difference of 1/x, based on the points x0, x1, x2,..., xn
17. Using Newton’s divided difference formula, determine f(3) for the data

x 0 1 2 4 5

f(x) 1 14 15 5 6

18. Using Newton’s divided difference interpolation, find y(10) given that
y(5) = 12, y(6) = 13, y(9) = 14, y(11) = 16.
19. Using divided difference formula, find u(3) given
u(1) = – 26, u(2) = 12, u(4) = 256, and u(6) = 844. (A.U Nov/Dec. 2004)
20. Find f(8) by Newton’s divided difference formula, for the data

x 4 5 7 10 11 13

f(x) 48 100 294 900 1210 2028

(A.U Apr/May 2005)


21. Using Newton’s divided difference method, find f(1.5) using the data
f(1.0) = 0.7651977, f(1.3) = 0.6200860, f(1.6) = 0.4554022,
f(1.9) = 0.2818186, and f(2.2) = 0.1103623. (A.U Nov/Dec. 2005)
22. From the given values, evaluate f(3) using Newton’s divided difference formula.

x –1 2 4 5

f(x) –5 13 255 625


Let the data (xi, f(xi)) be given with uniform spacing, that is, the nodal points are given by
xi = x0 + ih, i = 0, 1, 2, ..., n. In this case, Lagrange and divided difference interpolation
polynomials can also be used for interpolation. However, we can derive simpler interpolation
formulas for the uniform mesh case. We define finite difference operators and finite differences
to derive these formulas.
Finite difference operators and finite differences
We define the following five difference operators.
Shift operator E When the operator E is applied on f( xi ), we obtain
Ef(xi) = f(xi + h) = f(xi+1). (2.17)
That is, Ef(x0) = f(x0 + h) = f(x1), Ef(x1) = f(x1 + h) = f(x2), etc.
Therefore, the operator E when applied on f(x) shifts it to the value at the next nodal point. We
have
E2 f(xi) = E[Ef(xi)] = E[f(xi + h)] = f(xi + 2h) = f(xi+2).
In general, we have
Ek f(xi) = f(xi + kh) = f(xi+k ) (2.18)
where k is any real number. For example, we define
h
E 1/ 2 f ( xi ) f xi f ( xi 1/ 2 ) .
2
Forward difference operator When the operator is applied on f(xi), we obtain
f(xi) = f(xi + h) – f(xi) = fi+1 – fi . (2.19)
That is, f(x0) = f(x0 + h) – f(x0) = f(x1) – f(x0),
f(x1) = f(x1 + h) – f(x1) = f(x2) – f(x1), etc.
These differences are called the first forward differences.
The second forward difference is defined by
2 f(xi) = [ f(xi)] = [f(xi + h) – f(xi)] = f(xi + h) – f(xi)
= [f(xi + 2h) – f(xi + h)] – [f(xi + h) – f(xi)]
= f(xi + 2h) – 2f(xi + h) + f(xi) = fi+2 – 2fi+1 + fi.
The third forward difference is defined by
3 f(xi) = [ 2 f(xi)] = f(xi + 2h) – 2 f(xi + h) + f(xi)
= fi+3 – 3fi+2 + 3fi+1 – fi.
Now, from (2.18) and (2.19), we get
f(xi) = f(xi + h) – f(xi) = E fi – fi = (E – 1) fi.
Comparing, we obtain the operator relation
= E – 1, or E = 1 + . (2.20)
Using this relation, we can write the nth forward difference of f(xi) as
n
n!
n f(xi) = (E – 1)n f(xi) = ( 1) k fi n k. (2.21)
k 0
k ! (n k ) !

The forward differences can be written in a tabular form as in Table 2.2.

x f(x) f 2f 3f

x0 f(x0)
f0 = f1 – f0
x1 f(x1) 2 f0 = f1 – f0
f1 = f2 – f1 3f = 2f – 2f
0 1 0
x2 f(x2) 2f = f2 – f1
1
f2 = f3 – f2
x3 f(x3)

Backward difference operator When the operator is applied on f(xi), we obtain


f(xi) = f(xi) – f(xi – h) = fi – fi–1. (2.22)
That is, f(x1) = f(x1) – f(x0),
f(x2) = f(x2) – f(x1), etc.
These differences are called the first backward differences.
The second backward difference is defined by
2 f(xi) = [ f(xi)] = [f(xi) – f(xi – h)] = f(xi) – f(xi – h)
= f(xi) – f(xi – h)] – [f(xi – h) – f(xi – 2h)]
= f(xi) – 2f(xi – h) + f(xi – 2h) = fi – 2fi–1 + fi–2
The third backward difference is defined by
3 f(xi) = [ 2 f(xi)] = f(xi) – 2 f(xi – h) + f(xi – 2h)
= fi – 3fi–1 + 3fi–2 – fi–3.
Now, from (2.18) and (2.22), we get
f(xi) = f(xi) – f(xi – h) = fi – E–1 fi = (1 – E–1)fi.
Comparing, we obtain the operator relation
= 1 – E–1, or E–1 = 1 – , or E = (1 – )–1. (2.23)
Using this relation, we can write the nth backward difference of f(xi) as
n
n!
n f(xi) = (1 – E–1)n f(xi) = ( 1) k fi k (2.24)
k 0
k ! (n k) !

The backward differences can be written in a tabular form as in Table 2.3.

x f(x) f 2f 3f

x0 f(x0)
f1 = f1 – f0
2
x1 f(x1) f2 = f2 – f1
f2 = f2 – f1 3f = 2 f3 – 2 f2
3
x2 f(x2) 2 f3 = f3 – f2
f3 = f3 – f2
x3 f(x3)

Remark 6 From the difference tables 2.2, 2.3, we note that the numbers (values of differ-
ences) in all the columns in the two tables are same. We identify these numbers as the re-
quired forward or backward difference. For example, from the columns of the table, we have
f0 = f1, f1 = f2, f2 = f3, ..., 3f = 3f
0 3.

Example 2.11 Construct the forward difference table for the data

x –1 0 1 2

f(x) –8 3 1 12

Solution We have the following difference table.

x f(x) f 2f 3f

–1 –8
3 + 8 = 11
0 3 – 2 – 11 = –13
1–3=–2 13 + 13 = 26
1 1 11 + 2 = 13
12 – 1 = 11
2 12
Example 2.12 Construct the backward difference table for the data

x –1 0 1 2

f(x) –8 3 1 12

Solution We have the following difference table.

x f(x) f 2f 3f

–1 –8
3 + 8 = 11
0 3 – 2 – 11 = –13
1–3=–2 13 + 13 = 26
1 1 11 + 2 = 13
12 – 1 = 11
2 12

Central difference operator When the operator is applied on f(xi), we obtain


h h
f(xi) = xi f xi fi 1/ 2 fi 1/ 2 . (2.25)
2 2
We note that the ordinates on the right hand side of (2.25) are not the data values. These
differences are called the first central differences. Alternately, we can define the first central
differences as
h
f xi fi 1/ 2 f ( xi h) f ( xi ) fi 1 fi . (2.26)
2
That is, f1/2 = f1 – f0, f3/2 = f2 – f1, etc. The ordinates on the right hand side of (2.26) are the
data values.
The second central difference is defined by
2 f(xi) = [ f(xi)] = [fi+1/2 – fi–1/2 ] = fi+1/2 – fi–1/2
= [fi+1 – fi] – [fi – fi–1] = fi+1 – 2fi + fi–1.
The third central difference is defined by
3 f(xi) = [ 2 f(xi)] = fi+1 – 2 fi + fi–1
= (fi+3/2 – fi+1/2) – 2(fi+1/2 – fi–1/2) + (fi–1/2 – fi–3/2)
= fi+3/2 – 3fi+1/2 + 3fi–1/2 – f i–3/2 .
All the odd central differences contain non-nodal values and the even central differences contain
nodal values.
Now, from (2.18) and (2.25), we get
f(xi) = fi+1/2– fi–1/2 = E1/2 fi – E–1/2 fi = (E1/2 – E–1/2 ) fi.
Comparing, we obtain the operator relation
= (E1/2 – E–1/2). (2.27)
Using this relation, we can write the nth central difference of f(xi) as
n
n!
n f(xi) = (E1/2 – E–1/2)n f(xi) = ( 1) k f . (2.28)
k 0
k ! (n k) ! i + (n/2) – k

The central differences can be written in a tabular form as in Table 2.4.

2 3
x f(x) f f f

x0 f(x0)

f1/2 = f1 – f0

x1 f(x1) 2f = f3/2 – f1/2


1

3 2 2
f3/2 = f2 – f1 f3/2 = f2 – f1
2
x2 f(x2) f2 = f5/2 – f3/2

f5/2 = f3 – f2

x3 f(x3)

Very often, we may denote the reference point as x0 and the previous points as x–1, x–2,
... and the later points as x1, x2, .... Then, the central difference table can be written as in
Table 2.5. Note that all the differences of even order lie on the same line as the abscissa and
the ordinate.
Remark 7 We show that nf = nf = n fi+(n/2).
i i+n

We have = 1 – E–1 = (E – 1) E–1 = E–1.


nf = nE–n fi+n = nf
i+n i.

= (E1/2 – E–1/2) = (E – 1)E–1/2 = E–1/2.


n fi+(n/2) = n E–n/2 fi+(n/2) = nf
i.

Remark 8 Let Pn(x) = a0xn + a1xn–1 + a2xn–2 + ... + an be a polynomial of degree n. Then,
k Pn(x) = 0, for k > n, and k Pn(x) = 0, for k > n,
= a0(n !), for k = n = a0 (n !), for k = n.
x f(x) f 2f 3f 4f

x–2 f–2
f–3/2
x–1 f–1 2 f–1
f–1/2 3f
–1/2

x0 f0 2 f0 4f
0

f1/2 3f
1/2

x1 f1 2 f1
f3/2

x2 f2

Remark 9 For well behaved functions, the forward differences, backward differences and
central differences decrease in magnitude along each column. That is, the second difference is
smaller in magnitude than the first difference, the third difference is smaller in magnitude
than second difference etc.

Mean operator When the operator is applied on f(xi), we obtain

1 h h 1 1 1/ 2 1/ 2
f(xi) = f xi f xi fi 1/ 2 fi 1/ 2 E E fi
2 2 2 2 2

Comparing, we have the operator relation


1 1/ 2
E E 1/ 2 . (2.29)
2
Example 2.13 Compute 3(1 – 2x)(1 – 3x)(1 – 4x).

Solution We have
3(1 – 2x)(1 – 3x)(1 – 4x) = 3(– 24x3 + lower order terms)
= – 24 (3 !) = – 144
since 3 (polynomial of degree 2 and less) = 0.
Example 2.14 Construct the forward difference table for the sequence of values
f(0, 0, 0, , 0, 0, 0)
where is the magnitude of the error in one ordinate value and all other ordinates are exact.
Show that the errors propagate and increase in magnitude and that the errors in each column
are binomial coefficients.
Solution We have the following difference table. From the table, it can be observed that the
errors propagate and increase in magnitude and that the errors in each column are binomial
coefficients.
f(x) f 2 f 3 f 4 f 5 f 6 f

0
0
0 0
0
0 –4
–3 10
–2 6 – 20
– 3 – 10
0 –4
0 –
0 0
0
0

Example 2.15 Prove the following.


1/2
2
(i) = (1 – )–1/2 (ii) = 1
4

f(x) f(x) f(x) f(x) g(x)


(iii) (fi2) = (fi + fi+1) fi (iv) .
g(x) g(x) g(x h)
Solution
(i) (1 – )–1/2 = (1 – E–1) [1 – (1 – E–1)]–1/2
= (1 – E–1)E1/2 = E1/2 – E–1/2 = .
(ii) 2 = (E1/2 – E–1/2)2 = E + E–1 – 2.

2 1/ 2 1/ 2
1 1
1 1 (E E 2)
4 4

1 1 1 1/2
= [E E 2]1/ 2 [E + E–1/2 ] = .
2 2
2
(iii) (fi2) = fi 1 fi2 ( fi 1 fi )( fi 1 fi ) ( fi 1 fi ) f i .

f ( x) f (x h) f ( x) f (x h) g( x) f (x) g (x h)
(iv)
g ( x) g( x h) g( x) g ( x) g( x h)
g( x)[ f ( x h) f ( x)] f ( x)[ g ( x h) g( x)]
=
g ( x) g ( x h)
g( x) f ( x) f ( x) g( x)
= .
g(x) g(x h)
Relations between differences and derivatives
We write Ef(x) as

h2
Ef(x) = f(x + h) = f(x) + hf (x) + f (x) + ...
2

h2 D2
= 1 hD ... f(x) = ehD f(x).
2!

where D r f(x) = dr f / dxr, r = 1, 2, ...


Hence, we obtain the operator relation
E = ehD or hD = ln(E). (2.30)
In terms of the forward, backward and central differences, we obtain
1 2 1 3
hD ln( E) ln(1 ) ... (2.31)
2 3
1 1 2 1 3
hD ln( E ) ln(1 ) ln(1 ) ... (2.32)
2 3
Also, = E1/2 – E–1/2 = ehD/2 – e–hD/2 = 2 sinh (hD/2). (2.33)
Hence, hD = 2 sinh–1 ( /2) and h2D2 = 4 [sinh–1 ( /2)]2. (2.34)
Using the Taylor series expansions, we get
f(x) = f(x + h) – f(x)

h2 h2
= f ( x) hf ( x) f ( x) ... f ( x) hf ( x) f ( x) + ...
2 2

Neglecting the higher order terms, we get the approximation


1
f(x) hf (x), or f (x) f(x). (2.35)
h
The error term is given by
1 h
f ( x) f ( x) f ( x) ...
h 2
Hence, we call the approximation given in (2.35) as a first order approximation or of order
O(h).
We have 2 f(x) = f(x + 2h) – 2f(x + h) + f(x)

4 h2 8h 3
= f ( x) 2 hf ( x) f ( x) f ( x) ...
2 6

h2 h3
– 2 f ( x) hf ( x) f ( x) f ( x) ... + f(x)
2 6

= h2 f (x) + h3 f (x) + ...


Neglecting the higher order terms, we get the approximation

2f(x)
1
h2 f (x), or f (x) 2 f(x). (2.36)
h2
The error term is given by
1 2
f ( x) f ( x) h f ( x) ...
h2
Hence, we call the approximation given in (2.36) as a first order approximation or of
order O(h).
Similarly, we have the following results for backward differences.
1
f(x) hf (x), or f ( x) f ( x) [O(h) approximation] (2.37)
h
1 2
2 f(x) h2f (x), or f ( x ) f ( x ) . [O(h) approximation] (2.38)
h2
For the central differences, we obtain
h h
f ( x) f x f x
2 2

h h2 h3
= f ( x) f ( x) f ( x) f ( x) ...
2 8 48

h h2 h3
– f ( x) f ( x) f ( x) f ( x) ...
2 8 48

h3
= hf (x) + f ( x) ...
24
Neglecting the higher order terms, we get the approximation
1
f(x) h f (x), or f (x) f(x). (2.39)
h
The error term is given by

1 h2
f ( x) f ( x) f ( x) ...
h 24
Hence, we call the approximation given in (2.39) as a second order approximation or of
order O(h2).
We have 2 f(x) = f(x + h) – 2f(x) + f(x – h)

h2 h2
= f ( x) hf ( x) f ( x) ... – 2 f(x) + f ( x) hf ( x) f ( x) ...
2 2

Neglecting the higher order terms, we get the approximation

2 1
f(x) h2 f (x), or f (x) 2 f(x). (2.40)
h2
The error term is given by

1 2 h 2 ( iv)
f (x) – 2 f(x) = – f ( x) + ...
h 12
Hence, we call the approximation given in (2.35) as a second order approximation or of
order O(h2).
Note that the central differences give approximations of higher order because of sym-
metry of the arguments.
The divided differences are also related to forward differences and backward differences.
In the uniform mesh case, the divided differences can be written as
f ( xi 1 ) f ( xi ) 1 1
f [ xi , x i 1 ] fi fi 1.
xi 1 xi h h

f [ xi 1 , x i 2 ] f [ xi , x i 1 ] (1/h) fi 1 (1/h) fi
f [ xi , x i 1 , x i 2 ]
xi 2 xi 2h

1 2 1 2
= fi fi 2.
2! h2 2 ! h2
By induction we can prove that the nth divided difference can be written as
1 n 1 n
f [ x0 , x1 , ..., x n ] f0 fn . (2.41)
n ! hn n !hn

Let h be the step length in the given data.


In terms of the divided differences, we have the interpolation formula as
f(x) = f (x0) + (x – x0) f [x0, x1] + (x – x0)(x – x1) f [x0, x1, x2] + ...
Using the relations for the divided differences given in (2.36)
1 n
f [ x0 , x1 , ..., xn ] f0
n ! hn
2
f0 f0
we get f(x) = f(x0) + (x – x0) (x – x0)(x – x1) + ...
1! h 2 ! h2

n
f0
+ (x – x0)(x – x1)...(x – xn–1) (2.42)
1! hn
This relation is called the Newton’s forward difference interpolation formula.

Suppose that we want to interpolate near the point . Set x = x0 + sh. Then,
x – xi = x0 + sh – (x0 + ih) = (s – i)h.
Therefore, x – x0 = sh, x – x1 = (s – 1)h, x – x2 = (s – 2)h, etc.
Substituting in (2.42), we obtain
f(x) = f(x0 + sh)
s(s 1) 2 s(s 1)(s 2) ... (s n 1) n
= f(x0) + s f0 + f0 ... f0 (2.43)
2! n!

We note that the coefficients are the binomial coefficients .

Hence, we can write the formula (2.43) as


f(x) = f(x0 + sh)
= sC0 f(x0) + sC1 f0 + sC2 2f + ... + sCn nf
0 0
Note that s = [(x – x0)/h] > 0.
This is an alternate form of the Newton’s forward difference interpolation formula.
Error of interpolation The error of interpolation is same as in the Lagrange interpolation.
Therefore, error of interpolation is given by
(x x0 )( x x1 )...( x xn )
En(f, x) = f (n 1)
( )
(n 1) !

s( s 1)( s 2)..( s n)
= hn 1
f (n 1)
( ) sCn 1 hn 1
f (n 1)
( ) (2.44)
( n 1) !
where 0 < < n. The coefficient in the error expression is the next binomial coefficient sCn+1.
Remark 10 The Newton’s forward difference formula has the permanence property. Suppose
we add a new data value (xn+1, f(xn+1)) at the end of the given table of values. Then, the
(n + 1)th column of the forward difference table has the (n + 1)th forward difference. Then, the
Newton’s forward difference formula becomes
2
f0 f0
f(x) = f(x0) + (x – x0) (x x0 )( x x1 ) + ...
1! h 2 ! h2
n 1
f0
+ (x – x0)(x – x1)...(x – xn) 1
(n 1) ! h n
Example 2.16 Derive the Newton’s forward difference formula using the operator relations.
Solution We have
f(x0 + sh) = Es f(x0) = (1 + )s f(x0).
Symbolically, expanding the right hand side, we obtain
f(x0 + sh) = (sC0 + sC1 + sC2 2 + ...) f(x0)
= sC0 f(x0) + sC1 f(x0) + sC2 2 f(x0) + ... + sCn n f(x0) + ...
We neglect the (n + 1)th and higher order differences to obtain the Newton’s forward
difference formula as
f(x0 + sh) = (sC0 + sC1 + sC2 2 + ...) f(x0)
= sC0 f(x0) + sC 1 f(x0) + sC2 2f(x n
0) + ... + sCn f(x0).
Example 2.17 For the data

x –2 –1 0 1 2 3

f (x) 15 5 1 3 11 25

construct the forward difference formula. Hence, find f (0.5).


Solution We have the following forward difference table.

x f(x) f 2f 3f

–2 15
– 10
–1 5 6
–4 0
0 1 6
2 0
1 3 6
8 0
2 11 6
14
3 25

From the table, we conclude that the data represents a quadratic polynomial. We have
h = 1. The Newton’s forward difference formula is given by
2
f0 f0
f(x) = f(x0) + (x – x0) (x x0 )( x x1 )
h 2 h2
6
= 15 + (x + 2)(– 10) + (x + 2) (x + 1)
2
= 15 – 10x – 20 + 3x2 + 9x + 6 = 3x2 – x + 1.
We obtain f(0.5) = 3(0.5)2 – 0.5 + 1 = 0.75 – 0.5 + 1 = 1.25.

Again, we use the Newton’s divided difference interpolation polynomial to derive the Newton’s
backward difference interpolation formula. Since, the divided differences are symmetric with
respect to their arguments, we write the arguments of the divided differences in the order
xn, xn–1,..., x1, x0. The Newton’s divided difference interpolation polynomial can be written as
f(x) = f(xn) + (x – xn) f [xn, xn–1] + (x – xn)(x – xn–1) f [xn, xn–1, xn–2] + ...
+ (x – xn)(x – xn–1) ... (x – x1) f [xn, xn–1,..., x0] (2.45)
Since, the divided differences are symmetric with respect to their arguments, we have
1
f [xn, xn–1] = f [xn–1, xn] = fn ,
h
1 2
f[xn, xn–1, xn–2] = f [xn–2, xn–1, xn] = fn , ....,
2 ! h2

1 n
f [xn, xn–1, ..., x0] = f [x0, x1,..., xn] = fn .
n ! hn
Substituting in (2.45), we obtain the Newton’s backward difference interpolation formula as
1 1 2
f(x) = f(xn) + (x – xn) f ( xn ) ( x xn )( x xn 1 ) f ( xn ) ...
1! h 2 ! h2

1 n
+ (x – xn)(x – xn–1) ... (x – x1) f ( xn ) . (2.46)
n ! hn
Let x be any point near xn. Let x – xn = sh. Then,
x – xi = x – xn + xn – xi = x – xn + (x0 + nh) – (x0 + ih)
= sh + h(n – i) = (s + n – i)h, i = n – 1, n – 2, ..., 0.
Therefore, x – xn = sh, x – xn–1 = (s + 1)h, x – xn–2 = (s + 2)h, ..., x – x1 = (s + n – 1)h.
Substituting in (2.46), we obtain the formula as
s(s 1)
f(x) = f(xn + sh) = f(xn) + s f(xn) + 2 f(xn) + ...
2!

s(s 1)(s 2) ... (s n 1) n


+ f ( xn ) . (2.47)
n!
Note that s = [(x – xn )/h] < 0. The magnitudes of the successive terms on the right hand
side become smaller and smaller. Note that the coefficients are the binomial coefficients
[(– 1)k (– s)Ck].
Error of interpolation The expression for the error becomes
(x xn )( x x n 1 ) ... ( x x0 )
En(f, x) = f (n 1)
( )
(n 1) !

s(s 1)(s 2) ... (s n)


= hn 1
f (n 1)
( ) (2.48)
(n 1) !
where 0 < < n.
Remark 11 As in divided differences, given a table of values, we can determine the degree of
the forward/ backward difference polynomial using the difference table. The kth column of the
difference table contains the kth forward/ backward differences. If the values of these differ-
ences are same, then the (k + 1)th and higher order differences are zero. Hence, the given data
represents a kth degree polynomial.
Remark 12 We use the forward difference interpolation when we want to interpolate near
the top of the table and backward difference interpolation when we want to interpolate near
the bottom of the table.

Example 2.18 Derive the Newton’s backward difference formula using the operator relations.
Solution Let x = xn + sh. Then, s = [(x – xn)/h] < 0
We have f(xn + sh) = Es f(xn) = (1 – )–s f(xn)
Symbolically, expanding the right hand side, we obtain

2
s( s 1) ... ( s n 1) n
f(xn + sh) = f(xn) + s f(xn) + f(xn) + ... + f(xn) + ...
n!

We neglect the (n + 1)th and higher order differences to obtain the Newton’s backward
difference formula as

2
s(s 1) ... ( s n 1) n
f(xn + sh) = f(xn) + s f(xn) + f(xn) + ... + f(xn).
n!

Example 2.19 For the following data, calculate the differences and obtain the Newton’s
forward and backward difference interpolation polynomials. Are these polynomials different?
Interpolate at x = 0.25 and x = 0.35.

x 0.1 0.2 0.3 0.4 0.5

f(x) 1.40 1.56 1.76 2.00 2.28

Solution The step length is h = 0.1. We have the following difference table.
Since, the third and higher order differences are zero, the data represents a quadratic
polynomial. The third column represents the first forward/ backward differences and the fourth
column represents the second forward/ backward differences.
The forward difference polynomial is given by
2
f0 f0
f(x) = f(x0) + (x – x0) + (x – x0) (x – x1)
h 2 ! h2

0.16 0.04
= 1.4 + (x – 0.1) (x 0.1)( x 0.2)
0.1 0.02

= 2x2 + x + 1.28.
The backward difference polynomial is given by
2
fn fn
f(x) = f(xn) + (x – xn) (x xn )( x xn 1 )
h 2 ! h2

0.28 0.04
= 2.28 + (x – 0.5) (x 0.5)( x 0.4)
0.1 0.02

= 2x2 + x + 1.28.
Both the polynomials are identical, since the interpolation polynomial is unique. We obtain
f(0.25) = 2(0.25)2 + 0.25 + 1.28 = 1.655
f(0.35) = 2(0.35)2 + (0.35) + 1.28 = 1.875.

x f(x) f 2f 3f 4f

0.1 1.40
0.16
0.2 1.56 0.04
0.20 0.0
0.3 1.76 0.04 0.0
0.24 0.0
0.4 2.00 0.04
0.28
0.5 2.28

Example 2.20 Using Newton’s backward difference interpolation, interpolate at from


the following data.

x 0.1 0.3 0.5 0.7 0.9 1.1

f(x) – 1.699 – 1.073 – 0.375 0.443 1.429 2.631

Solution The step length is h = 0.2. We have the difference table as given below.
Since the fourth and higher order differences are zero, the data represents a third de-
gree polynomial. The Newton’s backward difference interpolation polynomial is given by
1 1 2
f(x) = f(xn) + (x – xn) f(xn) + (x – xn)(x – xn–1) f(xn)
1! h 2 ! h2
1 3
+ (x – xn)(x – xn–1)(x – xn–2) f ( xn )
3 ! h3

1.202 0.216
= 2.631 + (x – 1.1) + (x – 1.1)(x – 0.9)
0.2 2(0.04)

0.048
+ (x – 1.1)(x – 0.9)(x – 0.7)
6( 0.008)
= 2.631 + 6.01(x – 1.1) + 2.7(x – 1.1)(x – 0.9) + (x – 1.1)(x – 0.9)(x – 0.7)
Since, we have not been asked to find the interpolation polynomial, we may not sim-
plify this expression. At x = 1.0, we obtain
f(1.0) = 2.631 + 6.01(1.0 – 1.1) + 2.7(1.0 – 1.1)(1.0 – 0.9) + (1.0 – 1.1)(1.0 – 0.9)(1.0 – 0.7)
= 2.631 + 6.01(– 0.1) + 2.7(– 0.1)(0.1) + (– 0.1)(0.1)(– 0.3) = 2.004.

x f(x) f 2f 3f 4f 5f

0.1 – 1.699
0.626
0.3 – 1.073 0.072
0.698 0.048
0.5 – 0.375 0.120 0.0
0.818 0.048 0.0
0.7 0.443 0.168 0.0
0.986 0.048
0.9 1.429 0.216
1.202
1.1 2.631

1. Write the expression for the derivative operator D in terms of the forward difference
operator .
Solution The required expression is
1 2
1 3
hD = ln(E) = ln(1 + ) = – + – ...
2 3
1 1 1 1 2 1 3
or D= ln(E) = ln (1 + ) = ...
h h h 2 3

2. Write the expression for the derivative operator D in terms of the backward difference
operator .
Solution The required expression is
1 1
hD = ln(E) = ln(1 – )–1 = – ln(1 – )= + 2 + 3 + ...
2 3

1 1 1 1 1 2 1 3
or D= ln(E) = ln (1 – )–1 = – ln(1 – )= ... .
h h h h 2 3

1
3. What is the order of the approximation f (x) f(x) ?
h

1 h
Solution The error term is given by f (x) – f(x) = – f ( x) ...
h 2
Hence, it is a first order approximation or of order O(h).
1 2
4. What is the order of the approximation f ( x) f ( x) ?
h2

1 2
Solution The error term is given by f ( x) f ( x) h f ( x) ...
h2
Hence, it is a first order approximation or of order O(h).
1 2
5. What is the order of the approximation f ( x) f ( x) ?
h2

1 h2 (iv)
Solution The error term is given by f ( x) 2
f ( x) f ( x) ...
h2 12
Hence, it is a second order approximation or of order O(h2).
6. Give the relation between the divided differences and forward or backward differences.
Solution The required relation is
1 n 1 n
f [x0, x1, ..., xn] = f0 fn .
n ! hn n ! hn
7. Does the Newton’s forward difference formula has permanence property ?
Solution Yes. The Newton’s forward difference formula has permanence property.
Suppose we add a new data value (xn+1, f(xn+1)) at the end of the given table of values.
Then, the (n + 1)th column of the forward difference table has the (n + 1)th forward
difference. Then, the Newton’s forward difference formula becomes
2
f0 f0
f(x) = f(x0) + (x – x0) (x x0 )( x x1 ) + ...
1! h 2 ! h2
n 1
f0
+ (x – x0)(x – x1) ... (x – xn) 1
(n 1) ! h n
8. For performing interpolation for a given data, when do we use the Newton’s forward
and backward difference formulas?
Solution We use the forward difference interpolation when we want to interpolate
near the top of the table and backward difference interpolation when we want to
interpolate near the bottom of the table.
9. Can we decide the degree of the polynomial that a data represents by writing the forward
or backward difference tables?
Solution Given a table of values, we can determine the degree of the forward/ backward
difference polynomial using the difference table. The kth column of the difference table
contains the kth forward/ backward differences. If the values of these differences are
same, then the (k + 1)th and higher order differences are zero. Hence, the given data
represents a kth degree polynomial.
10. If x = x0 + sh, write the error expression in the Newton’s forward difference formula.
Solution The error expression is given by
s(s 1)(s 2)..(s n)
En(f, x) = hn 1
f (n 1)
( ) sCn 1h n 1 f (n 1)
( ). 0 n.
(n 1) !
11. If x = xn + sh, write the error expression in the Newton’s backward difference formula.
Solution The error expression is given by
s( s 1)( s 2)..(s n)
E n(f, x) = hn 1
f (n 1)
( ). 0 n.
(n 1) !

1. Prove the following.


n
1 fi 2
(i) . (ii) + = . (iii) fk fn 1 f0 .
fi fi f i 1 k 0

(iv) – =– . (v) =( + )/2.


2 2
(iv) (1 + )(1 – ) = 1. (vii) = E1/2. (viii) 1 = 1 + (1/2) 2.
2. Using the Newton’s forward difference formula, find the polynomial f(x) satisfying the
following data. Hence, evaluate y at x = 5.

x 4 6 8 10

y 1 3 8 10 (A.U. May/Jun 2006)


3. A third degree polynomial passes through the points (0, – 1), (1, 1), (2, 1) and (3, – 2).
Determine this polynomial using Newton’s forward interpolation formula. Hence, find
the value at 1.5.
4. Using the Newton’s forward interpolation formula, find the cubic polynomial which
takes the following values.

x 0 1 2 3

y 1 2 1 10

Evaluate y(4) using Newton’s backward interpolation formula. Is it the same as ob-
tained from the cubic polynomial found above?
5. Obtain the interpolating quadratic polynomial for the given data by using the Newton’s
forward difference formula

x 0 2 4 6

y –3 5 21 45

(A.U. Nov/Dec 2003)


6. For the following data, estimate the number of persons earning weekly wages between
60 and 70 rupees.

Wage (in Rs.) below 40 40–60 60–80 80–100 100–120

No. of persons 250 120 100 70 50


(in thousands)

(A.U. Nov/Dec 2003)


7. Using the Newton’s backward interpolation formula construct an interpolation polyno-
mial of degree 3 for the data
f(– 0.75) = – 0.07181250, f(– 0.5) = – 0.024750, f(– 0.25) = 0.33493750, f(0) = 1.1010.
Hence, find f(– 1/3). (A.U. Apr/May 2003)
8. Using the Newton’s forward difference formula, find the polynomial f(x) satisfying the
following data. Hence, find f(2).

x 0 5 10 15

y 14 379 1444 3584

(A.U. Apr/May 2004)


9. The following data represents the function f(x) = e x.

x 1 1.5 2.0 2.5

y 2.7183 4.4817 7.3891 12.1825


Estimate the value of f(2.25) using the (i) Newton’s forward difference interpolation
and (ii) Newton’s backward difference interpolation. Compare with the exact value.
10. The following data represents the function f(x) = cos (x + 1).

x 0.0 0.2 0.4 0.6

f(x) 0.5403 0.3624 0.1700 – 0.0292

Estimate the value of f(0.5) using the Newton’s backward difference interpolation. Com-
pare with the exact value.
11. The following data are part of a table for , where x is in radians.

x 0.1 0.2 0.3 0.4

f(x) 9.9500 4.9003 3.1845 2.3027

Calculate f(0.12), (i) by interpolating directly from the table, (ii) by first tabulating x
f(x) and then interpolating from the table. Explain the difference between the results.

In the earlier days of development of engineering devices, the draftsman used a device to
draw smooth curves through a given sets of points such that the slope and curvature are also
continuous along the curves, that is, f(x), f (x) and f (x) are continuous on the curves. Such a
device was called a spline and plotting of the curve was called spline fitting.
We now define a spline.
Let the given interval [a, b] be subdivided into n subintervals [x0, x1], [x1, x2], ...,
[xn–1, xn] where a = x0 < x1 < x2 < ... < xn = b. The points x0, x1, ..., xn are called nodes or knots and
x1, ..., xn–1 are called internal nodes.
Spline function A spline function of degree n with nodes x0, x1, ..., xn, is a function F(x)
satisfying the following properties.
(i) F(xi) = f(xi), i = 0, 1, ...., n. (Interpolation conditions).
(ii) On each subinterval [xi–1, xi], 1 i n, F(x) is a polynomial of degree n.
(iii) F(x) and its first (n – 1) derivatives are continuous on (a, b).
For our discussion, we shall consider cubic splines only. From the definition, a cubic spline
has the following properties.
(i) F(xi) = f(xi), i = 0, 1, ..., n. (Interpolation conditions).
(ii) On each subinterval [xi–1, xi], 1 i n, F(x) is a third degree (cubic) polynomial.
(iii) F(x), F (x) and F (x) are continuous on (a, b).
Let F(x) = Pi(x) = aix3 + bix2 + cix + di on [xi–1, xi]
and F(x) = Pi+1(x) = ai+1x3 + bi+1x2 + ci+1x + di+1 on [xi, xi+1].
On each interval, we have four unknowns ai, bi, ci and di, i = 1, 2, ..., n. Therefore, the
total number of unknowns is 4n.
Continuity of F(x), F (x) and F (x) on (a, b) implies the following.
(i) Continuity of F(x) :
On [xi–1, xi] : Pi (xi) = f(xi) = ai xi3 bi xi2 ci x i di

On [xi, xi+1] : Pi+1(xi) = f(xi) = ai+1 xi3 bi 1 xi2 ci 1 xi di 1, i = 1, 2, ..., n – 1. (2.49)


(ii) Continuity of F (x) :

3ai x i2 2bi xi ci 3ai 1 x i2 2bi 1x i ci 1 , i = 1, 2, ..., n – 1. (2.50)


(iii) Continuity of F (x) :
6aixi + 2bi = 6ai+1xi + 2bi+1, i = 1, 2, ..., n – 1. (2.51)
At the end points x0 and xn, we have the interpolation conditions
f(x0) = a1 x03 b1 x02 c1 x 0 d1,

and f(xn) = an xn3 bn xn2 cn xn dn . (2.52)


We have 2(n – 1) equations from (2.49), (n – 1) equations from (2.50), (n – 1) equations
from (2.51) and 2 equations from (2.52). That is, we have a total of 4n – 2 equations. We need
two more equations to obtain the polynomial uniquely. There are various types of conditions
that can be prescribed to obtain two more equations. We shall consider the case of a natural
spline, in which we set the two conditions as F (x0) = 0, F (xn) = 0.
The above procedure is a direct way of obtaining a cubic spline. However, we shall
derive a simple method to determine the cubic spline.
Example 2.21 Find whether the following functions are cubic splines ?
(i) f(x) = 5x3 – 3x2, – 1 x 0 (ii) f(x) = – 2x3 – x2, – 1 x 0
=– 5x3 – 3x2, 0 x 1. = 2x3 + x2, 0 x 1.
Solution In both the examples, f(x) is a cubic polynomial in both intervals (– 1, 0) and (0, 1).
(i) We have
lim f ( x) 0 lim f ( x) .
x 0 x 0

The given function f(x) is continuous on (– 1, 1).


f (x) = 15x2 – 6x, –1 x 0
= – 15x2 – 6x, 0 x 1.
We have lim f ( x) 0 lim f ( x) .
x 0 x 0

The function f (x) is continuous on (– 1, 1).


f (x) = 30x – 6, –1 x 0
= – 30x – 6, 0 x 1.
We have lim f ( x) 6 lim f ( x) .
x 0 x 0

The function f (x) is continuous on (– 1, 1).


We conclude that the given function f(x) is a cubic spline.
(ii) We have
lim f ( x) 0 lim f ( x) .
x 0 x 0

The given function f(x) is continuous on (– 1, 1).


f (x) = – 6x2 – 2x, –1 x 0
= 6x2 + 2x, 0 x 1.

We have lim f ( x) 0 lim f ( x)


x 0 x 0

The function f (x) is continuous on (– 1, 1).


f (x) = – 12x – 2, – 1 x 0
= 12x + 2, 0 x 1.

We have lim f ( x) 2 , lim f ( x) = – 2


x 0 x 0

The function f (x) is not continuous on (– 1, 1).


We conclude that the given function f(x) is not a cubic spline.
Cubic spline
From the definition, the spline is a piecewise continuous cubic polynomial. Hence,
F (x) is a linear function of x in all the intervals.
Consider the interval [xi–1, xi]. Using Lagrange interpolation in this interval, F (x) can
be written as
x xi x xi 1
F (x) = F ( xi 1 ) F ( xi )
xi 1 xi xi xi 1

xi x x xi 1
= F ( xi 1 ) F ( xi ) (2.53)
xi xi 1 xi xi 1

Denote F (xi–1) = Mi–1, and F (xi) = Mi.


Integrating (2.53) with respect to x, we get

( xi x) 2 ( x xi 1 ) 2
F (x) = – Mi 1 Mi a. (2.54)
2( xi xi 1 ) 2( xi xi 1 )
Integrating (2.54) again with respect to x, we get

( xi x) 3 ( x xi 1 ) 3
F(x) = Mi 1 Mi ax b (2.55)
6( xi xi 1 ) 6( xi xi 1 )
where a, b are arbitrary constants to be determined by using the conditions
F(xi–1) = f(xi–1) and F(xi) = f(xi ). (2.56)
Denote xi – xi–1 = hi, f(xi–1) = fi–1, and f(xi) = fi. Note that hi is the length of the interval
[xi–1, xi].
To ease the computations, we write
ax + b = c(xi – x) + d(x – xi–1) where a = d – c, b = c xi – d xi–1.
That is, we write (2.55) as

( xi x) 3 (x xi 1 ) 3
F(x) = Mi 1 Mi c( xi x) d( x xi 1 ) .
6 hi 6 hi
Using the condition F(xi–1) = f(xi–1) = fi–1, we get

( xi xi 1 ) 3 hi3
fi–1 = Mi 1 c( xi xi 1 ) Mi 1 chi
6 hi 6 hi

1 hi2
or c= fi 1 Mi 1 .
hi 6

Using the condition F(xi) = f(xi) = fi, we get

( xi xi 1 ) 3 hi3
fi = Mi d ( xi xi 1 ) Mi dhi
6 hi 6 hi

1 hi2
or d= fi Mi .
hi 6

Substituting the expressions for c and d in (2.55), we obtain the spline in the interval [xi–1, xi]
as

1 ( xi x) hi2
Fi(x) = [( xi x) 3 M i 1 (x xi 1 ) 3 Mi ] fi 1 Mi 1
6hi hi 6

(x xi 1 ) hi2
+ fi Mi (2.57)
hi 6

Note that the spline second derivatives Mi–1, Mi are unknowns and are to be determined.
Setting i = i + 1 in (2.57), we get the spline valid in the interval [xi, xi+1] as

1 ( xi x) hi2 1
Fi+1(x) = [( xi 1 x) 3 M i (x xi )3 Mi 1 ] 1
fi Mi
6hi 1 hi 1 6

( x xi ) hi2 1
+ fi 1 Mi 1 (2.58)
hi 1 6

where hi+1 = xi+1 – xi. Differentiating (2.57) and (2.58), we get


1
F i(x) = [ 3( xi x) 2 M i 1 3( x xi 1 ) 2 Mi ]
6hi

1 hi2 1 hi2
fi 1 Mi 1 fi Mi (2.59)
hi 6 hi 6
valid in the interval [xi–1, xi], and
1
F i+1(x) = [ 3( x i 1 x )2 M i 3( x xi )2 M i 1 ]
6hi 1

1 hi2 1 1 hi2 1
fi Mi + fi 1 Mi 1 (2.60)
hi 1 6 hi 1 6

valid in the interval [xi, xi +1].


Now, we require that the derivative F (x) be continuous at x = xi. Hence, the left hand
and right hand derivatives of F (x) at x = xi must be equal, that is,
lim Fi ( xi ) lim Fi 1 ( xi ).
0 0

Using (2.59) and (2.60), we obtain


hi 1 hi 1 hi
Mi fi 1 Mi 1 fi Mi
2 hi 6 hi 6

hi 1 1 hi 1 1 hi 1
=– Mi fi Mi fi 1 Mi 1
2 hi 1 6 hi 1 6

hi 1 hi 1 1 1
or Mi 1 ( hi hi 1 ) M i Mi 1 ( fi 1 fi ) ( fi fi 1 )
6 3 6 hi 1 hi
i = 1, 2, ..., n – 1. (2.61)
This relation gives a system of n – 1 linear equations in n + 1 unknowns M0, M1, ..., Mn.
The two additional conditions required are the natural spline conditions M0 = 0 = Mn. These
equations are solved for M1, M2, ..., Mn–1. Substituting these values in (2.57), we obtain the
spline valid in the interval [xi–1, xi]. If the derivative is required, we can find it from (2.59).
Equispaced data When the data is equispaced, we have hi = hi+1 = h and xi = x0 + ih. Then, the
spline in the interval [xi–1, xi], given in (2.57) and the relation between the second derivatives
given in (2.61) simplify as
1
F i(x) = [( x i x )3 M i 1 (x x i 1 )3 M i ]
6h

( xi x) h2 (x xi 1) h2
fi 1 Mi 1 + fi Mi (2.62)
h 6 h 6
6
M i–1 + 4Mi + Mi+1 = ( fi 1 2 fi fi 1 ) (2.63)
h2
i = 1, 2, ..., n – 1.
Remark 12 Splines provide better approximation to the behaviour of functions that have
abrupt local changes. Further, splines perform better than higher order polynomial approxi-
mations.
Example 2.22 Obtain the cubic spline approximation for the following data.

x 0 1 2

f(x) –1 3 29

with M 0 = 0, M2 = 0. Hence, interpolate at x = 0.5, 1.5.

Solution We have equispaced data with h = 1. We obtain from (2.63),


Mi–1 + 4Mi + Mi+1 = 6(fi+1 – 2fi + fi–1), i = 1.
For i = 1, we get
M0 + 4M1 + M2 = 6(f2 – 2f1 + f0).
Since, M0 = 0, M2 = 0, we get
4M1 = 6[29 – 2(3) – 1] = 132, or M1 = 33.
The spline is given by
1 1 1
Fi(x) = [( xi x) 3 M i 1 (x xi 1 ) 3 Mi ] ( xi x) fi 1 Mi 1 + (x – xi–1) fi Mi
6 6 6
We have the following splines.
On [0, 1]:

1 1 1
F(x) = [(x1 – x)3 M0 + (x – x0)3 M1] + (x1 – x) f0 M0 (x x0 ) f1 M1
6 6 6

1 1
= (33)x3 + (1 – x)(– 1) + x 3 (33)
6 6

1
= (11x3 – 3x – 2).
2
On [1, 2]:
1 1 1
F(x) = [( x2 x) 3 M 1 (x x1 ) 3 M2 ] ( x2 x) f1 M1 (x x1 ) f2 M2
6 6 6

1 1
= [(2 x) 3 (33)] (2 x) 3 (33) (x 1) [29]
6 6
11 63
= (2 x) 3 x – 34.
2 2
Since, 0.5 lies in the interval (0, 1), we obtain
1 11 3 17
F(0.5) = 2 .
2 8 2 16
Since, 1.5 lies in the interval (1, 2), we obtain
1 223
F(1.5) = [11(2 . )3
15 63(1.5) 68] .
2 16
Example 2.23 Obtain the cubic spline approximation for the following data.

x 0 1 2 3

f(x) 1 2 33 244

with M 0 = 0, M3 = 0. Hence, interpolate at x = 2.5.


Solution We have equispaced data with h = 1. We obtain from (2.63),
M i–1 + 4Mi + Mi+1 = 6(fi+1 – 2fi + fi–1) i = 1, 2.
For i = 1, we get
M 0 + 4M1 + M2 = 6(f2 – 2f1 + f0) = 6(33 – 4 + 1) = 180.
For i = 2, we get
M 1 + 4M2 + M3 = 6(f3 – 2f2 + f1) = 6(244 – 66 + 2) = 1080.
Since, M0 = 0, M3 = 0, we get
4M1 + M2 = 180, M1 + 4M2 = 1080.
The solution is M1 = – 24, M2 = 276.
The cubic splines in the corresponding intervals are as follows.
On [0, 1]:
1 1 1
F(x) = [( x1 x) 3 M 0 (x x0 ) 3 M 1 ] ( x1 x) f0 M0 + (x – x0) f1 M1
6 6 6

1 3 1
= x ( 24) (1 x) x 2 ( 24) 4 x3 5x 1.
6 6
On [1, 2]:
1 1 1
F(x) = [( x2 x)3 M 1 (x x1 ) 3 M2 ] ( x2 x) f1 M1 + (x – x1) f2 M2
6 6 6
1 1 1
= [(2 – x)3 (– 24) + (x – 1)3 (276)] + (2 – x) 2 ( 24) (x 1) 33 (276)
6 6 6
1
= [(8 – 12x + 6x2 – x3)(– 24) + (x3 – 3x2 + 3x – 1)(276)] + 6(2 – x) – 13(x – 1)
6
= 50x3 – 162x2 + 167x – 53.
On [2, 3]:
1 1 1
F(x) = [( x3 x) 3 M2 (x x2 ) 3 M 3 ] ( x3 x) f 2 M2 + (x – x2) f3 M3
6 6 6

1 1
= [(3 x) 3 (276)] (3 x) 33 (276) + (x – 2)(244)
6 6
1
= [(27 – 27x + 9x2 – x3) (276)] – 13(3 – x) + 244(x – 2)
6
= – 46x3 + 414 x2 – 985 x + 715.
The estimate at x = 2.5 is
F(2.5) = – 46(2.5)3 + 414(2.5)2 – 985(2.5) + 715 = 121.25.

1. What are the advantages of cubic spline fitting?


Solution Splines provide better approximation to the behaviour of functions that have
abrupt local changes. Further, splines perform better than higher order polynomial
approximations.

2. Write the relation between the second derivatives in cubic splines with equal
mesh spacing.
Solution The required relation is
6
Mi–1 + 4Mi + M i+1 = ( fi+1 – 2fi + fi–1), i = 1, 2, ..., n – 1.
h2
3. Write the end conditions on Mi(x) in natural cubic splines.
Solution The required conditions are M0(x) = 0, Mn(x) = 0.

Are the following functions cubic splines?


1. f(x) = x3 – 2x + 3, 0 x 1,
= 2x3 – 3x2 + x + 2, 1 x 2.
2. f(x) = 5x3 – 3x2 + 1, 0 x 1,
= 2x3 + 6x2 – 9x + 4, 1 x 2.
3. f(x) = 3x2 + x + 1, 0 x 1,
= 3x2 – 5x + 1, 1<x 2.
4. f(x) = x3 – 3x2 + 1, 0 x 1,
= x3 – 2, 1 x 2.
5. Find the values of , such that the given function is a cubic spline.
f(x) = x3 + x2 + 2x, –1 x 0.
= 3x3 + x2 + 2x, 0 x 1.
6. Obtain the cubic spline approximation valid in the interval [3, 4], for the function given
in the tabular form, under the natural cubic spline conditions
f (1) = M(1) = 0, and f (4) = M(4) = 0.

x 1 2 3 4

f(x) 3 10 29 65

7. Obtain the cubic spline approximation valid in the interval [1, 2], for the function given
in the tabular form, under the natural cubic spline conditions f (0) = M(0) = 0, and f (3)
= M(3) = 0. Hence, interpolate at x = 1.5.

x 0 1 2 3

f(x) 1 4 10 8

8. Fit the following four points by the cubic spline using natural spline conditions
M(1) = 0, M(4) = 0.

x 1 2 3 4

f(x) 1 5 11 8

Hence, estimate f(1.5).


9. Fit the following four points by the cubic spline using natural spline conditions
M(1) = 0, M(4) = 0.

x 1 2 3 4

f(x) 0 1 0 0

10. The following values of x and y are given

x 1 2 3 4

f(x) 1 2 5 11

Find the cubic splines and evaluate y(1.5). (A.U. Nov/Dec 2004)
1. (3x – x2)/2; 1. 2. 8x2 – 19x + 12.
3. (x3 – 5x2 + 8x – 2)/2. 4. (3x3 – 70x2 + 557x – 690)/60; 44/3.
5. x3 + x2 – x + 2; 35. 6. (x3 – 9x2 + 32x – 24)/2; 6.
7. Profit in the year 2000 = 100. 8. 49.2819.
9. x3 + x2 ; 810. 10. 10x3 – 27x2 + 3x + 35; 71.
11. 2x3 – 4x2 + 4x + 1; 31.
12. – (x2 – 200x + 6060)/32. Roots of f(x) = 0 are x = 162.7694 and x = 37.2306.
13. For f(x) = x n+1, f n+1 ( ) = (n + 1) !. 15. – [x2x3(x1 + x4) + x1x4(x2 + x3)]/[x12 x22 x32 x42].
16. (– 1)n/(x0 x1 ... xn). 17. x3 – 9x2 + 21x + 1; 10.
18. (3x3 – 70x2 + 557x – 690); 44/3. 19. 3x3 + 7x2 – 4x – 32; 99.
20. x3 – x2 ; 448. 21. 0.5118199.
22. 10x3 – 27x2 + 3x + 35; 71.

2. (– x3 + 21x2 – 126x + 240)/8; 1.25. 3. (– x3 – 3x2 + 16x – 6)/6 ; 1.3125.


4. 2x3 – 7x2 + 6x + 1; 41. 5. x2 + 2x – 3.
6. P(70) 424. Number of persons with wages between 60 and 70 = (Persons with wages
70) – (Persons with wages 60) = 424 – 370 = 54.
7. 0.31815664. 8. (x3 + 13x2 + 56x + 28)/2; 100.
9. 9.5037. 10. 0.0708.
11. (a) [cos (0.12)/0.12] = 8.5534, cos (0.12) = 1.0264. (b) 0.9912. Exact value = 0.9928.
Differences in (b) decrease very fast. Hence, results from (b) will be more accurate.

1. Cubic spline. 2. Cubic spline.


3. f(x) is not continuous. Not a cubic spline.
4. f (x) is not continuous. Not a cubic spline.
5. f(x) is a cubic spline for = 1 and all values of .
6. M2 = 112/5, M1 = 62/5. Spline in [3, 4]: (– 112x3 + 1344x2 – 4184x + 4350)/30.
7. M2 = – 14, M1 = 8. Spline in [1, 2] : (– 22x3 + 90x2 – 80x + 36)/6; 7.375.
8. M2 = – 76/5, M1 = 34/5. Spline in [1, 2]: (17x3 – 51x2 + 94x – 45)/15; 2.575.
9. M2 = 12/5, M1 = – 18/5. Spline in [1, 2]: (– 3x3 + 9x2 – x – 5)/5. Spline in [2, 3]:
(30x3 – 234x2 + 570x – 414)/30. Spline in [3, 4]: 2(– x3 + 12x2 – 47x + 60)/5.
10. M2 = 4, M1 = 2. Spline in [1, 2]: (x3 – 3x2 + 5x)/3; 1.375.
We assume that a function f(x) is given in a tabular form at a set of n + 1 distinct points x0, x1,
..., xn. From the given tabular data, we require approximations to the derivatives f (r) (x ), r 1,
where x may be a tabular or a non-tabular point. We consider the cases r = 1, 2.
In many applications of Science and engineering, we require to compute the value of the
b
definite integral f ( x) dx , where f(x) may be given explicitly or as a tabulated data. Even
a
when f(x) is given explicitly, it may be a complicated function such that integration is not
easily carried out.
In this chapter, we shall derive numerical methods to compute the derivatives or evalu-
ate an integral numerically.

Approximation to the derivatives can be obtained numerically using the following two
approaches
(i) Methods based on finite differences for equispaced data.
(ii) Methods based on divided differences or Lagrange interpolation for non-uniform data.

3.2.1.1 Derivatives Using Newton’s Forward Difference Formula


Consider the data (xi, f(xi)) given at equispaced points xi = x0 + ih, i = 0, 1, 2, ..., n where h is the
step length. The Newton’s forward difference formula is given by
2
f0 f0
f(x) = f(x0) + (x – x0) + (x – x0)(x – x1) + ...
1! h 2 ! h2
n
f0
+ (x – x0)(x – x1)...(x – xn–1) . (3.1)
n ! hn
Set x = x0 + sh. Now, (3.1) becomes
f(x) = f(x0 + sh)
1 1
= f(x0) + s f0 + s(s – 1) 2 f0 + s(s – 1)(s – 2) 3 f0
2! 3!

1 1
+ s(s – 1)(s – 2)(s – 3) 4f + s(s – 1)(s – 2)(s – 3)(s – 4) 5 f0 + ...
4! 0 5!

s(s 1)(s 2) ... (s n 1) n


+ f0. (3.2)
n!
Note that s = [x – x0]/h > 0.
The magnitudes of the successive terms on the right hand side become smaller and
smaller.
Differentiating (3.2) with respect to x, we get

df df ds 1 df
dx ds dx h ds

1 1 2 1 1
= f0 (2s 1) f0 (3 s2 6s 2) 3
f0 (4 s3 18 s2 22s 6) 4
f0
h 2 6 24

1
(5 s4 40 s3 105 s2 100 s 24) 5
f0 ... (3.3)
120
At x = x0, that is, at s = 0, we obtain the approximation to the derivative f (x) as

1 1 2 1 3 1 4 1 5
f (x0) = f0 f0 f0 f0 f0 ... (3.4)
h 2 3 4 5
Differentiating (3.3) with respect to x, we get

d2 f 1 d df ds 1 d df
2
dx h ds ds dx h 2 ds ds

1 2 1 3 1
= f0 (6s 6) f0 (12s 2 36s 22) 4
f0
h2 6 24

1
+ (20 s3 120 s2 210 s 100) 5
f0 ... (3.5)
120
At x = x0, that is, at s = 0, we obtain the approximation to the derivative f (x) as
1 2 3 11 4 5 5 137 6
f (x0) = 2
f0 f0 f0 f0 f0 ... . (3.6)
h 12 6 180
We use formulas (3.3) and (3.5) when the entire data is to be used.
Very often, we may require only lower order approximations to the derivatives. Taking
a few terms in (3.4), we get the following approximations.
Taking one term in (3.4), we get
1 1
f (x0) = f0 = [f(x1) – f(x0)],
h h
1 1
or, in general, f (xk) = fk = [f(xk+1) – f(xk)]. (3.7)
h h
Taking two terms in (3.4), we get

1 1 2 1 1
f (x0) = f0 f0 { f ( x1 ) f ( x0 )} { f ( x2 ) 2 f ( x1 ) f ( x0 )}
h 2 h 2

1
= [ 3 f ( x0 ) 4 f ( x1 ) f ( x2 )] (3.8)
2h
1
or, in general, f (xk) = [– 3f(xk) + 4f(xk+1) – f(xk+2)]. (3.9)
2h
Similarly, we have the approximation for f (x0) as

1 2 1
f (x0) = f0 [ f ( x2 ) 2 f ( x1 ) f ( x0 )]
h2 h2

1
or, in general, f (xk) = [ f (xk 2 ) 2 f ( xk 1 ) f ( x k )] . (3.10)
h2
Errors of approximations. Using Taylor series approximations, we obtain the error in the
formula (3.7) for f (x) at x = xk as
1
E(f, xk) = f (xk) – [ f ( xk h) f ( x k )]
h

1 h2
= f (xk) – { f ( xk ) hf ( x k ) f ( xk ) ...} f ( xk )
h 2

h
=– f ( xk ) + ... (3.11)
2
The error is of order O(h), or the formula is of first order.
The error in the formula (3.8) for f (x) at x = xk is obtained as
1
E(f, xk) = f (xk) – [– 3 f(xk) + 4f(xk+1) – f(xk+2)]
2h
1 h2 h3
= f (xk ) 3 f ( xk ) 4 f ( xk ) hf ( x k ) f ( xk ) f ( xk ) ...
2h 2 6

(2h) 2 (2h) 3
– f ( xk ) 2 hf ( xk ) f ( xk ) f ( xk ) ...
2 6

h2
= f ( x k ) + ... (3.12)
3
The error is of order O(h2), or the formula is of second order.
The error in the formula (3.9) for f (x) at x = xk is obtained as
1
E(f, xk) = f (xk) – [f(xk + 2h) – 2 f(xk + h) + f(xk)]
h2

1 (2h) 2 (2h) 3
= f (xk) – f (xk ) 2hf ( x k ) f ( xk ) f ( xk ) ...
h2 2 6

h2 h3
– 2 f ( xk ) hf ( x k ) f (xk ) f (xk ) ... f ( xk )
2 6

= – h f (xk) + ... (3.13)


The error is of order O(h), or the formula is of first order.

Remark 1 It can be noted that on the right hand side of the approximation to f (x), we have
the multiplying factor 1/h, and on the right hand side of the approximation to f (x), we have
the multiplying factor 1/h2. Since h is small, this implies that we may be multiplying by a
large number. For example, if h = 0.01, the multiplying factor on the right hand side of the
approximation to f (x) is 100, while the multiplying factor on the right hand side of the
approximation to f (x) is 10000. Therefore, the round-off errors in the values of f(x) and hence
in the forward differences, when multiplied by these multiplying factors may seriously effect
the solution and the numerical process may become unstable. This is one of the drawbacks of
numerical differentiation.

Remark 2 Numerical differentiation must be done with care. When a data is given, we do not
know whether it represents a continuous function or a piecewise continuous function. It is
possible that the function may not be differentiable at some points in its domain. What happens
if we try to find the derivatives at these points where the function is not differentiable? For
example, if f(x) = | x |, and a data is prepared in the interval [– 1, 1], what value do we get
when we try to find f (x) at x = 0, where the function is not differentiable?
Remark 3 We use the forward difference formulas for derivatives, when we need the values
of the derivatives at points near the top of the table of the values.
Example 3.1 Find dy/dx at x = 1 from the following table of values

x 1 2 3 4

y 1 8 27 64

Solution We have the following forward difference table.

x y y 2y 3y

1 1
7
2 8 12
19 6
3 27 18
37
4 64

We have h = 1, x0 = 1, and x = x0 + sh = 1 + s. For x = 1, we get s = 0.


Therefore,
dy 1 1 2 1 3
(1) f0 f0 f0
dx h 2 3
1 1
=7– (12) (6) 3.
2 3
Example 3.2 Using the operator relations, derive the approximations to the derivatives f (x0)
and f (x0) in terms of forward differences.

Solution From the operator relation E = e hD, where D = d/dx, we obtain


hDf(x0) = log E[ f(x0)] = log (1 + ) f(x0)

2 3 4 5
= ... f(x0)
2 3 4 5

1 1 2 1 3 1 4 1 5
or f (x0) = f0 f0 f0 f0 f0 ...
h 2 3 4 5

h2D2 f(x0) = [log (1 + )]2 f(x0)

2 3 4 5 2

= ... f(x0)
2 3 4 5
2 3 11 4 5 5 137 6
= ... f ( x0 )
12 6 180

1 2 3 11 4 5 5 137 6
or f (x0) = 2
f0 f0 f0 f0 f0 ...
h 12 6 180
Example 3.3 Find f (3) and f (3) for the following data:

x 3.0 3.2 3.4 3.6 3.8 4.0

f(x) – 14 – 10.032 – 5.296 – 0.256 6.672 14

[A.U. April/May 2005]


Solution We have h = 0.2 and x = x0 + sh = 3.0 + s(0.2). For x = 3, we get s = 0.
We have the following difference table.

x f(x) f 2f 3f 4f 5f

3.0 – 14
3.968
3.2 – 10.032 0.768
4.736 – 0.464
3.4 – 5.296 0.304 2.048
5.040 1.584 – 5.120
3.6 – 0.256 1.888 – 3.072
6.928 –1.488
3.8 6.672 0.400
7.328
4.0 14

We have the following results:

1 1 2 1 3 1 4 1 5
f (x0) = f0 f0 f0 f0 f0
h 2 3 4 5

1 1 1 1 1
f (3.0) = 3.968 (0.768) ( 0.464) (2.048) ( 5.120) = 9.4667.
0.2 2 3 4 5

1 2 3 11 4 5 5
f (x0) = 2
f0 f0 f0 f0
h 12 6

1 11 5
f (3.0) = 0.768 0.464 (2.048) ( 5.12) = 184.4
0.04 12 6
Example 3.4 The following data represents the function f(x) = e2x. Using the forward differ-
ences and the entire data, compute the approximation to f (0.3). Also, find the first order and
second order approximations to f (0.3). Compute the approximation to f (0.3) using the entire
data and the first order approximation. Compute the magnitudes of actual errors in each case.

x 0.0 0.3 0.6 0.9 1.2

f (x) 1.0000 1.8221 3.3201 6.0496 11.0232

Solution The step length is h = 0.3 and x = x0 + sh = 0.0 + s(0.3). For x = 0.3, we get
s = 1. We have the following forward difference table.

x f(x) f 2f 3f 4f

0.0 1.0000
0.8221
0.3 1.8221 0.6759
1.4980 0.5556
0.6 3.3201 1.2315 0.4570
2.7295 1.0126
0.9 6.0496 2.2441
4.9736
1.2 11.0232

From (3.3), we have the following approximation for s = 1.

1 1 2 1 3 1 4
f (x0 + sh) = f (x0 + h) = f0 f0 f0 f0
h 2 6 12

1 1 1 1
f (0.3) = 0.8221 ( 0.6759) ( 0.5556) ( 0.4570) = 3.6851.
0.3 2 6 12

The first order approximation gives

1 1
f (0.3) = f(0.3) = [f (0.6) – f(0.3)]
h 0.3
1 1.4980
= [3.3201 – 1.8221] = = 4.9933.
0.3 0.3

1
From (3.9), f (xk) = [– 3 f(xk) + 4 f(xk+1) – f(xk+2)].
2h
We get the second order approximation as
1
f (0.3) = [– 3 f(0.3) + 4 f(0.6) – f(0.9)]
0.6
1
= [– 3(1.8221) + 4(3.3201) – 6.0496] = 2.9408.
0.6
The exact value is f (0.3) = 2e0.6 = 2(1.8221) = 3.6442.
The errors in the approximations are as follows:
First order approximation: | 4.9933 – 3.6442 | = 1.3491.
Second order approximation: | 2.9408 – 3.6442 | = 0.7034.
Full data: | 3.6851 – 3.6442 | = 0.0409.
From (3.5), we have the following approximation for s = 1.

1 2 1 4
f (x0 + sh) = f (x0 + h) = 2
f0 f0
h 12

1 1
f (0.3) = 0.6759 (0.4570) 7.0869 .
0.09 12
The first order approximation gives

1 2
1
f (0.3) = f(0.3) = [f(0.9) – 2f(0.6) + f(0.3)]
h2 h2
1
= [6.0496 – 2(3.3201) + 1.8221] = 13.6833.
0.09
The exact value is f (0.3) = 4e0.6 = 7.2884
The errors in the approximations are as follows:
First order approximation: | 13.6833 – 7.2884 | = 6.3949.
Full data: | 7.0869 – 7.2884 | = 0.2015.

Example 3.5 The following data gives the velocity of a particle for 8 seconds at an interval of
2 seconds. Find the initial acceleration using the entire data.

Time (sec) 0 2 4 6 8

Velocity (m/sec) 0 172 1304 4356 10288

dv
Solution If v is the velocity, then initial acceleration is given by .
dt t 0

We shall use the forward difference formula to compute the first derivative at t = 0. The
step length is h = 2.
We form the forward difference table for the given data.
x f(x) f 2f 3f 4f

0 0
172
2 172 960
1132 960
4 1304 1920 0
3052 960
6 4356 2880
5932
8 10288

We have the following result:


1 1 2 1 3
f (x0) = f0 f0 f0 ...
h 2 3

1 1 1
f (0) = 172 (960) (960) = 6.
2 2 3

3.2.1.2 Derivatives Using Newton’s Backward Difference Formula


Consider the data (xi, f(xi)) given at equispaced points xi = x0 + ih, where h is the step length.
The Newton’s backward difference formula is given by
1 1
f(x) = f(xn) + (x – xn) f(xn) + (x – xn)(x – xn–1) 2 f(xn) + ...
1! h 2 ! h2

1 n
+ (x – xn)(x – xn–1) ... (x – x1) f(xn). (3.14)
n ! hn
Let x be any point near xn. Let x – xn = sh. Then, the formula simplifies as

s(s 1) 2
s( s 1)(s 2) 3
f(x) = f(xn + sh) = f(xn) + s f(xn) + f(xn) + f(xn)
2! 3!

s( s 1)( s 2)( s 3) 4 s(s 1)(s 2)( s 3)( s 4) 5


+ f(xn) + f(xn) + ...
4! 5!

s(s 1)(s 2) ... (s n 1) n


+ f(xn). (3.15)
n!
Note that s = [(x – xn)/h] < 0.
The magnitudes of the successive terms on the right hand side become smaller and
smaller.
Differentiating (3.15) with respect to x, we get

df df ds 1 df
dx ds dx h ds

1 1 2 1 1
= fn ( 2s 1) fn (3s 2 6s 2) 3
fn ( 4s 3 18s 2 22s 6) 4
fn
h 2 6 24

1
+ (5s 4 40 s 3 105s 2 100s 24) 5
fn ... . (3.16)
120

At x = xn, we get s = 0. Hence, we obtain the approximation to the first derivative f (xn) as

1 1 2 1 3 1 4 1 5
f (xn) = fn fn fn fn fn ... . (3.17)
h 2 3 4 5

At x = xn–1, we have xn–1 = xn – h = xn + sh. We obtain s = – 1. Hence, the approximation to the


first derivative f (xn–1) is given by

1 1 2 1 3 1 4 1 5
f (xn–1) = fn fn fn fn fn ... . (3.18)
h 2 6 12 20

Differentiating (3.16) with respect to x again, we get

d2 f 1 d df ds 1 d df
2
dx h ds ds dx h 2 ds ds

1 2 1 3 1
= fn (6 s 6) fn (12s 2 36 s 22) 4
fn
h2 6 24

1
+ (20 s3 120 s2 210 s 100) 5
fn ... . (3.19)
120
At x = xn, that is, at s = 0, we obtain the approximation to the second derivative f (x) as

1 2 3 11 4 5 5 137 6
f (xn) = 2
fn fn fn fn fn ... . (3.20)
h 12 6 180

At x = xn–1, we get s = – 1. Hence, we obtain the approximation to the second derivative


f (xn–1) as

1 2 1 4 1 5
f (xn–1) = fn fn fn ... . (3.21)
h2 12 12

We use the formulas (3.17), (3.18), (3.20) and (3.21) when the entire data is to be used.
Remark 4 We use the backward difference formulas for derivatives, when we need the values
of the derivatives near the end of table of values.

Example 3.6 Using the operator relation, derive approximations to the derivatives
f (xn), f (xn) in terms of the backward differences.

Solution From the operator relation E = ehD, where D = d/dx, we obtain


hDf(xn) = [log E] f(xn) = log [(1 – )–1] f(xn) = – log (1 – ) f(xn)

2 3 4 5
= ... f(xn)
2 3 4 5

1 1 2 1 3 1 4 1 5
or f (xn) = fn fn fn fn fn ...
h 2 3 4 5

2 3 4 5 2

h2D2 f(xn) = [log (1 – )]2 f(xn) = ... f(xn)


2 3 4 5

2 3 11 4 5 5
= ... f ( xn )
12 6

1 2 3 11 4 5 5
or f (xn) = fn fn fn fn ... .
h2 12 6

Example 3.7 Find f (3) using the Newton’s backward difference formula, for the data

x 1.0 1.5 2.0 2.5 3.0

f(x) – 1.5 – 2.875 – 3.5 – 2.625 0.5

Solution The step length is h = 0.5 and x = xn + sh = 3.0 + s(0.5). For x = 3.0, we get
s = 0. We have the following backward difference table.

2 3 4
x f(x) f f f f

1.0 – 1.5
– 1.375
1.5 – 2.875 0.75
– 0.625 0.75
2.0 – 3.5 1.5 0.0
0.875 0.75
2.5 – 2.625 2.25
3.125
3.0 0.5
From the formula
1 1 2 1 3 1 4 1 5
f (xn) = fn fn fn fn fn ... ,
h 2 3 4 5

1 1 1
we obtain f (3) = 3.125 (2.25) (0.75) = 9.
0.5 2 3

Example 3.8 Find f (2.5), f (2) and f (2.5) using the Newton’s backward difference method,
for the data of the function f(x) = ex + 1.

x 1.0 1.5 2.0 2.5

f(x) 3.7183 5.4817 8.3891 13.1825

Find the magnitudes of the actual errors.


Solution The step length is h = 0.5 and x = xn + sh = 2.5 + s(0.5). For x = 2.5, we get
s = 0. The backward difference table is given below.

x f(x) f 2f 3f

1.0 3.7183
1.7634
1.5 5.4817 1.1440
2.9074 0.7420
2.0 8.3891 1.8860
4.7934
2.5 13.1825

From the formula


1 1 2 1 3 1 4 1 5
f (xn) = fn fn fn fn fn ... ,
h 2 3 4 5

1 1 1
we obtain f (2.5) = 4.7934 (18860
. ) (0.7420) = 11.9675.
0.5 2 3

The exact value is f (2.5) = e2.5 = 12.1875. The magnitude of the error in the solution is
| Error | = | 12.1875 – 11.9675 | = 0.2150.
For x = 2.0, we get s = – 1. From the formula

1 1 2 1 3 1 4 1 5
f (xn–1) = fn fn fn fn fn ... ,
h 2 6 12 20
1 1 2 1 3
we get f (2) = fn fn fn
0.5 2 6

1 1 1
= 4.7934 (1.8860) (0.7420) = 7.4535.
0.5 2 6
The exact value is f (2) = e2 = 7.3891. The magnitude of the error in the solution is
| Error | = | 7.3891 – 7.4535 | = 0.0644.
For x = 2.5, we get s = 0. From the formula

1 2 3 11 4 5 5
f (xn) = 2
fn fn fn fn ... ,
h 12 6

1
we get f (2.5) = [1.8660 + 0.7420] = 10.5120.
0.25
The exact value is f (2.5) = e2.5 = 12.1875. The magnitude of the error in the solution is
| Error | = | 12.1875 – 10.5120 | = 1.6705.

Example 3.9 The following data represents the function f(x) = e 2x.

x 0.0 0.3 0.6 0.9 1.2

f(x) 1.0000 1.8221 3.3201 6.0496 11.0232

Find f (1.2) f (0.9) and f (1.2), using the Newton’s backward difference method.
Compute the magnitudes of the errors.
Solution The step length is h = 0.3. We have the following backward difference table.

x f(x) f 2f 3f 4f

0.0 1.0000
0.8221
0.3 1.8221 0.6759
1.4980 0.5556
0.6 3.3201 1.2315 0.4570
2.7295 1.0126
0.9 6.0496 2.2441
4.9736
1.2 11.0232
From x = xn + sh = 1.2 + s(0.3), we get for x = 1.2, s = 0. Using the formula

1 1 2 1 3 1 4 1 5
f (xn) = fn fn fn fn fn ... ,
h 2 3 4 5

1 1 1 1
we get f (1.2) = 4.9736 (2.2441) (1.0126) (0.4570) = 21.8248.
0.3 2 3 4

The exact value is f (1.2) = 2e2.4 = 22.0464.


The magnitude of the error is
| Error | = | 22.0464 – 21.8248 | = 0.2216.
From x = xn + sh = 1.2 + s(0.3), we get for x = 0.9, s = – 1. Using the formula

1 1 2 1 3 1 4 1 5
f (xn–1) = fn fn fn fn fn ... ,
h 2 6 12 20

1 1 1 1
we get f (0.9) = 4.9736 (2.2441) (1.0126) (0.4570) = 12.1490.
0.3 2 6 12

The exact value is f (0.9) = 2e1.8 = 12.0993.


The magnitude of the error is
| Error | = | 12.0993 – 12.1490 | = 0.0497.
From x = xn + sh = 1.2 + s(0.3), we get for x = 1.2, s = 0. Using the formula

1 2 3 11 4 5 5
f (xn) = fn fn fn fn ... ,
h 2 12 6

1 11
we get f (1.2) = 2.2441 1.0126 (0.4570) = 40.8402.
0.09 12

The exact value is f (1.2) = 4e2.4 = 44.0927.


The magnitude of the error is
| Error | = | 40.8402 – 44.0927 | = 3.2525.

3.2.1.3 Derivatives Using Divided Difference Formula


The divided difference interpolation polynomial fitting the data (xi, f(xi)), i = 0, 1, 2, , n is
given by
f(x) = f(x0) + (x – x0) f [x0, x1] + (x – x0)(x – x1) f [x0, x1, x2] + ...
+ (x – x0)(x – x1) (x – x2) f [x0, x1, x2] + ...
+ (x – x0)(x – x1) ... (x – xn–1) f [x0, x1,... xn] (3.22)
Differentiating with respect to x, we get
f (x) = f [x0, x1] + [(x – x0) + (x – x1)] f [x0, x1, x2] + [(x – x1)(x – x2) + (x – x0)(x – x2)
+ (x – x0)(x – x1)] f [x0, x1, x2, x3] + [(x – x1)(x – x2)(x – x3) + (x – x0)(x – x2)(x – x3)
+ (x – x0)(x – x1) (x – x3) + (x – x0)(x – x1)(x – x2)] f [x0, x1, x2, x3, x4] + ... (3.23)
If the derivative f (x) is required at any particular point x = x *, then we substitute x = x*
in (3.23). If the data is equispaced, then the formula is simplified.
Differentiating (3.23) again, we obtain
f (x) = 2f [x0, x1, x2] + 2[(x – x0) + (x – x1) + (x – x2)] f [x0, x1, x2, x3]
+ 2[(x – x0)(x – x1) + (x – x0)(x – x2) + (x – x0)(x – x3) + (x – x1)(x – x2)
+ (x – x1)(x – x3) + (x – x2)(x – x3)] f [x0, x1, x2, x3, x4] + ... (3.24)
If the second derivative f (x) is required at any point x = x*, then we substitute x = x* in
(3.24). Again, if the data is equispaced, then the formula is simplified.
However, we can also determine the Newton’s divided differences interpolation polyno-
mial and differentiate it to obtain f (x) and f (x).
Example 3.10 Find the first and second derivatives at x = 1.6, for the function represented by
the following tabular data:

x 1.0 1.5 2.0 3.0

f(x) 0.0 0.40547 0.69315 1.09861

[A.U. Nov./Dec. 2005]


Solution The data is not equispaced. We use the divided difference formulas to find the
derivatives. We have the following difference table:

x f(x) First d.d Second d.d Third d.d

1.0 0.00000
0.81094
1.5 0.40547 – 0.235580
0.57536 0.061157
2.0 0.69315 – 0.113267
0.40546
3.0 1.09861

Substituting x = 1.6 in the formula


f (x) = f [x0, x1] + [(x – x0) + (x – x1)] f [x0, x1, x2] + [(x – x1)(x – x2) + (x – x0)(x – x2)
+ (x – x0)(x – x1)] f [x0, x1, x2, x3]
we obtain f (1.6) = 0.81094 + [(1.6 – 1.0) + (1.6 – 1.5)] (– 0.23558) + [(1.6 – 1.5)(1.6 – 2.0)
+ (1.6 – 1.0)(1.6 – 2.0) + (1.6 – 1.0)(1.6 – 1.5)] (0.061157)
= 0.81094 + 0.7 (– 0.23558) – 0.22(0.061157) = 0.63258.
Substituting x = 1.6 in the formula
f (x) = 2 f [x0, x1, x2] + 2[(x – x0) + (x – x1) + (x – x2)] f [x0, x1, x2, x3]
we obtain f (1.6) = 2(– 0.23558) + 2[(1.6 – 1.0) + (1.6 – 1.5) + (1.6 – 2.0)](0.061157)
= – 0.47116 + 0.03669 = – 0.43447.
Remark 5 Often, in applications, we require the maximum and/ or minimum of a function
given as a tabulated data. We may obtain the interpolation polynomial, differentiate it and
set it equal to zero to find the stationary points. Alternatively, we can use the numerical
differentiation formula for finding the first derivative, set it equal to zero to find the station-
ary points. The numerical values obtained for the second derivatives at these stationary points
decides whether there is a maximum or a minimum at these points.

1. What are the drawbacks of numerical differentiation?


Solution Numerical differentiation has two main drawbacks. (i) On the right hand
side of the approximation to f (x), we have the multiplying factor 1/h, and on the right
hand side of the approximation to f (x), we have the multiplying factor 1/h2. Since h is
small, this implies that we may be multiplying by a large number. For example, if
h = 0.01, the multiplying factor on the right hand side of the approximation to f (x) is
100, while the multiplying factor on the right hand side of the approximation to f (x) is
10000. Therefore, the round-off errors in the values of f(x) and hence in the forward
differences, when multiplied by these multiplying factors may seriously effect the solu-
tion and the numerical process may become unstable. (ii) When a data is given, we do
not know whether it represents a continuous function or a piecewise continuous func-
tion. It is possible that the function may not be differentiable at some points in its
domain. If we try to find the derivatives at these points where the function is not differ-
entiable, the result is unpredictable.
2. Given the data (xi, f(xi)), i = 0, 1, 2, , n at equispaced points xi = x0 + ih where h is the
step length, write the formula to compute f (x0), using the Newton’s forward difference
formula.
Solution In terms of the forward differences, we have the formula
1 1 2 1 3 1 4 1 5
f (x0) = f0 f0 f0 f0 f0 ... .
h 2 3 4 5
3. Given the data (xi, f(xi)), i = 0, 1, 2, , n at equispaced points xi = x0 + ih, where h is the
step length, write the formula to compute f (x0), using the Newton’s forward difference
formula.
Solution In terms of the forward differences, we have the formula
1 2 3 11 4 5 5 137 6
f (x0) = 2
f0 f0 f0 f0 f0 ... .
h 12 6 180
4. Given the data (xi, f(xi)), i = 0, 1, 2, , n at equispaced points xi = x0 + ih, where h is the
step length, write the formula to compute f (xn) using the Newton’s backward differ-
ence formula.
Solution In terms of the backward differences, we have the formula
1 1 2 1 3 1 4 1 5
f (xn) = fn fn fn fn fn ... .
h 2 3 4 5
5. Given the data (xi, f(xi)), i = 0, 1, 2, , n at equispaced points xi = x0 + ih, where h is the
step length, write the formula to compute f (xn–1), using the Newton’s backward differ-
ence formula.
Solution In terms of the backward differences, we have the formula
1 1 2 1 3 1 4 1 5
f (xn–1) = fn fn fn fn fn ... .
h 2 6 12 20

6. Given the data (xi, f(xi)), i = 0, 1, 2, , n at equispaced points where h is


the step length, write the formula to compute f (xn), using the Newton’s backward
difference formula.
Solution In terms of the backward differences, we have the formula
1 2 3 11 4 5 5 137 6
f (xn) = fn fn fn fn fn ... .
h2 12 6 180
7. What is the error in the following approximation?
1
f (xk) =[f(xk+1) – f(xk )].
h
Solution Using the Taylor series expansion of f(xk+1), we get the error of approxima-
tion as
1 h
E(f, xk) = f (xk) –
[f(xk + h) – f(xk)] = – f (xk) + ...
h 2
8. What is the error in the following approximation?
1
f (xk) = [– 3 f(xk) + 4f(xk+1) – f(xk+2)].
2h
Solution Using the Taylor series expansion of f(xk+1) and f(xk+2), we get the error of
approximation as

1 h2
E(f, xk) = f (xk) – [– 3 f(xk) + 4f(xk+1) – f(xk+2)] = f ( xk ) + ...
2h 3
1. The following data gives the velocity of a particle for 20 seconds at an interval of 5
seconds. Find the initial acceleration using the entire data.

Time (sec) 0 5 10 15 20

Velocity (m/sec) 0 3 14 69 228

(A.U. April/May 2004)


2. Compute f (0) and f (4) from the data

x 0 1 2 3 4

y 1 2.718 7.381 20.086 54.598

(A.U. May 2000)


3. Find the maximum and minimum values of y tabulated below.

x –2 –1 0 1 2 3 4

y 1 – 0.25 0 – 0.25 2 15.75 56

4. Find the value of x for which f(x) is maximum in the range of x given, using the follow-
ing table. Find also the maximum value of f(x).

x 9 10 11 12 13 14

y 1330 1340 1320 1250 1120 930

(A.U. Nov./Dec. 2004)


5. For the given data

x 1.0 1.1 1.2 1.3 1.4 1.5 1.6

y 7.989 8.403 8.781 9.129 9.451 9.750 10.031

find dy/dx, d2y/dx2 at 1.1. (A.U. Nov./Dec. 2003)


6. The first derivative at a point xk, is approximated by
f(xk) = [f(xk + h) – f(xk – h)]/(2h).
Find the error term using the Taylor series.
7. From the following 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

obtain dy/dx, d2y/dx2 at x = 1.2. (A.U. Nov./Dec. 2006)


8. Obtain the value of f (0.04) using an approximate formula for the given data

x 0.01 0.02 0.03 0.04 0.05 0.06

y 0.1023 0.1047 0.1071 0.1096 0.1122 0.1148

(A.U. Nov./Dec. 2003)


9. Find the value of sec 31° for the following data

(deg) 31 32 33 34

tan 0.6008 0.6249 0.6494 0.6745

(A.U. Nov./Dec. 2004)


10. Find f (1) using the following data and the Newton’s forward difference formula.

x 1.0 1.5 2.0 2.5 3.0

f(x) – 1.5 – 2.875 – 3.5 – 2.625 0.5

11. Using the Newton’s forward difference formula, find f (1.5) from the following data.

x 1.0 1.5 2.0 2.5

f(x) 3.7183 5.4817 8.3891 13.1825

Find the magnitude of the actual error, if the data represents the function ex + 1.
12. Given the following data, find y (6), y (5) and the maximum value of y.

x 0 2 3 4 7 9

y 4 26 58 112 466 922

(A.U. May/Jun. 2006)


13. Given the following data, find y (6).

x 0 2 3 4 7 8

y 4 26 58 112 466 668

(A.U. Nov./Dec. 2006)


14. An approximation to f (x) is given by
1
f (x) = [f(x + h) – 2f(x) + f(x – h)].
h2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy