0% found this document useful (0 votes)
124 views

Interpolation

The document discusses polynomial interpolation. It defines polynomial interpolation as finding a polynomial P(x) of lowest possible degree such that P(xi)=yi for the given data points (xi, yi). It proves that a unique polynomial of degree less than or equal to N exists to interpolate N+1 data points if the x-values are distinct. It describes the Newton form and Lagrange form for writing the interpolation polynomial and provides examples to illustrate both forms. It also discusses the error in polynomial interpolation.

Uploaded by

Vishal Hariharan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
124 views

Interpolation

The document discusses polynomial interpolation. It defines polynomial interpolation as finding a polynomial P(x) of lowest possible degree such that P(xi)=yi for the given data points (xi, yi). It proves that a unique polynomial of degree less than or equal to N exists to interpolate N+1 data points if the x-values are distinct. It describes the Newton form and Lagrange form for writing the interpolation polynomial and provides examples to illustrate both forms. It also discusses the error in polynomial interpolation.

Uploaded by

Vishal Hariharan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Chapter 5

Interpolation

5.1 Polynomial Interpolation


Given the data as given in Table 5.1, we seek a polynomial P (x) of lowest possible degree

Table 5.1: Given Data

x0 x1 x2 ⋯ xN
y0 y1 y2 ⋯ yN

for which p(xi ) = yi , 0 ≤ i ≤ N .

5.1.1 Theorem on Polynomial Interpolation


If x0 , x1 , ⋯, xN are distinct real numbers, then for any arbitrary values y0 , y1 , ⋯, yN , there
is a unique polynomial pN of degree at most N such that PN (xi ) = yi 0 ≤ i ≤ N .

Proof
Let us prove the uniqueness first. Suppose there were two such polynomials, pN and qN .
Then the polynomial pN − qN would have the property (pN − qN )(xi ) = 0 for 0 ≤ i ≤ N . Since
the degree of pN − qN can be at most N , this polynomial can have at most N zeros if it is
not the 0 polynomial. Since the xi are distinct, pN − qN has N + 1 zeros; it must therefore
be 0. Hence, pN = qN .
To prove the existence, let us use mathematical induction. For N = 0, the existence is obvious
since a constant function p0 (polynomial of degree zero) can be chosen so that p0 (x0 ) = y0 .
Now suppose that we have obtained a polynomial pk−1 of degree ≤ k − 1 with pk−1 (xi ) = yi
for 0 ≤ i ≤ k − 1. Now try to construct the polynomial pk in the form

pk (x) = pk−1 (x) + c(x − x0 )(x − x1 )⋯(x − xk−1 ) (5.1)

Note that this is unquestionably a polynomial of degree at most k. Furthermore, pk inter-


polates the data that pk−1 interpolates because pk (x0 ) = Pk−1 (xi ) = yi for 0 ≤ i ≤ k − 1. Now

43
44 Sanyasiraju V S S Yedida [email protected]

to determine the unknown coefficient c use the condition pk (xN ) = yN leads to the equation
Pk−i (xk ) + c(xk − x0 )(xk − x1 )⋯(xk − xk−1 ) = yk (5.2)
Equation (2) can certainly be solved for c because none of the factors multiplying c are zero
since all xi are distinct. Therefore, the value of c is
yk − Pk−i (xk )
c = (5.3)
(xk − x0 )(xk − x1 )⋯(xk − xk−1 )

5.1.2 Newton Form of the Interpolation Polynomial


In the proof of the theorem (5.1.1), the polynomials p0 , p1 , ⋯, pn are constructed recursively
by adding one additional term to the earlier polynomial as shown in (5.2). Therefore, any
polynomial pk can be written in terms of p0 , p1 , ⋯, pk−1 as
k i−1
Pk = c0 + c1 (x − x0 ) + c2 (x − x0 )(x − x1 ) + ⋯ + ck (x − x0 )(x − x1 )⋯(x − xk−1 ) = ∑ ci ∏(x − xj )(5.4)
i=0 j=0

The following Horner’s Algorithm is one easier way of computing the sum of the products
(⋯(((ck )(x − xk−1 ) + ck−1 )(x − xk−2 ) + ck−2 )(x − xk−3 ) + ⋯ + c1 )(x − x0 ) + c0 (5.5)

5.1.3 Numerical Example


Find the Polynomial approximations for the data

Table 5.2: Data

x 5 -7 -6 0
y 1 -23 -54 -954

p0 = c0 = 1
p1 (x) = c0 + c1 (x − x0 ) = 1 + c1 (x − 5)
−24
at x = −7, p1 (−7) = −23 = 1 + c1 (−7 − 5) ⇒ c1 = =2
−12
⇒ p1 (x) = 1 + 2(x − 5) = 2x − 4
p2 (x) = c0 + c1 (x − x0 ) = 1 + 2(x − 5) + c2 (x − 5)(x + 7)
−54 + 21
at x = −6, p1 (−6) = −54 = 1 + 2(−7 − 5) + c2 (−6 − 5)(−6 + 7) ⇒ c2 = =3
−11
⇒ p2 (x) = 1 + 2(x − 5) + 3(x − 5)(x + 7) = 3x2 + 8x − 114
p3 (x) = c0 + c1 (x − x0 ) + c1 (x − x0 )(x − x1 ) = 1 + 2(x − 5) + 3(x − 5)(x + 7) + c3 (x − 5)(x + 7)(x + 6)
−954 + 9 + 105
at x = 0, p1 (0) = −954 = 1 + 2(−5) + 3(−5)(+7) + c3 (−5)(7)(6) ⇒ c3 = =4
−5x7x6
⇒ p3 (x) = 1 + 2(x − 5) + 3(x − 5)(x + 7) + 4(x − 5)(x + 7)(x + 6) = 4x3 + 35x2 − 84x − 954
Lecture Notes MA5470 Numerical Analysis 45

5.2 Lagrange Form of the Interpolation Polynomial


Consider the data (xi , yi ), 0 ≤ i ≤ n. It is known that there exists only one polynomial,
of degree less or equal to n, passing through the chosen n + 1 points (provided all xi are
distinct). To find such a polynomial, consider

p(x) = c0 + c1 x + c2 x2 + ⋯ + cn xn (5.6)

Imposing the conditions (xi , yi ), 0 ≤ i ≤ n leads to

⎛ 1 x0 x20 ⋯ xn0 ⎞⎛ c0 ⎞ ⎛ y0 ⎞
⎜ 1 x1 x21 ⋯ xn1 ⎟⎜ c1 ⎟ ⎜ y1 ⎟
⎜ ⎟⎜ ⎟ ⎜ ⎟
⎜ 1 x2 x22 ⋯ xn2 ⎟⎜ c2 ⎟=⎜ y2 ⎟
⎜ ⎟⎜ ⎟ ⎜ ⎟ (5.7)
⎜ ⋯ ⋯ ⋯ ⋯ ⋯ ⎟⎜ ⋯ ⎟ ⎜ ⋯ ⎟
⎜ ⎟⎜ ⎟ ⎜ ⎟
⎝ 1 xn x2n ⋯ xnn ⎠⎝ cn ⎠ ⎝ yn ⎠

The coefficient matrix in (5.7) is called Vandermonde matrix. It is nonsingular, because


the problem (5.6) has a unique solution for any choice of yi but distinct xi . However,
Vandemonde is mostly ill conditioned. Therefore, computation of ci by solving (5.7) is very
inaccurate. Alternately, consider the form

p(x) = y0 l0 (x) + y1 l1 (x) + ⋯ + yn ln (x) (5.8)

where li (x), i = 1, 2, ⋯n are polynomials (of degree n) dependent on the abscissa points xi
but not on the ordinates yi . If each li in (5.8) satisfies the cardinal conditions, that is
li (xj ) = δij for 0 ≤ i, j ≤ n, then (5.8) satisfies all the n + 1 interpolation conditions p(xi ) = yi .
For example consider li (x) as
n
li (x) = c(x − x0 )(x − x1 )⋯(x − xi−1 )(x − xi+1 )⋯(x − xn ) = c ∏ (x − xj )
j=0
j≠i

li (x) is zero at every given point except at xi . Enforcing the value ONE at xi gives

1
c= n
∏ (xi − xj )
j=0
j≠i

Therefore, each Lagrange function (also known as Cardinal function) can be written as
n
x − xj
li (x) = ∏ , 0≤i≤n (5.9)
xi − xj
j=0
j≠i
46 Sanyasiraju V S S Yedida [email protected]

5.2.1 Numerical example


Compute the Lagrange polynomial for the data

x 5 -7 -6 0
y 1 -23 -54 -954

The Lagrange polynomial can be written as


p(x) = l0 (x) − 23l1 (x) − 54l2 (x) − 954l3 (x)
where
(x + 7)(x + 6)x (x − 5)(x + 6)x
l0 (x) = , l1 (x) =
(5 + 7)(5 + 6)5 (−7 − 5)(−7 + 6)(−7)
(x − 5)(x + 7)x (x − 5)(x + 7)(x + 6)
l3 (x) = , l4 (x) =
(−6 − 5)(−6 + 7)(−6) (0 − 5)(0 + 7)(0 + 6)

5.2.2 Error in the Polynomial Interpolation


Let f be a function in C n+1 [a, b], and let p be the polynomial of degree ≤ n that interpolates
the function f at n + 1 distinct points x0 , x1 , ⋯, xn in the interval [a, b]. To each x in [a, b]
there corresponds a point ξx in (a, b) such that
n
1
f (x) − p(x) = f (n+1) (ξx ) ∏(x − xi ) (5.10)
(n + 1)! i=0

Proof : If x is one of the points of xi , then both left and right sides of the formula gives
zero satisfying the theorem. Therefore, assume that x is any point other than xi . Denote
n
w(t) = ∏(t − xi ), ϕ=f −p−λw (5.11)
i=0

where λ is the real number that makes ϕ(x) = 0 (note that x is fixed). Thus
f (x) − p(x)
λ=
w(x)
Now ϕ ∈ C n+1 [a, b], and ϕ vanishes at the n + 2 points x, x0 , x1 , ⋯, xn .
By Roll’s theorem, ϕ′ has at least n + 1 distinct zeros in (a, b) (one in every two consecutive
points of x and xi ). Similarly, ϕ′′ has at least n distinct zeros in (a, b). If this argument is
continued, we can conclude ϕ(n+1) has at least one zero, say ξx , in (a, b).
Therefore
ϕ(n+1) = f (n+1) − p(n+1) − λw(n+1) = f (n+1) − (N + 1)! λ
Thus
f (x) − p(x)
0 = ϕ(n+1) (ξx ) = f (n+1) (ξx ) − (n + 1)!λ = f (n+1) (ξx ) − (n + 1)!
w(x)
Rearrangement of the last equation gives the required result.
Lecture Notes MA5470 Numerical Analysis 47

5.2.3 Numerical Illustration


If the function f (x) = sin x is approximated by a polynomial of degree nine that interpolates
f at ten points in the interval [0, 1], how large is the error on this interval?
With the given data,
9
∣f 10 (ξx )∣ ≤ 1, ∏ ∣x − xi ∣ ≤ 1,
i=0

Therefore, for all x in [0, 1]


1
∣ sin x − p(x)∣ ≤ < 2.8 × 10−7
10!

5.3 Problems
1. Find the polynomials of least degree that interpolates the following data sets

x 3 7
y 5 -1

(a)

x 7 1 2
y 146 2 1

(b)

x 3 7 1 2
y 10 146 2 1

(c)

2. The polynomial p of degree ≤ n that interpolates a given function f at n + 1 prescribed


nodes is uniquely defined. Hence there is a mapping f z→ p. Denote this mapping by
L
n
(a) Show that Lf = ∑ f (xi ) li
i=0

(b) Show that L is linear; that is, L(af + bg) = aLf + bLg.
(c) Prove that Lq = q for every polynomial q of degree at most n.
n
(d) Consider the mapping Gf = ∑ f (xi ) li2 . Prove that GF is a polynomial of degree
i=0
at most 2n, that Gf interpolates f at the points xi , i = 0, 1, ⋯n, and that Gf is
nonnegative whenever f is nonnegative.
48 Sanyasiraju V S S Yedida [email protected]

n
(e) Prove that ∑ li = 1
i=0
(f) Prove that if p is a polynomial of degree ≤ n that interpolates the function f at
xi , i = 0, 1, ⋯n (distinct) then
n
f (x) − p(x) = ∑ (f (x) − f (xi )) li (x)
i=0

3. Prove that the algorithm for computing the coefficients ci in the Newton form of the
interpolating polynomial involves n2 long operations
4. Discuss the problem of determining a polynomial of degree at most 2 for which p(0),
p(1) and p′ (ξ) are prescribed, ξ being any preassigned point.
5. Prove that if g interpolates the function f at x0 , x1 , ⋯, xn−1 and if h interpolates f at
x1 , x2 , ⋯, xn , then the function
x0 − x
g(x) + (g(x) − h(x))
xn − x0
interpolates f at x0 , x1 , ⋯, xn (g and h need not be polynomials).

5.4 Divided Differences


Consider the basis
q0 (x) = 1
q1 (x) = (x − x0 )
q2 (x) = (x − x0 ) (x − x1 )
q3 (x) = (x − x0 ) (x − x1 ) (x − x2 )
..
.
qn (x) = (x − x0 ) (x − x1 ) (x − x2 )⋯ (x − xn−1 )
and express the n degree polynomial
n
p(x) = ∑ cj qj (x) (5.12)
j=0

Imposing the n + 1 interpolation conditions, gives


n
∑ cj qj (xi ) = f (xi ), 0 ≤ i ≤ n (5.13)
j=0

(5.13) is a linear system for finding the n + 1 unknowns c0 , c1 , ⋯, cn with (n + 1) × (n + 1)


coefficient matrix A having the elements
j−1
aij = qj (xi ) = ∏(xi − xj ), 0 ≤ i, j ≤ n (5.14)
k=0
Lecture Notes MA5470 Numerical Analysis 49

Thus, A is a lower triangular matrix with ones as the first column. Therefore the forward
substitution of the system (5.13) gives

f (x1 ) − f (x0 )
c0 = f (x0 ), c1 = ,
x1 − x0
1 x2 − x0
c2 = (f (x2 ) − f (x0 ) − (f (x1 ) − f (x0 ))) , and so on (5.15)
(x − x0 )(x − x1 ) x1 − x0

The following rearrangement of ci are called the divided differences of the data (xi , f (xi )), i =
0, 1, ⋯, n.

f (x1 ) − f (x0 )
c0 = f [x0 ], c1 = f [x0 , x1 ] = ,
x1 − x0
1 x2 − x0
c2 = f [x0 , x1 , x2 ] = (f (x2 ) − f (x0 ) − (f (x1 ) − f (x0 )))
(x2 − x0 )(x2 − x1 ) x1 − x0
(x1 − x0 )(f (x2 ) − f (x0 )) − (x2 − x0 )(f (x1 ) − f (x0 ))
=
(x2 − x0 )(x2 − x1 )
(x1 − x0 )f (x2 ) − (x2 − x1 + x1 − x0 )f (x1 ) + (x2 − x1 )f (x0 )
=
(x2 − x0 )(x2 − x1 )(x1 − x0 )
1 f (x2 ) − f (x1 ) f (x1 ) − f (x0 ) f [x1 , x2 ] − f [x0 , x1 ]
c2 = ( − ) = (5.16)
(x2 − x0 ) x2 − x1 x1 − x0 x2 − x0

Therefore, one can say, coefficient of xk in the k th degree polynomial which is passing through
the k + 1 distinct points (xi , f (xi )), i = 0, 1, ⋯, k is the k th divided difference.

5.4.1 Divided differences satisfy the equation

f [x1 , x2 , ⋯, xn ] − f [x0 , x1 , ⋯, xn−1 ]


f [x0 , x1 , ⋯, xn ] = (5.17)
xn − x0

Proof : Let pk denote the polynomial of degree at most k that interpolates f at the nodes
x0 , x1 , ⋯, xk .
Let q denote the polynomial of degree at most n − 1 that interpolates f at x1 , x2 , ⋯, xn .
Consider
x − xn
pn (x) = q(x) + (q(x) − pn−1 (x)) (5.18)
xn − x0

(5.18) is a polynomial of degree at most n which is passing through the n + 1 points x0 ,


x1 , ⋯, xn , therefore is unique. And the coefficient of xn (supposed to be cn ) is the divided
difference given in the theorem statement.

Therefore, if a data of function values (xi , f (xi )) is given, using (5.16) and (5.17) one can
construct the divided difference table of the form
50 Sanyasiraju V S S Yedida [email protected]

x0 f (x0 ) f [x0 , x1 ] f [x0 , x1 , x2 ] f [x0 , x1 , x2 , x3 ]


x1 f (x1 ) f [x1 , x2 ] f [x1 , x2 , x3 ]
x2 f (x2 ) f [x2 , x3 ]
x3 f (x3 )
Table 5.3: Divided difference table for FOUR data points

Once the table is constructed, the polynomial that is passing through the given data is given
by (following (5.12))

f (x) = p(x) = f [x0 ] + f [x0 , x1 ](x − x0 ) + f [x0 , x1 , x2 ](x − x0 )(x − x1 )


+ f [x0 , x1 , x2 , x3 ](x − x0 )(x − x1 )(x − x2 ) (5.19)

5.4.2 Numerical Illustration


Construct the divided difference table and then find the polynomial that interpolates the
given data.

3 1 2 −.375 .175
1 −3 1.25 .15
5 2 2
6 4
Table 5.4: Divided difference table for the given data

The polynomial that is passing through the given data is

f (x) = p(x) = f [x0 ] + f [x0 , x1 ](x − x0 ) + f [x0 , x1 , x2 ](x − x0 )(x − x1 )


+ f [x0 , x1 , x2 , x3 ](x − x0 )(x − x1 )(x − x2 )
= 1(x − 3) + 2(x − 3)(x − 1) − .375(x − 3)(x − 1)(x − 5) + .175(x − 3)(x − 1)(x − 5)(x − 6)
= .175x4 − 3x3 + 18.85x2 − 42.4x + 24.375

5.4.3 Properties of the divided differences


1. Divided difference is a symmetric function of its arguments. Thus, if (z0 , z1 , ⋯, zn ) is
a permutation of (x0 , x1 , ⋯, xn ), then f [z0 , z1 , ⋯, zn ] = f [x0 , x1 , ⋯, xn ]

Proof : The divided difference on the left side is the coefficient of xn in the poly-
nomial of degree at most n that interpolates f at the points (z0 , z1 , ⋯, zn ).
The divided difference on the right is the coefficient of xn in the polynomial of degree at
most n that interpolates f at the points (x0 , x1 , ⋯, xn ). These two polynomials are one
and same from the uniqueness the polynomial passing through the data (independent
of the order of the data)
Lecture Notes MA5470 Numerical Analysis 51

2. Let p be the polynomial of degree at most n that interpolates a function f at a set of


n + 1 distinct points (x0 , x1 , ⋯, xn ). If t is a point different from the given points, then
n
f (t) P (t) = f [x0 , x1 , ⋯, xn , t] = f [x0 , x1 , ⋯, xn , t] ∏(t − xi )
i=0

Proof : First, let q be the polynomial of degree at most n + l that interpolates f at


the nodes (x0 , x1 , ⋯, xn , t). We know that q is obtained from p by adding one term. In
fact,
n
q(x) = p(x) + f [x0 , x1 , ⋯, xn , t] ∏(t − xi )
i=0

Since q(t) = f (t), we obtain at once (by letting x = t)


n
f (t) = p(t) + f [x0 , x1 , ⋯, xn , t] ∏(t − xi )
i=0

3. If f is n times continuously differentiable on [a, b] and if x0 , x1 , ⋯, xn are distinct points


in [a, b], then there exists a point ξ in (a, b) such that
1 n
f [x0 , xl , ⋯, xn ] = f (ξ)
n!
Proof : First, let p be the polynomial of degree at most nl that interpolates f at the
points x0 , x1 , ⋯, xn−1 . Then, there exists a point ξ in (a, b) such that
n−1 n−1
1 n
f (xn ) − p(xn ) = f (ξ) ∏ (xn − xi ) = f [x0 , x1 , ⋯, xn ] ∏ (xn − xi )
n! i=0 i=0

5.4.4 Problems
1. Prove that if f is a polynomial of degree k, such that n > k, then f [x0 , x1 , ⋯, xn ] = 0.
2. Show that the divided differences are linear maps on functions. That is, prove the
equation
(af + bg)[x0 , x1 , ⋯, xn ] = af [x0 , x1 , ⋯, xn ] + bg[x0 , x1 , ⋯, xn ]

3. Using the lagrange functions li , based on nodes (x0 , x1 , ⋯, xn ), show that for any f ,
n n n
∑ f (xi ) li (x) = ∑ f [x0 , x − 1, ⋯, xi ] ∏(x − xj )
i=0 i=0 j=0

Further prove that


n n
f [x0 , xi , ⋯, xn ] = ∑ f (xi ) ∏ (xi − xj )−1
i=0 j=0,j≠i

4. Prove the Leibniz formula


n
(f g)[x0 , x1 , ⋯, xn ] = ∑ f [x0 , x1 , ⋯, xk ] g[xk , xk+1 , ⋯, xn ]
k=0
52 Sanyasiraju V S S Yedida [email protected]

5. Let f (x) = x1 , prove that f [x0 , xl , ⋯, xn ) = (−1)n ∏ni=0 (xi )−1

6. Find the interpolating polynomial for the data:


3
x 1 2 0 2
f (x) 3 13
4 3 5
3

You might also like