Week 4 Notes
Week 4 Notes
4
Newton’s forward / backward differ-
ences, Error in Polynomial 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.
When x0 , x1 , x2 , . . . , xn are arranged consecutively with equal spacing, Newton form of the
interpolating formula can be expressed in a simplified form.
s(s − 1) 2 s(s − 1) · · · (s − n + 1) n
Pn (x) = f (x0 ) + s△f (x0 ) + △ f (x0 ) + · · · + △ f (x0 )
2! n!
x−x0
where s = h , h is the length of each interval and △f (xj ) = f (xj+1 ) − f (xj ).
2 W EEK 4
Proof
x−x0
Since s = h , we see that x = x0 + sh. So
x − xi = x0 + sh − xi
= sh + x0 − xi
= sh − ih
= (s − i)h
Since △f (xj ) = f (xj+1 ) − f (xj ), we can write the divided differences f [x0 ], f [x0 , x1 ], . . .,
f [x0 , x1 , . . . , xn ] as follows
f [x0 ] = f (x0 )
f [x1 ] − f [x0 ] 1
f [x0 , x1 ] = = △f (x0 )
x1 − x0 h
1
f [x1 , x2 ] − f [x0 , x1 ] △f (x1 ) − h1 △f (x0 )
f [x0 , x1 , x2 ] = = h
x2 − x0 2h
1
= △2 f (x0 )
2h2
1 2 1 2
f [x1 , x2 , x3 ] − f [x0 , x1 , x2 ] 2 △ f (x1 ) − 2h2 △ f (x0 )
f [x0 , x1 , x2 , x3 ] = = 2h
x3 − x0 3h
1 3
= △ f (x0 )
6h3
..
.
1
f [x0 , x1 , x2 , . . . , xn ] = △n f (x0 )
n!hn
Example 4.1. Construct the Newton’s forward difference table for the following data. Use it to
approximate f (0.5).
x 0 1 2 3
f (x) 3 -2 -4 5
Solution
xi f (x) △f △2 f △3 f
0 3
-5
1 -2 3
-2 8
2 -4 11
9
3 5
x−x0 0.5−0
To approximate f (0.5), first note that s = h = 1 = 0.5. Thus
Example 4.2. Construct the Newton forward difference table for the following data and use it to
approximate f (0.2).
Solution:
4 W EEK 4
x f (x) ∆f ∆2 f ∆3 f ∆4 f
0 1
1
0.5 2 -3
-2 4
1 0 1 0
-1 4
1.5 -1 5
4
2 3
0.2−0 3 4
s= 0.5 = 0.4 and f (0.2) ≈ 1 + 1s − 2! s(s − 1) + 3! s(s − 1)(s − 2) = 2.016.
If the nodes are reordered as xn , xn−1 , xn−2 , . . . , x0 , the Newton form of the interpolating
polynomial may be written as
s(s + 1) 2 s(s + 1) · · · (s + n − 1) n
Pn (x) = f (xn ) + s∇f (xn ) + ∇ f (xn ) + · · · + ∇ f (xn )
2! n!
x−xn
where s = h , h is the length of each interval and ∇f (xj ) = f (xj ) − f (xj−1 ).
Proof:
x−xn
Since s = h , we see that x = xn + sh. So
x − xi = xn + sh − xi
= sh + xn − xi
= sh + (n − i)h
= (s + n − i)h
Since ∇f (xj ) = f (xj ) − f (xj−1 ), we can write the divided differences f [xn ], f [xn , xn−1 ], . . .,
f [xn , xn−1 , . . . , x0 ] as follows
f [xn ] = f (xn )
f [xn ] − f [xn−1 ] 1
f [xn , xn−1 ] = = ∇f (xn )
xn − xn−1 h
1
f [xn , xn−1 ] − f [xn−1 , xn−2 ] h ∇f (xn ) − h1 ∇f (xn−1 )
f [xn , xn−1 , xn−2 ] = =
xn − xn−2 2h
1 2
= ∇ f (x0 )
2h2
..
.
1
f [xn , xn−1 , . . . , x0 ] = ∇n f (xn )
n!hn
W EEK 4 5
Pn (x) = f [xn ] + f [xn , xn−1 ](x − xn ) + f [xn , xn−1 , xn−2 ](x − xn )(x − xn−1 ) + · · ·
+f [xn , xn−1 , . . . , x0 ](x − xn )(x − xn−1 ) · · · (x − x0 )
1 1
= f (xn ) + ∇f (xn )(s)h + 2 ∇2 f (x0 )(s)h(s + 1)h + · · ·
h 2h
1 n
+ ∇ f (xn )(s)h(s + 1)h · · · (s + n − 1)h
n!hn
s(s + 1) 2 s(s + 1) · · · (s + n − 1) n
= f (xn ) + s∇f (xn ) + ∇ f (xn ) + · · · + ∇ f (xn )
2! n!
Example 4.3. Construct the Newton’s backward difference table for the following data. Use it to
approximate f (2.3).
x 1 1.5 2 2.5
f (x) -3 2 3 -5
Solution
xi f (x) ∇f ∇2 f ∇3 f
1 -3
5
1.5 2 -4
1 -5
2 3 -9
-8
2.5 -5
6 W EEK 4
x−xn 2.3−2.5
To approximate f (2.3), first note that s = h = 0.5 = −0.4. Thus
Example 4.4. Construct the Newton’s backward difference table for the following data. Use it to
approximate f (1.8).
x -2 -1 0 1 2
f (x) -3 2 -4 7 1
Solution:
x f (x) ∇f ∇2 f ∇3 f ∇4 f
-2 -3
5
-1 2 -11
-6 28
0 -4 17 -62
11 -34
1 7 -17
-6
2 1
x−xn 1.8−2
To approximate f (1.8), first note that s = h = 1 = −0.2. Thus
(−0.2)(0.8) (−0.2)(0.8)(1.8)
f (1.8) ≈ 1 + (−0.2)(−6) + (−17) + (−34) +
2! 3!
(−0.2)(0.8)(1.8)(2.8)
(−62)
4!
= 7.2752
1. △ f (xi ) + g(xi ) = △f (xi ) + △g(xi )
2. ∇ f (xi ) + g(xi ) = ∇f (xi ) + ∇g(xi )
Solution
W EEK 4 7
Let f (n+1) be continuous in [a, b], and let p be the polynomial of degree at most n that inter-
polates the function f at n + 1 distinct points x0 , x1 , x2 , . . . , xn in the interval [a, b]. Then to
each x ∈ [a, b], there corresponds a point ξx in (a, b) such that
n
1 Y
f (x) − p(x) = f (n+1) (ξx ) (x − xi )
(n + 1)!
i=0
Proof: Omitted.
Example 4.6. If the function f (x) = sin x is approximated by a polynomial of degree 12 that inter-
polates f at 13 points in the interval [0, 1], how large is the absolute error on this interval?
Solution
The absolute error in the interpolation is
12
1 (13) Y
|f (x) − P12 (x)| = |f (ξx )| |x − xi |
13!
i=0
Note that
f (x) = sin x
f ′ (x) = cos x
f ′′ (x) = − sin x
f ′′′ (x) = − cos x
..
.
| sin x|, if k is even
(k)
|f (x)| =
| cos x|, if k is odd
8 W EEK 4
Thus
1
|f (x) − P12 (x)| ≤ (1)(1) ≈ 1.61 × 10−10 .
13!
b−a
where h = n .
Example 4.7. Let the function f (x) = ln x be approximated by an interpolation polynomial of degree
8 with the nodes equally spaced in the interval [2, 4]. What upper bound can be placed on the error?
Solution
The absolute error in the interpolation is
8
1 (9) Y
|f (x) − P8 (x)| = |f (ξx )| |x − xi |
9!
i=0
Note that
f (x) = ln x
1
f ′ (x) =
x
1
f ′′ (x) = − 2
x
′′′ 2
f (x) =
x3
6
f (4) (x) = − 4
x
..
.
(k − 1)!
|f (k) (x)| =
|xk |
8! 8!
So |f (9) (ξx )| = |ξx |9
≤ 29
. Since the nodes are equally spaced
8
Y 1 8!
|x − xi | ≤ h9 8! = 10 .
4 4
i=0
W EEK 4 9
Thus
1 8! 8!
|f (x) − P8 (x)| ≤ = 8.34 × 10−6 .
9! 29 410
Solution
The absolute error in the interpolation is
8
1 Y
|f (x) − P8 (x)| = |f (9) (ξx )| |x − xi |
9!
i=0
Note that
f (x) = ln x
1
f ′ (x) =
x
1
f ′′ (x) = − 2
x
′′′ 2
f (x) =
x3
6
f (4) (x) = − 4
x
..
.
(k) (k − 1)!
|f (x)| =
|xk |
8! 8!
So |f (9) (ξx )| = |ξx |9
≤ 29
. Since the nodes are equally spaced
8
Y 1 8!
|x − xi | ≤ h9 8! = 10 .
4 4
i=0
Thus
1 8! 8!
|f (x) − P8 (x)| ≤ = 8.34 × 10−6 .
9! 29 410
Solution
The absolute error in the interpolation is
22
1 (23) Y
|f (x) − P22 (x)| = |f (ξx )| |x − xi |
23!
i=0
Note that
f (x) = sinh x
f ′ (x) = cosh x
f ′′ (x) = sinh x
f ′′′ (x) = cosh x
..
.
| sinh x|, if k is even
(k)
|f (x)| =
| cosh x|, if k is odd
Thus
1
|f (x) − P22 (x)| ≤ | cosh 1|(1) ≈ 5.97 × 10−23 .
23!
3. If we interpolate the function f (x) = ex with a polynomial p of degree 12 using 13
nodes in [−2, 0], what is a good upper bound for |f (x) − p(x)| on [−2, 0]?
Solution
The absolute error in is
12
1 (13) Y
|f (x) − p(x)| = |f (ξx )| |x − xi |
13!
i=0
Note that
f (x) = ex
f ′ (x) = ex
f ′′ (x) = ex
f ′′′ (x) = ex
..
.
|f (k) (x)| = |ex | = ex
So |f (13) (ξx )| = eξx ≤ 1 for ξx ∈ [−2, 0]. On the interval [-2,0], |x − xi | ≤ 2 so,
12
Y
|x − xi | ≤ 213 .
i=0
W EEK 4 11
Thus
1
|f (x) − p(x)| ≤ (1)(213 ) ≈ 1.32 × 10−6 .
13!
4. Let the function f (x) = −1/x2 be approximated by an interpolating polynomial of de-
gree 12 with the nodes equally spaced in the interval [1, 3]. What bound can be placed
on the absolute error?
Solution
The absolute error is
12
1 (13) Y
|f (x) − P12 (x)| = |f (ξx )| |x − xi |
13!
i=0
Note that
1
f (x) = −
x2
2
f ′ (x) =
x3
6
f ′′ (x) = −
x4
24
f ′′′ (x) =
x5
120
f (4) (x) = − 6
x
..
.
(k + 1)!
|f (k) (x)| = .
|xk+2 |
14! 14!
So |f (13) (ξx )| = |ξx |15
≤ 115
= 14! for ξx ∈ [1, 3]. Since the nodes are equally spaced
12 13
Y 1 12! 2
|x − xi | ≤ h13 12! = .
4 4 12
i=0
Thus 13
1 12! 2
|f (x) − P12 (x)| ≤ (14!) ≈ 0.128.
13! 4 12
Solution
The absolute error is
n
1 Y
|f (x) − p(x)| = |f (n+1) (ξx )| |x − xi |.
(n + 1)!
i=0
12 W EEK 4
Note that
f (x) = cos x
f ′ (x) = − sin x
f ′′ (x) = − cos x
f ′′′ (x) = sin x
..
.
| cos x|, if k is even
(k)
|f (x)| =
| sin x|, if k is odd
So |f (n+1) (ξx )| ≤ 1 for ξx ∈ [0, π/2]. Since the nodes are equally spaced
n n+1
Y 1 n! π/2 − 0 n! π n+1
|x − xi | ≤ hn+1 n! = = .
4 4 n 4 2n
i=0
Thus
1 n! π n+1 1 π n+1
|f (x) − p(x)| ≤ (1) = .
(n + 1)! 4 2n 4(n + 1) 2n
1 π n+1
Hence max | cos x − p(x)| = .
0≤x≤π/2 4(n + 1) 2n