1.1 Interpolation
1.1 Interpolation
1.1 Interpolation
Interpolation
1.1 Interpolation
Let y(x) be a continuous function in some interval [a, b], and defined at n+1 distinct
points x0 , x1 , · · · , xn such that a = x0 < x1 < x2 · · · < xn = b. These points may be
equispaced or non equispaced. The problem of polynomial interpolation is to find a
polynomial yn (x) of degree ≤ n, which fits the given distinct data exactly, i.e.,
yn (xi ) = y(xi ), i = 0, 1, 2, · · · , n.
yn (x) = a0 + a1 (x − x0 ) + a2 (x − x0 )(x − x1 ) + · · ·
Imposing now the condition that y and yn (x) should agree at the set of tabulated
points, we obtain
y1 − y0 ∆y0 ∆2 y0 ∆n y0
a0 = y0 ; a1 = = ; a2 = 2 ; · · · ; an = n .
x1 − x0 h h 2! h n!
and then impose the condition that y and yn (x) should agree at the tabulated points
xn , xn−1 , · · · , x1 , x0 , we obtain (after some simplification)
Example 1. Find the cubic polynomial which takes the following values:
x 1 3 5 7
y(x) 24 120 336 720
x y ∆ ∆2 ∆3
1 24
96
3 120 120
216 48
5 336 168
384
7 720
Note: This process of finding the value of y for some value of x outside the given
range is called extrapolation.
Example 2. The table below gives the values of tan x for 0.10 ≤ x ≤ 0.30
(i) To find tan 0.12, we have 0.12 = 0.10 + p(0.05), which gives p = 0.4.
Hence Newton’s forward difference interpolation formula (1.2) gives
(ii) To find tan 0.26, we have 0.26 = 0.30 + p(0.05), which gives p = −0.8.
Hence Newton’s backward difference interpolation formula (1.4) gives
(−0.8)(−0.8 + 1) 2
tan(0.26) = yn + (−0.8)∇yn + ∇ yn
2!
(−0.8)(−0.8 + 1)(−0.8 + 2) 3
+ ∇ yn
3!
(−0.8)(−0.8 + 1)(−0.8 + 2)(−0.8 + 3) 4
+ ∇ yn
4!
(−0.8)(−0.8 + 1)
= 0.3093 + (−0.8)(0.0540) + (0.0014)
2!
(−0.8)(−0.8 + 1)(−0.8 + 2)
+ (0.0004)
3!
(−0.8)(−0.8 + 1)(−0.8 + 2)(−0.8 + 3)
+ (0.0002)
4!
= 0.2662
Example 3. The following are the number of deaths in four successive ten year age
groups. Find the number of deaths at 45-50 and 50-55.
x − x0 50 − 35
Here h = 10, x0 = 35, p = = = 1.5
h 10
By Newton’s forward difference formula (1.2), we have
p(p − 1) 2 p(p − 1)(p − 2) 3
P (50) = y0 + p∆y0 + ∆ y0 + ∆ y0
2! 3!
1.5(1.5 − 1) 1.5(1.5 − 1)(1.5 − 2)
= 13229 + 1.5(18139) + (6086) + (1185)
2! 3!
= 42645.6875 ≈ 42646
∴ Deaths at the age between 45-50 is y50 − y45 = 42646 − 31368 = 11278
Deaths at the age between 50-55 is y55 − y50 = 55593 − 42646 = 12947.
We consider the following difference table 1.1 in which the central ordinate is taken
for convenience as y0 corresponding to x = x0 .
The differences used in this formula are red number shown in Table 1.1. The formula
is, therefore, of the form
x y ∆ ∆2 ∆3 ∆4 ∆5 ∆6
x−3 y−3
∆y−3
∆2 y−3
x−2 y−2 ∆3 y−3
∆y−2 ∆4 y−3
∆2 y−2 ∆5 y−3
x−1 y−1 ∆3 y−2
∆y−1
2 ∆4 y−2 ∆6 y−3
∆ y−1 ∆5 y−2
x0 y0 ∆3 y−1
∆y0 ∆4 y−1
∆2 y0
x1 y1 ∆3 y0
∆y1
∆2 y1
x2 y2
∆y2
x3 y3
The yp on the left side can be expressed in terms of y0 , ∆y0 and higher-order
differences of y0 , as follows:
yp = E p y0
= (1 + ∆)p y0
p(p − 1) 2 p(p − 1)(p − 2) 3
= y0 + p∆y0 + ∆ y0 + ∆ y0 + · · ·
2! 3!
Similarly, the right side of Eq. (1.5) can also be expressed in terms of y0 , ∆y0 and
∆2 y−1 = ∆2 E −1 y0
= ∆2 (1 + ∆)−1 y0
= ∆2 (1 − ∆ + ∆2 − ∆3 + · · · )y0
= ∆2 y0 − ∆3 y0 + ∆4 y0 − ∆5 y0 + · · · ,
∆3 y−1 = ∆3 y0 − ∆4 y0 + ∆5 y0 − ∆6 y0 + · · · ,
∆4 y−2 = ∆4 E −2 y0 = ∆4 (1 + ∆)−2 y0
+ G3 (∆3 y0 − ∆4 y0 + ∆5 y0 − ∆6 y0 + · · · )
Equating the coefficients of ∆y0 , ∆2 y0 , etc., on both side of Eq. (1.6), and substi-
tuting the obtained values in Eq. (1.5), we get
p(p − 1) 2 (p + 1)p(p − 1) 3
yp = y0 + p∆y0 + ∆ y−1 + ∆ y−1
2! 3!
(p + 1)p(p − 1)(p − 2) 4
+ ∆ y−2 + · · · (1.7)
4!
where p = (x − x0 )/h, which is the Gauss’ forward formula.
The differences used in this formula are green number shown in Table 1.2. The
Gauss’ backward formula is, therefore, of the form (same solution procedure as
in Gauss’ forward formula)
p(p + 1) 2 (p + 1)p(p − 1) 3
yp = y0 + p∆y−1 + ∆ y−1 + ∆ y−2
2! 3!
(p + 2)(p + 1)p(p − 1) 4
+ ∆ y−2 + · · · (1.8)
4!
where p = (x − x0 )/h.
x y ∆ ∆2 ∆3 ∆4 ∆5 ∆6
x−3 y−3
∆y−3
∆2 y−3
x−2 y−2 ∆3 y−3
∆y−2 ∆4 y−3
∆2 y−2 ∆5 y−3
x−1 y−1 ∆3 y−2
∆y−1 ∆4 y−2 ∆6 y−3
∆2 y−1 ∆5 y−2
x0 y0 ∆3 y−1
∆y0 ∆4 y−1
∆2 y0
x1 y1 ∆3 y0
∆y1
∆2 y1
x2 y2
∆y2
x3 y3
Remark. It is convenient to start with x0 nearest to x and then introduced x−1 , x1 , x−2 , x2 ,
and so on.
Example 4. From the following table, find the value of e1.17 using Gauss’s forward
formula:
Solution: We have 1.17 = 1.15 + p(0.05), which gives p = 2/5 = 0.4. Using Gauss’
forward formula (1.7), we have
(0.4)(0.4 − 1)
e1.17 = 3.1582 + (0.4)(0.1619) + (0.0079)
2!
(0.4 + 1)(0.4)(0.4 − 1) (0.4 + 1)(0.4)(0.4 − 1)(0.4 − 2)
+ (0.0004) + (0)
3! 4!
(0.4 + 2)(0.4 + 1)(0.4)(0.4 − 1)(0.4 − 2)
+ (0.0001)
5!
(0.4 + 2)(0.4 + 1)(0.4)(0.4 − 1)(0.4 − 2)(0.4 − 3)
+ (0.0001)
6!
= 3.2221
x ex ∆ ∆2 ∆3 ∆4 ∆5 ∆6
1.00 2.7183
0.1394
0.0071
1.05 2.8577 0.0004
0.1465 0
0.0075 0
1.10 3.0042 0.0004
0.1540 0 0.0001
0.0079 0.0001
1.15 3.1582 0.0004
0.1619 0.0001
0.0083
1.20 3.3201 0.0005
0.1702
0.0088
1.25 3.4903
0.1790
1.30 3.6693
Taking the mean of Gauss’ forward and backward formulae (1.7)-(1.8), we obtain
∆y−1 + ∆y0 p2 2 p(p2 − 1) ∆3 y−2 + ∆3 y−1
yp = y0 + p + ∆ y−1 +
2 2 3! 2
p2 (p2 − 1) 4
+ ∆ y−2 + · · · (1.9)
4!
which is known as Stirling’s formula.
(i) For interpolation at the beginning or end of a table of values, Newton’s forward
and backward interpolation formulae have to be used respectively.
(ii) For interpolation near the middle of a set of values, the following are choices:
1 1
Stirling’s formula if − ≤p≤
4 4
and
1 3
Bessel’s formula for ≤p≤ .
4 4
Example 5. Using Stirling’s interpolation formula to find y at x = 32 from the
given table:
x 20 30 40 50
y 512 439 346 243
Solution: Since x = 32 lying between 30 and 40. So we take 30 as the origin and
h = 10. Therefore, p = (32 − 30)/10 = 0.2 < 1/4. Hence, we apply
Stirling’s formula. The difference table is
x y ∆ ∆2 ∆3
20 512
-73
30 439 -20
-93 10
40 346 -10
-103
50 243
Therefore
−93 − 73 0.04
y0.2 = 439 + 0.2 + (−20) + 0
2 2
= 422
Given the (n + 1) points (x0 , y0 ), (x1 , y1 ), · · · , (xn , yn ) where the values of x need not
necessarily be equally spaced. The Lagrange’s interpolating polynomial passes
through given data points is given as:
n
X
Pn (x) = `i (x) yi , yi = y(xi ) (1.11)
i=0
where
(x − x0 )(x − x1 ) · · · (x − xi−1 )(x − xi+1 ) · · · (x − xn )
`i (x) = .
(xi − x0 )(xi − x1 ) · · · (xi − xi−1 )(xi − xi+1 ) · · · (xi − xn )
Interchanging x and y in Eq. (1.11), we obtain the inverse interpolation as
n
X
Pn (y) = `i (y) xi , xi = x(yi ) (1.12)
i=0
where
(y − y0 )(y − y1 ) · · · (y − yi−1 )(y − yi+1 ) · · · (y − yn )
`i (y) = .
(yi − y0 )(yi − y1 ) · · · (yi − yi−1 )(yi − yi+1 ) · · · (yi − yn )
Example 6. Certain corresponding values of x and log10 x are (300, 2.4771), (304, 2.4829),
(305, 2.4843) and (307, 2.4871). Find log10 301 .
P3
Solution: From Eq. (1.11), we have P3 (x) = i=0 `i (x) yi , i.e.,
(301 − 304)(301 − 305)(301 − 307)
P3 (301) = log10 301 = (2.4771)
(300 − 304)(300 − 305)(300 − 307)
(301 − 300)(301 − 305)(301 − 307)
+ (2.4829)
(304 − 300)(304 − 305)(304 − 307)
(301 − 300)(301 − 304)(301 − 307)
+ (2.4843)
(305 − 300)(305 − 304)(305 − 307)
(301 − 300)(301 − 304)(301 − 305)
+ (2.4871)
(307 − 300)(307 − 304)(307 − 305)
= 1.2739 + 4.9658 − 4.4717 + 0.7106 = 2.4786.
3
X
x= `i (y) xi
i=0
(7 − 12)(7 − 19) (7 − 4)(7 − 19) (7 − 4)(7 − 12)
x= (1) + (3) + (4)
(4 − 12)(4 − 19) (12 − 4)(12 − 19) (19 − 4)(19 − 12)
1 27 4 26
= + − = = 1.86
2 14 7 14
The Lagrange’s interpolation formula has the disadvantage that if another inter-
polation point were added, then the interpolation coefficient `i (x) will have to be
recomputed. We therefore seek an interpolation polynomial which has the prop-
erty that a polynomial of higher order may be derived from it by simply adding
new terms. Newton’s general interpolation formula is one such formula and
it employs what are called divided differences. It is our principal purpose in this
section to define such differences and discuss their properties.
Let (x0 , y0 ), (x1 , y1 ), · · · , (xn , yn ) be the given (n + 1) data points. Then the divided
differences of order 1, 2, · · · , n are defined by the relations:
y1 − y0
[x0 , x1 ] = , (first divided difference);
x1 − x0
[x1 , x2 ] − [x0 , x1 ]
[x0 , x1 , x2 ] = , (second divided difference);
x2 − x0
..
.
[x1 , x2 , · · · , xn ] − [x0 , x1 , · · · , xn−1 ]
[x0 , x1 , · · · , xn ] = , (nth divided difference).
xn − x0
(1.13)
y(x0 + h) − y(x0 )
[x0 , x1 ] = lim [x0 , x0 + h] = lim
h→0 h→0 h
0
= y (x0 ), if y(x) is differenctiable.
Similarly,
y r (x0 )
[x0 , x0 , · · · , x0 ] = .
| {z } r!
(r+1) argumetnts
y1 − y0 1
[x0 , x1 ] = = ∆y0 ,
x1 − x0 h
[x1 , x2 ] − [x0 , x1 ] 1 ∆y1 ∆y0 1
[x0 , x1 , x2 ] = = − = 2 ∆2 y0 ,
x2 − x0 2h h h h 2!
and in general,
1
[x0 , x1 , · · · , xn ] = ∆n y0 . (1.14)
hnn!
Remark. If the tabulated function is a polynomial of nth degree, then ∆n y0 would
be a constant and hence the nth divided difference would also be a constant.
By definition, we have
y − y0
[x, x0 ] = ,
x − x0
so that
y = y0 + (x − x0 )[x − x0 ].
Again
[x, x0 ] − [x0 , x1 ]
[x, x0 , x1 ] =
x − x1
which gives
x -1 0 3 6 7
f (x) 3 -6 39 822 1611
= x4 − 3x3 + 5x2 − 6.
Exercise
1. Form a table of differences for the function f (x) = x3 + 5x − 7 for x =
−1, 0, 1, 2, 3, 4, 5. Continue the table to obtain f (6) and f (7).
2. Evaluate (a) ∆2 x3 , (b) ∆2 cos x, (c) ∆[(x + 1)(x + 2)], (d) ∆(tan−1 x).
x 0 5 10 15 20 25 30
y 1 3 - 73 225 - 1153
4. Using Gauss’s backward formula, find the value of f (33) given that f (25) = 1,
f (30) = 3, f (35) = 5 and f (40) = 7.
5. Find a cubic polynomial which fits the data (−2, −12), (−1, −8), (2, 3) and
(3, 5).
6. Given f (x) = 1/x2 , find the divided differences [a, b] and [a, b, c].
n
X
7. For the polynomial Pn (x) = ar xn−r , show that ∆n Pn (x) = a0 n!hn . Verify
r=0
the result by preparing the finite difference table of P3 (x) = 2x3 + 3x − 1 by
tabulating it for x = −2(1)3.
8. From the following table, find the number of students who obtained marks
between 60 and 70:
Solution
1. 239, 371; 2. (a) 6h2 (h + x), (b) cos(x + 2h) − 2 cos(x + h) + cos x, (c) 2x + 4,
h 1 3 241 39 a+b
(d) tan−1 ; 3. 17, 551; 4. 5. − x3 − x2 + x − ; 6. − 2 2 ,
x(x + h) 15 20 60 10 ab
ab + bc + ca
− ; 8. 54.
a2 b 2 c 2