Week 3 Notes
Week 3 Notes
3
Interpolation
Study Organiser
Before you begin this note, please check through your study organiser given below. It shows
the topics that we’ll be covering, the skills you need to acquire (the learning outcomes) and
the resources and activities you are given to help you acquire these skills.
Introduction
Interpolation is the process whereby un-tabulated values of a function, tabulated only at cer-
tain values, are estimated.
Example: Consider the table given below. What would be the viscosity at the temperature
of 8◦ ?
Solution: We can use interpolation to estimate a reasonable value for the viscosity at the
temperature of 8◦ .
Pn (xi ) = yi for 0 ≤ i ≤ n.
Given the data (x0 , y0 ), (x1 , y1 ), . . . (xn , yn ), where the x’s are assumed to be distinct, we
want to find a polynomial
Pn (x) = a0 + a1 x + a2 x2 + · · · + an xn
that interpolates the given data. Since Pn (xi ) = yi , we get a system of linear equations:
a0 + a1 x0 + a2 x20 + · · · + an xn0 = y0
a0 + a1 x1 + a2 x21 + · · · + an xn1 = y1
..
.
a0 + a1 xn + a2 x2n + · · · + an xnn = yn
Example 3.1. Find a polynomial that fits the given points: (−1, 3), (0, 1), (1, 1), (4, 58).
Solution
Since we are given 4 points, the interpolated polynomial will be of degree ≤ 3. (The max-
imum degree of the polynomial is always one less that the number of points.) Let P (x) =
ax3 + bx2 + cx + d, we can write four equations involving the unknown coefficients a, b, c,
and d:
This procedure is awkward, especially if we want a new polynomial that is also made to fit
at the point (5, -25), or if we want to see what difference it would make to use a quadratic in-
stead of a cubic. We now look at some better and simpler ways of finding such interpolating
polynomials. We will look at two forms of interpolating polynomials:
1. Lagrange Form
2. Newton Form
Example 3.2. Give the Lagrange form of the interpolating polynomial for the given data:
x -2 0 1
y 0 1 -1
Solution
The cardinal functions are:
(x − 0)(x − 1) 1
l0 (x) = = x(x − 1)
(−2 − 0)(−2 − 1) 6
(x + 2)(x − 1) 1
l1 (x) = = − (x + 2)(x − 1)
(0 + 2)(0 − 1) 2
(x + 2)(x − 0) 1
l2 (x) = = (x + 2)x
(1 + 2)(1 − 0) 3
Thus Lagrange form of the interpolating polynomial is
P2 (x) = 0l0 (x) + 1l1 (x) − 1l2 (x)
1 1
= − (x + 2)(x − 1) − (x + 2)x
2 3
4 W EEK 3
Example 3.3. Find a polynomial of least degree that assumes the following values:
x 0 1 2 3
y -3 2 -4 5
Solution
The cardinal functions are:
(x − 1)(x − 2)(x − 3) 1
l0 (x) = = − (x − 1)(x − 2)(x − 3)
(0 − 1)(0 − 2)(0 − 3) 6
(x − 0)(x − 2)(x − 3) 1
l1 (x) = = x(x − 2)(x − 3)
(1 − 0)(1 − 2)(1 − 3) 2
(x − 0)(x − 1)(x − 3) 1
l2 (x) = = − x(x − 1)(x − 3)
(2 − 0)(2 − 1)(2 − 3) 2
(x − 0)(x − 1)(x − 2) 1
l3 (x) = = x(x − 1)(x − 2)
(3 − 0)(3 − 1)(3 − 2) 6
Thus Lagrange form of the interpolating polynomial is
P3 (x) = −3l0 (x) + 2l1 (x) − 4l2 (x) + 5l3 (x)
1
= (x − 1)(x − 2)(x − 3) + x(x − 2)(x − 3)
2
5
+2x(x − 1)(x − 3) + x(x − 1)(x − 2)
6
Solution
3
X
(c) li (x) = l0 (x) + l1 (x) + l2 (x) + l3 (x)
i=0
1 1 1
= − (x3 − 7x2 + 14x − 8) + (x3 − 6x2 + 8x) − (x3 − 5x2 + 4x)
8 3 4
1 3 2
+ (x − 3x + 2x)
24
1 1 1 1 3 7 5 1 2 7 8 1
= − + − + x + −2+ − x + − + −1+ x+1
8 3 4 24 8 4 8 4 3 12
= 1
P0 (x) = c0
P1 (x) = c0 + c1 (x − x0 )
P2 (x) = c0 + c1 (x − x0 ) + c2 (x − x0 )(x − x1 )
and so on.
Example 3.5. Find the Newton interpolating polynomial of least degree for the following table.
x 1 2 0 3
y 3 2 -4 5
6 W EEK 3
Solution
We need to find P3 (x). Note that
Now
P3 (1) = 3, so c0 = 3.
P3 (2) = 2, so c0 + c1 (2 − 1) = 2 ⇒ 3 + c1 = 2 ⇒ c1 = −1.
P3 (0) = −4, so c0 + c1 (0 − 1) + c2 (0 − 1)(0 − 2) = −4
⇒ 3 − 1(−1) + c2 (−1)(−2) = −4 ⇒ c2 = −4.
P3 (3) = 5, so c0 + c1 (3 − 1) + c2 (3 − 1)(3 − 2) + c3 (3 − 1)(3 − 2)(3) = 5
⇒ 3 − 1(2) − 4(2)(1) + c3 (2)(1)(3) = 5 ⇒ c3 = 2.
n
X i−1
Y
Pn (x) = ci (x − xj )
i=0 j=0
= c0 + c1 (x − x0 ) + c2 (x − x0 )(x − x1 ) + · · ·
+cn (x − x0 )(x − x1 ) · · · (x − xn−1 )
We need to find the values of c0 , c1 , . . . , cn (we have learnt the iterative method in the previ-
ous lecture and we will learn another simple method now).
We know that c0 depends only on f (x0 ), c1 depends on f (x0 ) and f (x1 ), . . ., cn depends on
f (x0 ), f (x1 ), . . . , f (xn ). To signify this dependency, let
cn = f [x0 , x1 , x2 , . . . , xn ].
The expression f [x0 , x1 , x2 , . . . , xn ] are called the divided differences of f . The constants
W EEK 3 7
c0 , c1 , c2 , c3 , . . . , cn can be written as
c0 = f [x0 ] = f (x0 )
f [x1 ] − f [x0 ]
c1 = f [x0 , x1 ] =
x1 − x0
f [x1 , x2 ] − f [x0 , x1 ]
c2 = f [x0 , x1 , x2 ] =
x2 − x0
f [x1 , x2 , x3 ] − f [x0 , x1 , x2 ]
c3 = f [x0 , x1 , x2 , x3 ] =
x3 − x0
..
.
f [x1 , x2 , . . . , xn ] − f [x0 , x1 , . . . , xn−1 ]
cn = f [x0 , x1 , x2 , . . . , xn ] =
xn − x0
Divided differences satisfy the equation
f [xi+1 , xi+2 , . . . , xi+j ] − f [xi , xi+1 , . . . , xi+j−1 ]
f [xi , xi+1 , xi+2 , . . . , xi+j ] =
xi+j − xi
If a table of function values (xi , f (xi )) is given we can construct from it a table of divided
differences. For example
x f [xi ] f [, ] f [, , ] f [, , , ]
x0 f (x0 )
f [x0 , x1 ]
x1 f (x1 ) f [x0 , x1 , x2 ]
f [x1 , x2 ] f [x0 , x1 , x2 , x3 ]
x2 f (x2 ) f [x1 , x2 , x3 ]
f [x2 , x3 ]
x3 f (x3 )
Example 3.6. Construct a divided difference table for these function values:
x 0 1 2 3
f (x) 3 -2 -4 5
Solution
xi f [xi ] f [, ] f [, , ] f [, , , ]
0 3
-5
3
1 -2 2
4
-2 3
11
2 -4 2
9
3 5
8 W EEK 3
Example 3.7. Find the Newton interpolating polynomial for the function values in the table given
in Example 4.1.
Solution
x f [xi ] f [, ] f [, , ] f [, , , ]
0 -4
7
1 3 -6
-5 4
2 -2 6
7
3 5
Solution
Example 3.9. Use divided differences to find the Newton interpolating polynomial of least degree for
the given values.
x 1 2 0 3
f (x) 3 2 -4 5
Solution
W EEK 3 9
xi f [xi ] f [, ] f [, , ] f [, , , ]
1 3
-1
2 2 -4
3 2
0 -4 0
3
3 5
3. If f (x) = ax2 + bx + c where a, b and c are real constants, then show that
f [x0 , x1 ] = a(x1 + x0 ) + b.
Solution:
f (x1 ) − f (x0 )
f [x0 , x1 ] =
x1 − x0
(ax21 + bx1 + c) − (ax20 + bx0 + c)
=
x1 − x0
(ax1 + bx1 ) − (ax20 + bx0 )
2
=
x1 − x0
2 2
a(x1 − x0 ) + b(x1 − x0 )
=
x1 − x0
a(x21 − x20 ) b(x1 − x0 )
= +
x1 − x0 x1 − x0
a(x1 − x0 )(x1 + x0 )
= +b
x1 − x0
= a(x1 + x0 ) + b
4. Let P2 (x) be the Newton form of interpolating polynomial of degree 2. Show that
P2′′ (x) = 2f [x0 , x1 , x2 ].
P2 (x) = c0 + c1 (x − x0 ) + c2 (x − x0 )(x − x1 ),
P2′ (x) = c1 + c2 (x − x0 ) + c2 (x − x1 ),
P2′′ (x) = c2 + c2 = 2c2 = 2f [x0 , x1 , x2 ].
5. Show that if f is continuous on the closed interval [x0 , x1 ] and differentiable on the
open interval (x0 , x1 ), then f [x0 , x1 ] = f ′ (c) for some c in (x0 , x1 ). (Hint: Use the Mean
Value Theorem)