Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

Chapter 3

Interpolation and Polynomial


Approximation

3.1 Interpolation and the Lagrange Polynomial

One of the most useful and well-known classes of functions mapping the set of real numbers into
itself is the algebraic polynomials, the set of functions of the form

Pn pxq “ an xn ` an´1 xn´1 ` ¨ ¨ ¨ ` a1 x ` a0 ,

where n is a nonnegative integer and a0 , ¨ ¨ ¨ , an are real constants. One reason for their impor-
tance is that they uniformly approximate continuous functions. This result is expressed precisely
in the Weierstrass Approximation Theorem.

Theorem 3.1.1 (Weierstrass Approximation Theorem). Suppose that f P Cra, bs. For each
" ° 0, there exists a polynomial P pxq such that

|f pxq ´ P pxq| † " for all x P ra, bs.

Another important reason for considering the class of polynomials in the approximation of
functions is that the derivative and indefinite integral of a polynomial are easy to determine
and are also polynomials. For these reasons, polynomials are often used for approximating
continuous functions.

Lagrange Interpolating Polynomials

The problem of determining a polynomial of degree one that passes through the distinct points
px0 , y0 q and px1 , y1 q is the same as approximating a function for which f px0 q “ y0 and f px1 q “ y1
by means of a first-degree polynomial interpolating, or agreeing with the values of f at the
given points. Using this polynomial for approximation within the interval given by the endpoints
is called polynomial interpolation.
Define the functions
x ´ x1 x ´ x0
L0 pxq “ , and L1 pxq “ .
x0 ´ x1 x1 ´ x0
The linear Lagrange interpolating polynomial through px0 , y0 q and px1 , y1 q is

P pxq “ L0 pxqf px0 q ` L1 pxqf px1 q.

35
36 CHAPTER 3. INTERPOLATION AND POLYNOMIAL APPROXIMATION

Note that L0 px0 q “ 1, L0 px1 q “ 0, L1 px0 q “ 0, and L1 px1 q “ 1, which implies that

P px0 q “ f px0 q “ y0 and P px1 q “ f px1 q “ y1 .

So P is the unique polynomial of degree at most one that passes through px0 , y0 q and px1 , y1 q.

Example 3.1.2. We determine the linear Lagrange interpolating polynomial that passes through
the points p2, 4q and p5, 1q. In this case, we have
x´5 1 x´2 1
L0 pxq “ “ ´ px ´ 5q and L1 pxq “ “ px ´ 2q.
2´5 3 5´2 3
Hence, we have
1 1 4 20 1 2
P pxq “ ´ px ´ 5q ¨ 4 ` px ´ 2q ¨ 1 “ ´ x ` ` x ´ “ ´x ` 6.
3 3 3 3 3 3

To generalize the concept of interpolation, consider the construction of a polynomial of degree


at most n that passes through the n ` 1 points pxi , f pxi qq for i “ 0, ¨ ¨ ¨ , n. In this case, we first
construct, for each i “ 0, 1, ¨ ¨ ¨ , n, a function Ln,k pxq with the property that

Ln,k pxi q “ 0 when i ‰ k and Ln,k pxk q “ 1.

To satisfy the first type of condition, it requires that the numerator of Ln,k pxq contains the term

px ´ x0 qpx ´ x1 q ¨ ¨ ¨ px ´ xk´1 qpx ´ xk`1 q ¨ ¨ ¨ px ´ xn q.

To satisfy Ln,k pxk q “ 1, the denominator of Ln,k pxq must be the same term but evaluated at
x “ xk . Thus,

px ´ x0 qpx ´ x1 q ¨ ¨ ¨ px ´ xk´1 qpx ´ xk`1 q ¨ ¨ ¨ px ´ xn q


Ln,k pxq “ .
pxk ´ x0 qpxk ´ x1 q ¨ ¨ ¨ pxk ´ xk´1 qpxk ´ xk`1 q ¨ ¨ ¨ pxk ´ xn q

The interpolating polynomial is easily described once the form of Ln,k is known. This polynomial,
called n-th Lagrange interpolating polynomial, is defined in the following theorem.

Theorem 3.1.3 (Lagrange Polynomial). If x0 , x1 , ¨ ¨ ¨ , xn are n ` 1 distinct numbers and f is


a function whose values are given at these points, then a unique polynomial P pxq of degree at
most n exists with
f pxk q “ P pxk q for k “ 0, ¨ ¨ ¨ , n.
The polynomial P pxq is given by
n
ÿ
P pxq “ f pxk qLn,k pxq (3.1)
k“0

where
πn
pnq px ´ x0 qpx ´ x1 q ¨ ¨ ¨ px ´ xk´1 qpx ´ xk`1 q ¨ ¨ ¨ px ´ xn q x ´ xi
Lk pxq “ “ .
pxk ´ x0 qpxk ´ x1 q ¨ ¨ ¨ pxk ´ xk´1 qpxk ´ xk`1 q ¨ ¨ ¨ pxk ´ xn q i“0, i‰k xk ´ xi

We will write Ln,k simply as Lk when there is no confusion as to its degree.

Example 3.1.4. (a) Use the numbers (called nodes) x0 “ 2, x1 “ 2.75, and x2 “ 4 to find
the second Lagrange interpolating polynomial for f pxq “ 1{x.
3.1. INTERPOLATION AND THE LAGRANGE POLYNOMIAL 37

(b) Use this polynomial to approximate f p3q “ 1{3.

Solution. We first determine the coefficient polynomials L0 , L1 , and L2 . In nested form they
are
px ´ 2.75qpx ´ 4q 2
L0 pxq “ “ px ´ 2.75qpx ´ 4q,
p2 ´ 2.75qp2 ´ 4q 3
px ´ 2qpx ´ 4q 16
L1 pxq “ “ ´ px ´ 2qpx ´ 4q,
p2.5 ´ 2qp2.75 ´ 4q 15
and
px ´ 2qpx ´ 2.75q 2
L2 pxq “ “ px ´ 2qpx ´ 2.75q.
p4 ´ 2qp4 ´ 2.75q 5
Also, f px0 q “ 1{2, f px1 q “ 4{11, f px2 q “ 1{4, so

2
ÿ 1 2 35 49
P pxq “ f pxk qLk pxq “ x ´ x` .
k“0
22 88 44

An approximation to f p3q “ 1{3 is

f p3q « P p3q “ 0.32955.

See Figure 3.1 for an illustration.

0.55

0.5

0.45

0.4

0.35

0.3

0.25

0.2
2 2.2 2.4 2.6 2.8 3 3.2 3.4 3.6 3.8 4

1 2 35 49
Figure 3.1: The function f pxq “ 1{x and its 2-nd Lagrange polynomial P pxq “ 22 x ´ 88 x ` 44

The next step is to calculate a remainder term or bound for the error involved in approximating
a function by an interpolating polynomial.

Theorem 3.1.5. Suppose x0 , x1 , ¨ ¨ ¨ , xn are n ` 1 distinct numbers in the interval ra, bs and
f P C n`1 ra, bs. Then, for each x P ra, bs, a number ⇠pxq (generally unknown) between x0 , ¨ ¨ ¨ , xn
and hence in pa, bq exists with

f pn`1q p⇠pxqq
f pxq “ P pxq ` px ´ x0 qpx ´ x1 q ¨ ¨ ¨ px ´ xn q, (3.2)
pn ` 1q!

where P pxq is the interpolating polynomial given by (3.1).


38 CHAPTER 3. INTERPOLATION AND POLYNOMIAL APPROXIMATION

Proof. Note that if we take x “ xk , for any k “ 0, 1, ¨ ¨ ¨ , n, then we have

f pxk q “ P pxk q.

One may choose ⇠pxq arbitrarily in the interval pa, bq and the equation (3.2) will hold.
If x ‰ xk for all k “ 0, 1, ¨ ¨ ¨ , n, we define the function gptq for t P ra, bs by
πn
t ´ xi
gptq “ f ptq ´ P ptq ´ rf pxq ´ P pxqs .
i“0
x ´ xi

Since f P C n`1 ra, bs, and P P C 8 ra, bs, it follows that g P C n`1 ra, bs. For t “ xk , we have
n
π xk ´ xi
gpxk q “ f pxk q ´ P pxk q ´ rf pxq ´ P pxqs “ 0 ´ rf pxq ´ P pxqs ¨ 0 “ 0.
i“0
x ´ xi

Moreover, when t “ x, we have


n
π x ´ xi
gpxq “ f pxq ´ P pxq ´ rf pxq ´ P pxqs “ f pxq ´ P pxq ´ rf pxq ´ P pxqs “ 0.
i“0
x ´ xi

Thus, g P C n`1 ra, bs and g is zero at the n`2 distinct numbers x, x0 , x1 , ¨ ¨ ¨ , xn . By Generalized
Rolle’s Theorem 1.1.16, there exists a number ⇠ P pa, bq such that g pn`1q p⇠q “ 0. Hence, we have
« ff
π n
d n`1 t ´ x
0 “ g pn`1q p⇠q “ f pn`1q p⇠q ´ P pn`1q p⇠q ´ rf pxq ´ P pxqs n`1
i
. (3.3)
dt i“0
x ´ x i
t“⇠

± P pxq is a polynomial of degree at most n, so the n ` 1-st derivative is identically zero.


However,
Also, ni“0 pt ´ xi q{px ´ xi q is a polynomial of degree n ` 1, so we have
n
dn`1 π t ´ xi pn ` 1q!
“ ±n .
dt n`1
i“0
x ´ xi i“0 px ´ xi q

Then, (3.3) now becomes


n
pn ` 1q! f pn`1q p⇠q π
0 “ f pn`1q p⇠q ´ 0 ´ rf pxq ´ P pxqs ±n ùñ f pxq “ P pxq ` px ´ xi q.
i“0 px ´ xi q pn ` 1q! i“0

This completes the proof.

The error formula is an important theoretical result because Lagrange polynomials are used
extensively for deriving numerical di↵erentiation and integration methods. Error bounds for
these techniques are obtained from the Lagrange error formula. Note that the error form for
the Lagrange polynomial is quite similar to that for the Taylor polynomial. The n-th Taylor
polynomial about x0 concentrates all the known information at x0 and has an error term of the
form
f pn`1q p⇠pxqq
px ´ x0 qn`1 .
pn ` 1q!
The Lagrange polynomial of degree n uses information at the distinct numbers x0 , x1 , ¨ ¨ ¨ , xn
and, in place of px ´ x0 qn`1 , its error formula uses a product of the n ` 1 terms:

f pn`1q p⇠pxqq
px ´ x0 qpx ´ x1 q ¨ ¨ ¨ px ´ xn q.
pn ` 1q!
3.2. DATA APPROXIMATION AND NEVILLE’S METHOD 39

Example 3.1.6. In Example 3.1.4, we found the second Lagrange polynomial for f pxq “ 1{x
on r2, 4s using the nodes x0 “ 2, x1 “ 2.75, and x2 “ 4. Determine the error form for this
polynomial, and the maximum error when the polynomial is used to approximate f pxq for
x P r2, 4s.

Solution. Because f pxq “ 1{x, we have

1 2 6
f 1 pxq “ ´ , f 2 pxq “ , and f 3 pxq “ ´ .
x2 x3 x4
As a consequence, the second Lagrange polynomial has the error form

f 3 p⇠pxqq px ´ 2qpx ´ 2.75qpx ´ 4q


px ´ x0 qpx ´ x1 qpx ´ x2 q “ ´ for ⇠pxq P p2, 4q.
3! p⇠pxqq4

The maximum value of p⇠pxqq´4 on the interval is 2´4 “ 1{16. We now need to determine the
maximum value on this interval of the absolute value of the polynomial

35 2 49
gpxq :“ px ´ 2qpx ´ 2.75qpx ´ 4q “ x3 ´ x ` x ´ 22.
4 2
Because
35 49 1
g 1 pxq “ 3x2 ´ x` “ p3x ´ 7qp2x ´ 7q,
2 2 2
the critical points occur at
ˆ ˙ ˆ ˙
7 7 25 7 7 9
x“ with g “ , and x“ with g “´ .
3 3 108 2 2 16

Hence, the maximum error is

f 3 p⇠pxqq 1 9 3
|px ´ x0 qpx ´ x1 qpx ´ x2 q| § ´ “ « 0.00586.
3! 16 ¨ 6 16 512

3.2 Data Approximation and Neville’s Method

A practical difficulty with Lagrange interpolation is that the error term is difficult to apply, so
the degree of the polynomial needed for the desired accuracy is generally not known until com-
putations have been performed. A common practice is to compute the results given from various
polynomials until appropriate agreement is obtained. However, the work done in calculating the
approximation by the second polynomial does not lessen the work needed to calculate the third
approximation; nor is the fourth approximation easier to obtain once the third approximation
is known, and so on. We now derive these approximating polynomials in a recursive manner.

Definition 3.2.1. Let f be a function defined at x0 , x1 , ¨ ¨ ¨ , xn and suppose that m1 , m2 , ¨ ¨ ¨ , mk


are k distinct integers, with 0 § mi § n for each i “ 1, ¨ ¨ ¨ , k. The Lagrange polynomial that
agrees with f pxq at the k points xm1 , ¨ ¨ ¨ , xmk is denoted Pm1 ,m2 ,¨¨¨ ,mk pxq.

Example 3.2.2. Let x0 “ 1, x1 “ 2, x2 “ 3, x3 “ 4, x4 “ 6, and f pxq “ ex . Determine the


interpolating polynomial denoted P1,2,4 pxq, and use this polynomial to approximate f p5q.
40 CHAPTER 3. INTERPOLATION AND POLYNOMIAL APPROXIMATION

Solution. This is the Lagrange polynomial that agrees with f pxq at x1 “ 2, x2 “ 3, x4 “ 6.


Hence,
px ´ 3qpx ´ 6q 2 px ´ 2qpx ´ 6q 3 px ´ 2qpx ´ 3q 6
P1,2,4 pxq “ e ` e ` e .
p2 ´ 3qp2 ´ 6q p3 ´ 2qp3 ´ 6q p6 ´ 2qp6 ´ 3q
Hence,
p5 ´ 3qp5 ´ 6q 2 p5 ´ 2qp5 ´ 6q 3 p5 ´ 2qp5 ´ 3q 6
f p5q « P p5q “ e ` e ` e « 218.105.
p2 ´ 3qp2 ´ 6q p3 ´ 2qp3 ´ 6q p6 ´ 2qp6 ´ 3q

The next result describes a method for recursively generating Lagrange polynomial approxima-
tions.
Theorem 3.2.3. Let f be defined at x0 , x1 , ¨ ¨ ¨ , xn and let xj and xi be two distinct numbers
in this set. Then
px ´ xj qP0,1,¨¨¨j´1,j`1,¨¨¨ ,k pxq ´ px ´ xi qP0,1,¨¨¨ ,i´1,i`1,¨¨¨k pxq
P pxq “
xi ´ xj
is the k-th Lagrange polynomial that interpolates at the k ` 1 points x0 , x1 , ¨ ¨ ¨ , xk .

Proof. For ease of notation, let Q ” P0,1,¨¨¨ ,i´1,i`1,¨¨¨k and Q̂ ” P0,1,¨¨¨j´1,j`1,¨¨¨ ,k . Since Qpxq
and Q̂pxq are polynomials of degree k ´ 1 or less, P pxq is of degree at most k. First note that
Q̂pxi q “ f pxi q, implies that

pxi ´ xj qQ̂pxi q ´ pxi ´ xi qQpxi q pxi ´ xj q


P pxi q “ “ f pxi q “ f pxi q.
xi ´ xj pxi ´ xj q
Similarly, since Qpxj q “ f pxj q, we have P pxj q “ f pxj q. In addition, if 0 § r § k and r is neither
i nor j, then Qpxr q “ Q̂pxr q “ f pxr q. Hence, we have

pxr ´ xj qQ̂pxr q ´ pxr ´ xi qQpxr q pxi ´ xj q


P pxr q “ “ f pxr q “ f pxr q.
xi ´ xj pxi ´ xj q
But, by definition, P0,1,¨¨¨ ,k pxq is the unique polynomial of degree at most k that agrees with f
at x0 , x1 , ¨ ¨ ¨ , xk . Thus, P ” P0,1,¨¨¨ ,k .

The theorem above implies that the interpolating polynomials can be generated recursively. For
example, we have
1 1
P0,1 “ rpx ´ x0 qP1 ´ px ´ x1 qP0 s, P1,2 “ rpx ´ x1 qP2 ´ px ´ x2 qP1 s,
x1 ´ x0 x2 ´ x1
1
P0,1,2 “ rpx ´ x0 qP1,2 ´ px ´ x2 qP0,1 s,
x2 ´ x0
and so on. They are generated in the manner shown in the following table, which each row is
completed before the succeeding rows are begun.
The procedure that uses the result of the theorem above to recursively generate interpolating
polynomial approximations is called Neville’s method. To avoid the multiple subscripts, we
let Qi,j pxq for 0 § j § i, denote the interpolating polynomial of degree j on the j ` 1 numbers
xi´j , xi´j`1 , ¨ ¨ ¨ , xi´1 , xi ; that is,
Qi,j “ Pi´j,i´j`1,¨¨¨ ,i´1,i .
Using this notation provides the Q notation array in Table 3.2.
3.2. DATA APPROXIMATION AND NEVILLE’S METHOD 41

x0 P0
x1 P1 P0,1
x2 P2 P1,2 P0,1,2
x3 P3 P2,3 P1,2,3 P0,1,2,3
x4 P4 P3,4 P2,3,4 P1,2,3,4 P0,1,2,3,4

Table 3.1: Recursive generation of Lagrange polynomials.

x0 P0 “ Q0,0
x1 P1 “ Q1,0 P0,1 “ Q1,1
x2 P2 “ Q2,0 P1,2 “ Q2,1 P0,1,2 “ Q2,2
x3 P3 “ Q3,0 P2,3 “ Q3,1 P1,2,3 “ Q3,2 P0,1,2,3 “ Q3,3
x4 P4 “ Q4,0 P3,4 “ Q4,1 P2,3,4 “ Q4,2 P1,2,3,4 “ Q4,3 P0,1,2,3,4 “ Q4,4

Table 3.2: Recursive generation of Lagrange polynomials using Q notation.

Example 3.2.4. Apply Neville’s method to the following data by constructing a recursive table
of the form shown in Table 3.2. Use this table to approximate f p1.5q.

x 1.0 1.3 1.6 1.9 2.2


f pxq 0.7651977 0.6200860 0.4554022 0.2818186 0.1103623

Solution. Let x0 “ 1.0, x1 “ 1.3, x2 “ 1.6, x3 “ 1.9, and x4 “ 2.2, then Q0,0 “ f p1.0q,
Q1,0 “ f p1.3q, Q2,0 “ f p1.6q, Q3,0 “ f p1.9q, and Q4,0 “ f p2.2q. These are the five polynomials
of degree zero (constants).
Calculating the first-degree approximation Q1,1 p1.5q gives
p1.5 ´ 1.0qQ1,0 ´ p1.5 ´ 1.3qQ0,0
Q1,1 p1.5q “ “ 0.5233449,
1.3 ´ 1.0
p1.5 ´ 1.3qQ2,0 ´ p1.5 ´ 1.6qQ1,0
Q2,1 p1.5q “ “ 0.5102968,
1.6 ´ 1.3
p1.5 ´ 1.6qQ3,0 ´ p1.5 ´ 1.9qQ2,0
Q3,1 p1.5q “ “ 0.5132634,
1.9 ´ 1.6
p1.5 ´ 1.9qQ4,0 ´ p1.5 ´ 2.2qQ3,0
Q4,1 p1.5q “ “ 0.5104270.
2.2 ´ 1.9
The higher-degree approximations are generated in a similar manner and are shown in the
following table.

1.0 0.7651977
1.3 0.6200860 0.5233449
1.6 0.4554022 0.5102968 0.5124715
1.9 0.2818186 0.5132634 0.5112857 0.5118127
2.2 0.1103623 0.5104270 0.5137361 0.5118302 0.5118200

If the latest approximation Q4,4 , was not sufficiently accurate, another node x5 , could be added,
and another row added to the table:
x5 Q5,0 Q5,1 Q5,2 Q5,3 Q5,4 Q5,5 .
Then, Q4,4 , Q5,4 , and Q5,5 could be compared to determine further accuracy.
42 CHAPTER 3. INTERPOLATION AND POLYNOMIAL APPROXIMATION

3.3 Divided Di↵erences

Iterated interpolation was used in the previous section to generate successively higher-degree
polynomial approximation at a specific point. Divided-di↵erence method introduced in this
section are used to successively generate the polynomials themselves.
Suppose that Pn pxq is the n-th Lagrange polynomial that agrees with the function f at the dis-
tinct numbers x0 , x1 , ¨ ¨ ¨ , xn . Although this polynomial is unique, there are alternate algebraic
representation that are useful in certain situations. The divided di↵erences of f with respect to
x0 , x1 , ¨ ¨ ¨ , xn are used to express Pn pxq in the form

Pn pxq “ a0 ` a1 px ´ x0 q ` a2 px ´ x0 qpx ´ x1 q ` ¨ ¨ ¨ ` an px ´ x0 q ¨ ¨ ¨ px ´ xn´1 q, (3.4)

for appropriate constants a0 , a1 , ¨ ¨ ¨ , an . To determine the first of these constants, a0 , note that
if Pn pxq is written in the form of (3.4), then evaluating Pn px0 q leaves only the constant term a0 ;
that is
a0 “ Pn px0 q “ f px0 q.
Similarly, when Pn pxq is evaluated at x1 , the only nonzero terms in the evaluation of Pn px1 q are
the constant and linear terms,
f px1 q ´ f px0 q
f px0 q ` a1 px1 ´ x0 q “ Pn px1 q “ f px1 q ùñ a1 “ .
x1 ´ x0
We now introduce the divided-di↵erence notation. The zeroth divided di↵erence of the
function f with respect to xi , denoted f rxi s, is simply the value of f at xi :

f rxi s “ f pxi q. (3.5)

The remaining divided di↵erences are defined recursively; the first divided di↵erence of f
with respect to xi and xi`1 is denoted f rxi , xi`1 s and defined as
f rxi`1 s ´ f rxi s
f rxi , xi`1 s :“ . (3.6)
xi`1 ´ xi
The second divided di↵erence, f rxi , xi`1 , xi`2 s is defined as
f rxi`1 , xi`2 s ´ f rxi , xi`1 s
f rxi , xi`1 , xi`2 s :“ . (3.7)
xi`2 ´ xi
Similarly, after the pk ´ 1q-st divided di↵erences,

f rxi , xi`1 , xi`2 , ¨ ¨ ¨ , xi`k´1 s and f rxi`1 , xi`2 , ¨ ¨ ¨ , xi`k´1 , xi`k s,

have been determined, the k-th divided di↵erence relative to xi , xi`1 , ¨ ¨ ¨ , xi`k is defined as
f rxi`1 , xi`2 , ¨ ¨ ¨ , xi`k´1 , xi`k s ´ f rxi , xi`1 , xi`2 , ¨ ¨ ¨ , xi`k´1 s
f rxi , ¨ ¨ ¨ , xi`k s :“ . (3.8)
xi`k ´ xi
The process ends with the single n-th divided di↵erence
f rx1 , x2 , ¨ ¨ ¨ , xn s ´ f rx0 , x1 , ¨ ¨ ¨ , xn´1 s
f rx0 , x1 , ¨ ¨ ¨ , xn s “ .
xn ´ x0
Now we can write a1 “ f rx0 , x1 s, just as a0 can be expressed as a0 “ f rx0 s. Hence, the
interpolating polynomial in (3.4) can be written as

Pn pxq “ f rx0 s ` f rx0 , x1 spx ´ x1 q ` a2 px ´ x0 qpx ´ x1 q ` ¨ ¨ ¨ ` an px ´ x0 qpx ´ x1 q ¨ ¨ ¨ px ´ xn´1 q,


3.3. DIVIDED DIFFERENCES 43

x f pxq First divided di↵erences Second divided di↵erences


x0 f rx0 s
f rx1 s ´ f rx0 s
f rx0 , x1 s “
x1 ´ x0
f rx1 , x2 s ´ f rx0 , x1 s
x1 f rx1 s f rx0 , x1 , x2 s “
x2 ´ x0
f rx2 s ´ f rx1 s
f rx1 , x2 s “
x2 ´ x1
f rx2 , x3 s ´ f rx1 , x2 s
x2 f rx2 s f rx1 , x2 , x3 s “
x3 ´ x1
f rx3 s ´ f rx2 s
f rx2 , x3 s “
x3 ´ x2
f rx3 , x4 s ´ f rx2 , x3 s
x3 f rx3 s f rx2 , x3 , x4 s “
x4 ´ x2
f rx4 s ´ f rx3 s
f rx3 , x4 s “
x4 ´ x3
f rx4 , x5 s ´ f rx3 , x4 s
x4 f rx4 s f rx3 , x4 , x5 s “
x5 ´ x3
f rx5 s ´ f rx4 s
f rx4 , x5 s “
x5 ´ x4
x5 f rx5 s

Table 3.3: The divided di↵erence table.

where ak “ f rx0 , x1 , ¨ ¨ ¨ , xk s, for each k “ 0, ¨ ¨ ¨ , n. Hence, Pn pxq can be rewritten in a form


called Newton’s Divided-Di↵erence:

n
ÿ
Pn pxq “ f rx0 s ` f rx0 , x1 , ¨ ¨ ¨ , xk spx ´ x0 q ¨ ¨ ¨ px ´ xk´1 q. (3.9)
k“1

The value of f rx0 , ¨ ¨ ¨ , xk s is independent of the order of the number x0 , ¨ ¨ ¨ , xk .


The generation of the divided di↵erences is outlined in the following table. Two fourth and one
fifth di↵erence can also be determined from these data.

Example 3.3.1. Complete the divided di↵erence table for the following data, and construct
the interpolating polynomial that uses all this data.

x 1.0 1.3 1.6 1.9 2.2


f pxq 0.7651977 0.6200860 0.4554022 0.2818186 0.1103623

Solution. The first divided di↵erence involving x0 and x1 is

f px1 q ´ f px0 q 0.6200860 ´ 0.7651977


f rx0 , x1 s “ “ “ ´0.4837057.
x1 ´ x0 1.3 ´ 1.0

The remaining first divided di↵erences are found in a similar manner and are shown in the fourth
column in the following table.
44 CHAPTER 3. INTERPOLATION AND POLYNOMIAL APPROXIMATION

i xi f rxi s f rxi´1 , xi s f rxi´2 , xi´1 , xi s f rxi´3 , ¨ ¨ ¨ , xi s f rxi´4 , ¨ ¨ ¨ , xi s


0 1.0 0.7651977
´0.4837057
1 1.3 0.6200860 ´0.1087339
´0.5489460 0.0658784
2 1.6 0.4554022 ´0.0494433 0.0018251
´0.5786120 0.0680685
3 1.9 0.2818186 0.0118183
´0.5715210
4 2.2 0.1103623

The Mean Value Theorem 1.1.14 applied to (3.6) when i “ 0,

f px1 q ´ f px0 q
f rx0 , x1 s “ ,
x1 ´ x0

implies that when f 1 exists, f rx0 , x1 s “ f 1 p⇠q for some number ⇠ between x0 and x1 . The
following theorem generalizes this result.

Theorem 3.3.2. Suppose that f P C n ra, bs and x0 , x1 , ¨ ¨ ¨ , xn are distinct numbers in ra, bs.
Then, a number ⇠ exists in pa, bq with

f pnq p⇠q
f rx0 , x1 , ¨ ¨ ¨ , xn s “ .
n!

Proof. Let gpxq :“ f pxq ´ Pn pxq. Since f pxi q “ Pn pxi q for each i “ 0, 1, ¨ ¨ ¨ , n, the function
g has n ` 1 distinct zeros in ra, bs. Generalized Rolle’s Theorem 1.1.16 implies that a number
⇠ P pa, bq exists with g pnq p⇠q “ 0, so

0 “ f pnq p⇠q ´ Pnpnq p⇠q.

Since Pn is a polynomial of degree n whose leading coefficient is f rx0 , x1 , ¨ ¨ ¨ , xn s, then

P pnq pxq “ n!f rx0 , x1 , ¨ ¨ ¨ , xn s,

for all values of x P ra, bs. As a consequence, we have

f pnq p⇠q
f rx0 , x1 , ¨ ¨ ¨ , xn s “ .
n!

Newton’s divided-di↵erence formula can be expressed in a simplified form when the nodes are
arranged consecutively with equal spacing. In this case, we introduce the notation h :“ xi`1 ´xi
for each i “ 0, 1, ¨ ¨ ¨ , n ´ 1 and let x “ x0 ` sh. Then, the di↵erence x ´ xi “ ps ´ iqh. Hence,
(3.9) becomes

Pn pxq “ Pn px0 ` shq “ f rx0 s ` shf rx0 , x1 s ` sps ´ 1qh2 f rx0 , x1 , x2 s


` ¨ ¨ ¨ ` sps ´ 1q ¨ ¨ ¨ ps ´ n ` 1qhn f rx0 , x1 , ¨ ¨ ¨ , xn s
ÿn
“ f rx0 s ` sps ´ 1q ¨ ¨ ¨ ps ´ k ` 1qhk f rx0 , x1 , ¨ ¨ ¨ , xk s.
k“1
3.4. HERMITE INTERPOLATION 45

Using binomial-coefficient notation,


ˆ ˙
s sps ´ 1q ¨ ¨ ¨ ps ´ k ` 1q
“ ,
k k!
we can express Pn pxq compactly as
n ˆ
ÿ ˙
s
Pn pxq “ Pn px0 ` shq “ f rx0 s ` k!hk f rx0 , x1 , ¨ ¨ ¨ , xk s.
k
k“1

Remark: One can use the notation of forward di↵erence (or backward di↵erence) to
rewrite the Newton’s divided-di↵erence formula above. This is just a book keeping and leave as
an exercise.

3.4 Hermite Interpolation

In this section, we introduce the concept of Hermite polynomial. For a given function f , the
Hermite polynomial Hpxq agree with f at x0 , x1 , ¨ ¨ ¨ , xn . Moreover, it requires that the first
derivatives of the Hermite polynomial Hpxq agree with those of f .
More precisely, the Hermite polynomial Hpxq corresponding to the function f at the given points
x0 , x1 , ¨ ¨ ¨ , xn satisfies the following conditions:

Hpxi q “ f pxi q and H 1 pxi q “ f 1 pxi q for i “ 0, 1, ¨ ¨ ¨ , n.

In total, there are 2n ` 2 constraints for the Hermite polynomial Hpxq and therefore it is a
polynomial with degree at most 2n ` 1. In order to find out the basis functions for the Hermite
polynomial, we make use of the Lagrange basis functions introduced in Section 3.1.
To simplify the notation, we define jk satisfying the following conditions:
"
1 if j “ k
jk “
0 if j ‰ k.

pnq
Suppose that we have developed two sets of basis functions with degree 2n ` 1, denoted tHk u
pnq
and tĤk u, for Hermite polynomial such that the following conditions are satisfied: for j “
0, 1, ¨ ¨ ¨ , n,
´ ¯
pnq pnq 1
Hk pxj q “ jk , Hk pxj q “ 0,
´ ¯1 (3.10)
pnq pnq
Ĥk pxj q “ 0, Ĥk pxj q “ jk .

Then, the desired Hermite polynomial Hpxq (with degree at most 2n ` 1) can be written as the
linear combination of those basis functions:
n
ÿ pnq pnq
Hpxq “ f pxj qHk pxq ` f 1 pxj qĤk pxq.
j“0

pnq pnq
It remains to find out the formula for Hk and Ĥk . Recall that the Lagrange basis functions
with degree n are defined as follows: for k “ 0, 1, ¨ ¨ ¨ , n
πn
pnq px ´ x0 qpx ´ x1 q ¨ ¨ ¨ px ´ xk´1 qpx ´ xk`1 q ¨ ¨ ¨ px ´ xn q x ´ xi
Lk pxq “ “ .
pxk ´ x0 qpxk ´ x1 q ¨ ¨ ¨ pxk ´ xk´1 qpxk ´ xk`1 q ¨ ¨ ¨ pxk ´ xn q i“0, i‰k xk ´ xi
46 CHAPTER 3. INTERPOLATION AND POLYNOMIAL APPROXIMATION

pnq pnq
We make use of the Lagrange basis functions to derive the formula for Hk and Ĥk . Since for
pnq pnq
each k “ 0, 1, ¨ ¨ ¨ , n the polynomial Hk is of degree 2n ` 1, one may assume that Hk has the
following form
´ ¯2
pnq pnq
Hk pxq “ pax ` bq Lk pxq .

pnq
Using the conditions in the first line of (3.10) for Hk , we have
´ ¯
pnq 1
axk ` b “ 1 and a ` 2paxk ` bq Lk pxk q “ 0.

It implies that
´ ¯ ´ ¯
pnq 1 pnq 1
a “ ´2 Lk pxk q and b “ 1 ` 2xk Lk pxk q.

Hence, we have
ˆ ´ ¯ ˙´ ¯2
pnq pnq 1 pnq
Hk pxq “ 1 ´ 2px ´ xk q Lk pxk q Lk pxq for k “ 0, 1, ¨ ¨ ¨ , n.

Similarly, we assume that


´ ¯2
pnq pnq
Ĥk pxq “ pcx ` dq Lk pxq .

pnq
Using the conditions in the second line of (3.10) for Ĥk , we have
´ ¯
pnq 1
cxk ` d “ 0 and c ` 2pcxk ` dq Lk pxk q “ 1.

It implies that
c“1 and d “ ´xk .

Hence, we have
´ ¯2
pnq pnq
Ĥk pxq “ px ´ xk q Lk pxq .

We summarize the results above as a theorem.

Theorem 3.4.1. If f P C 1 ra, bs and x0 , ¨ ¨ ¨ , xn P ra, bs are distinct, the unique polynomial of
least degree agreeing with f and f 1 at x0 , ¨ ¨ ¨ , xn is the Hermite polynomial of degree at most
2n ` 1, given by
ÿn
H2n`1 pxq “ f pxj qHn,j pxq ` f 1 pxj qĤn,j pxq,
j“0

where, for Ln,j pxq denoting j-th Lagrange coefficient polynomial of degree n, we have

Hn,j pxq “ r1 ´ 2px ´ xj qL1n,j pxj qsL2n,j pxq and Ĥn,j pxq “ px ´ xj qL2n,j pxq.

Moreover, if f P C 2n`2 ra, bs, then

px ´ x0 q2 ¨ ¨ ¨ px ´ xn q2 p2n`2q
f pxq “ H2n`1 pxq ` f p⇠pxqq ,
p2n ` 2q!

for some (generally unknown) ⇠pxq in the interval pa, bq.


3.4. HERMITE INTERPOLATION 47

When n “ 1, there are two points x0 and x1 given and we may explicitly write down the complete
formulas for basis functions for Hermite polynomial:
ˆ ˙ˆ ˙
p1q x ´ x0 x ´ x1 2
H0 pxq “ 1 ´ 2 ,
x0 ´ x1 x0 ´ x1
ˆ ˙ˆ ˙
p1q x ´ x1 x ´ x0 2
H1 pxq “ 1 ´ 2 ,
x1 ´ x0 x1 ´ x0
ˆ ˙
p1q x ´ x1 2
Ĥ0 pxq “ px ´ x0 q ,
x0 ´ x1
ˆ ˙
p1q x ´ x0 2
Ĥ1 pxq “ px ´ x1 q .
x1 ´ x0
Example 3.4.2. Let f pxq “ ln x. Given
f p1.0q “ 0.0, f p2.0q “ 0.693147, f 1 p1.0q “ 1.0, and f 1 p2.0q “ 0.5,
find the Hermite polynomial Hpxq corresponding to the function f about x0 “ 1.0 and x1 “ 2.0.
Use Hp1.5q as an approximation of f p1.5q and compute the absolute error.

Solution. Using the formula above, we have


1
Hpxq “ 0.693147p5 ´ 2xqpx ´ 1q2 ` px ´ 1qpx ´ 2q2 ` px ´ 2qpx ´ 1q2
2
and we have Hp1.5q “ 0.409074. One may also obtain f p1.5q “ 0.405465 and
|f p1.5q ´ Hp1.5q| « 0.0036089.
See the figure below for an illustration. They look like almost the same.
0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

-0.1
1 1.2 1.4 1.6 1.8 2

Remark: More generally, the so-called osculating polynomial is generalizing both the Tay-
lor polynomial and Lagrange polynomial. Suppose that we are given n ` 1 distinct numbers
x0 , x1 , ¨ ¨ ¨ , xn in ra, bs and nonnegative integers m0 , m1 , ¨ ¨ ¨ , mn , and m “ maxtm0 , m1 , ¨ ¨ ¨ , mn u.
The osculating polynomial approximating a function f P C m ra, bs at xi , for each i “ 0, ¨ ¨ ¨ , n, is
the polynomial of least degree that has the same values as the function f and all its derivatives
of order less than or equal to mi at each xi . The degree of this osculating polynomial is at most
n
ÿ
M “n` mi
i“0
48 CHAPTER 3. INTERPOLATION AND POLYNOMIAL APPROXIMATION


because the number of condition to be satisfied is n ` 1 ` ni“0 mi , and a polynomial of degree
M has M ` 1 coefficients that can be used to satisfy these conditions.

Definition 3.4.3 (Osculating Polynomial). Let x0 , x1 , ¨ ¨ ¨ , xn be n ` 1 distinct numbers in


ra, bs and for i “ 0, 1, ¨ ¨ ¨ , n let mi be a nonnegative integer. Suppose that f P C m ra, bs, where
m “ max mi . The osculating polynomial approximating f is the polynomial P of least
0§i§n
degree such that

dk P pxi q dk f pxi q
“ for each i “ 0, 1, ¨ ¨ ¨ , n and k “ 0, 1, ¨ ¨ ¨ , mi .
dxk dxk
Note that when n “ 0, the osculating polynomial approximating f is the m0 -th Taylor Poly-
nomial for f at x0 . When mi “ 0 for each i, the osculating polynomial is the n-th Lagrange
polynomial interpolating f on x0 , x1 , ¨ ¨ ¨ , xn .

The case when mi “ 1, for each i “ 0, 1, ¨ ¨ ¨ , n, gives the Hermite polynomials. For a
given function f , these polynomials agree with f at x0 , x1 , ¨ ¨ ¨ , xn . In addition, since their first
derivatives agree with those of f , they have the same shape as the function at pxi , f pxi qq in the
sense that the tangent lines to be the polynomial and the function agree.
Although Theorem 3.4.1 provides a complete description of the Hermite polynomials, it is clear
from the above example that the need to determine and evaluate the Lagrange polynomials and
their derivatives makes the procedure tedious even for small values of n.
There is an alternative method for generating Hermite approximations that has as its basis the
Newton interpolatory divided-di↵erence formula (3.9) at x0 , x1 , ¨ ¨ ¨ , xn , that is
n
ÿ
Pn pxq “ f rx0 s ` f rx0 , x1 , ¨ ¨ ¨ , xk spx ´ x0 q ¨ ¨ ¨ px ´ xk´1 q.
k“1

The alternative method uses the connection between the n-th divided di↵erence and the n-th
derivative of f . Suppose that the distinct numbers x0 , x1 , ¨ ¨ ¨ , xn are given together with the
values of f and f 1 at these numbers. Define a new sequence z0 , z1 , ¨ ¨ ¨ , z2n`1 by

z2i “ z2i`1 “ xi , for each i “ 0, 1, ¨ ¨ ¨ , n

and construct the divided di↵erence table in the form of Table 3.3 that uses z0 , z1 , ¨ ¨ ¨ , z2n`1 .
Since z2i “ z2i`1 “ xi for each i, we cannot define f rz2i , z2i`1 s by the divided di↵erence for-
mula. However, if we assume that the reasonable substitution in this situation is f rz2i , z2i`1 s “
f 1 pz2i q “ f 1 pxi q, we can use the entries f 1 px0 q, f 1 px1 q, ¨ ¨ ¨ , f 1 pxn q in place of the undefined first
divided di↵erences
f rz0 , z1 s, f rz2 , z3 s, ¨ ¨ ¨ , f rz2n , z2n`1 s.
The remaining divided di↵erences are produced as usual, and the appropriate divided di↵erence
are employed in Newton’s interpolatory divided-di↵erence formula. Table 3.4 shows the entries
that are used for the first three divided-di↵erence columns when determining the Hermite poly-
nomial H5 pxq for x0 , x1 , and x2 . The remaining entries are generated in the same manner. The
Hermite polynomial is then given by
2n`1
ÿ
H2n`1 pxq “ f rz0 s ` f rz0 , ¨ ¨ ¨ , zk spx ´ z0 qpx ´ z1 q ¨ ¨ ¨ px ´ zk´1 q.
k“1
3.5. PIECEWISE POLYNOMIALS APPROXIMATION 49

x f pxq First divided di↵erences Second divided di↵erences


z0 “ x 0 f rz0 s “ f px0 q
f rz0 , z1 s “ f 1 px0 q
f rz1 , z2 s ´ f rz0 , z1 s
z1 “ x 0 f rz1 s “ f px0 q f rz0 , z1 , z2 s “
z2 ´ z0
f rz2 s ´ f rz1 s
f rz1 , z2 s “
z2 ´ z1
f rz2 , z3 s ´ f rz1 , z2 s
z2 “ x 1 f rz2 s “ f px1 q f rz1 , z2 , z3 s “
z3 ´ z1
f rz2 , z3 s “ f 1 px1 q
f rz3 , z4 s ´ f rz2 , z3 s
z3 “ x 1 f rz3 s “ f px1 q f rz2 , z3 , z4 s “
z4 ´ z2
f rz4 s ´ f rz3 s
f rz3 , z4 s “
z4 ´ z3
f rz4 , z5 s ´ f rz3 , z4 s
z4 “ x 2 f rz4 s “ f px2 q f rz3 , z4 , z5 s “
z5 ´ z3
f rz4 , z5 s “ f 1 px2 q
z5 “ x 2 f rz5 s “ f px2 q

Table 3.4: The modified divided di↵erence table for polynomial of Hermite type.

3.5 Piecewise Polynomials Approximation

The previous sections concerned the approximation of arbitrary functions on closed intervals
using a single polynomial. However, high-degree polynomials can oscillate erratically, that is,
a minor fluctuation over a small portion of the interval can induce large fluctuations over the
entire range.
1
Example 3.5.1 (Runge’s Phenomenon). Let f pxq “ and x P r´5, 5s. We partition
1 ` x2
the interval using the nodes xk “ ´5 ` kh with k “ 0, 1, ¨ ¨ ¨ , 10. Find the 10-th Lagrange
Interpolation Polynomial of f pxq.

Solution. The 10-th Lagrange polynomial P can be written as follows:


10
ÿ
P pxq “ f pxk qLk pxq.
k“0

The shapes of the function f and P can be found in the following figure. One can see from the
graph that when x is between ´3 and 3, the di↵erence |f pxq ´ P pxq| is quite small. However,
when |x| ° 3, the di↵erence is large, especially when x is near the endpoints, the di↵erence
becomes dramatically large. In general, one may not use a higher-order Lagrange interpolating
polynomial to approximate a function.

An alternative approach is to divide the approximation interval into a collection of subintervals


and construct a (generally) di↵erent approximating polynomial on each subinterval. This is
called piecewise-polynomial approximation. The simplest piecewise-polynomial approxi-
mation is piecewise-linear interpolation, which consists of joining a set of data points

tpx0 , f px0 qq, px1 , f px1 qq, ¨ ¨ ¨ , pxn , f pxn qqu

by a series of straight lines. See Figure 3.3 for illustration.


50 CHAPTER 3. INTERPOLATION AND POLYNOMIAL APPROXIMATION

2.5

1.5

0.5

-0.5
-6 -4 -2 0 2 4 6

1
Figure 3.2: Using Lagrange polynomial P pxq to approximate the function f pxq “ .
1 ` x2
1.5

0.5

-6 -4 -2 0 2 4 6

1
Figure 3.3: Using piecewise linear function Qpxq to approximate the function f pxq “ .
1 ` x2

To be more specific, in each subinterval rxi , xi`1 s for i “ 0, 1, ¨ ¨ ¨ , n ´ 1, we use a first-order


Lagrange Interpolation polynomial to approximate the function f pxq. The Lagrange basis func-
tions in this subinterval rxi , xi`1 s are given by the following formulas

p1q x ´ xi`1 p1q x ´ xi


Li pxq “ and Li`1 pxq “ .
xi ´ xi`1 xi`1 ´ xi

Then, the corresponding (first-order) Lagrange Interpolation polynomial Pi is

p1q p1q
Pi pxq “ f pxi qLi pxq ` f pxi`1 qLi`1 pxq for x P rxi , xi`1 s.

Eventually, the piecewise linear function Qpxq is defined to be

Qpxq “ Pi pxq, for x P rxi , xi`1 s, i “ 0, 1, ¨ ¨ ¨ , n ´ 1.

If f is at least twice di↵erentiable, then the remainder can be written as follows: for x P rxi , xi`1 s,

1
Ri pxq “ f pxq ´ Pi pxq “ f 2 p⇠pxqqpx ´ xi qpx ´ xi`1 q
2
3.5. PIECEWISE POLYNOMIALS APPROXIMATION 51

and we have the following error estimate


1
|Ri pxq| § pxi`1 ´ xi q2 max f 2 pxq , for all x P rxi , xi`1 s.
8 xPrxi ,xi`1 s

If the points x0 , x1 , ¨ ¨ ¨ , xn (assuming x0 § x1 § ¨ ¨ ¨ § xn ) are equally distributed and let


h “ xn ´x
n , then we have
0

h2
|f pxq ´ Qpxq| § max f 2 pxq , for all x P rx0 , xn s.
8 xPrx0 ,xn s

A disadvantage of linear function approximation is that there is likely no di↵erentiability at


the endpoints of the subintervals, which, in a geometrical context, means that the interpolating
function is not smooth. Often it is clear from physical condition that smoothness is required,
so the approximating function must be continuously di↵erentiable.
An alternative is to use a piecewise polynomial of Hermite type. For example, if the values of f
and of f 1 are known at each of the points x0 † x1 † ¨ ¨ ¨ † xn , a cubic Hermite polynomial can
be used on each of the subintervals rx0 , x1 s, rx1 , x2 s, ¨ ¨ ¨ , rxn´1 , xn s to obtain a function that has
a continuous derivative on the interval rx0 , xn s.
To determine the appropriate Hermite cubic polynomial on a given interval is simply a matter of
computing H3 pxq for that interval. The Lagrange interpolating polynomials needed to determine
H3 are of first degree, so this can be accomplished without great difficulty. However, to use
Hermite piecewise polynomials for general interpolation, we need to know the derivative of the
function being approximated, and this is frequently unavailable.

You might also like