Interpolation
Interpolation
Interpolation
x0 x1 x2 ⋯ xN
y0 y1 y2 ⋯ yN
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
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 )
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)
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
p(x) = c0 + c1 x + c2 x2 + ⋯ + cn xn (5.6)
⎛ 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 ⎠
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]
x 5 -7 -6 0
y 1 -23 -54 -954
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.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)
(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).
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.
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
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]
Once the table is constructed, the polynomial that is passing through the given data is given
by (following (5.12))
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
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
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