Interpolation
Consider a function 𝑦 = 𝑓 (𝑥 ) given by a Table of values (𝑥𝑘 , 𝑦𝑘 ) where 𝑘 = 0,1,2, … 𝑛
As 𝑥 takes values 𝑥0 , 𝑥1 , 𝑥2 , … , 𝑥𝑛 then the corresponding values of 𝑦 are 𝑦0 , 𝑦1 , 𝑦2 , … , 𝑦𝑛
The process of estimating the values of 𝑦 for some 𝑥 in 𝑥0 < 𝑥 < 𝑥𝑛 , not present in the
Table is called “interpolation”.
𝒙 𝒚
𝑥0 𝑦0
𝑥1 𝑦1
𝑥2 𝑦2
: :
: :
: :
𝑥𝑛 𝑦𝑛
For example, if 𝑥 denotes the number of days and 𝑦 denotes the height of some
plant at that day then we can find data of missing days using interpolation.
No of Day (𝑥) Height of plant (𝑦)
Day 1 2 cm
Day 2 2.5 cm
Day 3 3.5 cm
Day 5 5 cm
Day 7 6.5 cm
Day 8 6.8 cm
Day 9 7 cm
Polynomial Interpolation
Approximate the unknown function behind the data in the tabular form by a
polynomial 𝑃(𝑥) is called polynomial interpolation.
1) Newton’s Interpolation Formulas
I. Newton Forward difference Interpolation Formula
II. Newton Backward difference Interpolation Formula
III. Newton divided difference Interpolation Formula
2) Lagrange Interpolation
Newton’s Interpolation Formulas
1) Newton Forward difference Interpolation Formula:
If 𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 , … 𝑥𝑛 are uniformly spaced nodes and 𝑦0 , 𝑦1 , 𝑦2 , 𝑦3 , … 𝑦𝑛 are
corresponding entries. The Newton’s Forward difference interpolation formula is:
𝑃(𝑃 − 1) 2 𝑃(𝑃 − 1)(𝑃 − 2) 3
𝑓 (𝑥 ) ≈ 𝑃𝑛 (𝑥 ) = 𝑓(𝑥0 ) + 𝑃∆𝑓(𝑥0 ) + ∆ 𝑓 (𝑥0 ) + ∆ 𝑓 (𝑥0 ) + ⋯
2! 3!
OR
𝑃(𝑃 − 1) 2 𝑃(𝑃 − 1)(𝑃 − 2) 3
𝑓(𝑥 ) ≈ 𝑃𝑛 (𝑥 ) = 𝑦0 + 𝑃∆𝑦0 + ∆ 𝑦0 + ∆ 𝑦0 + ⋯
2! 3!
𝒙−𝒙𝟎
Where 𝑷=
𝒉
𝑥0 = 1st abscissa
ℎ = step size
𝑥 = point of interpolation
Forward Difference Operator ∆:
Let 𝑦 = 𝑓(𝑥 ) be a function and ℎ is fixed step size then
∆𝒇(𝒙) = 𝒇(𝒙 + 𝒉) − 𝒇(𝒙)
Let 𝑥 = 𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 , … 𝑥𝑛 such that
𝑥1 = 𝑥0 + ℎ, 𝑥2 = 𝑥1 + ℎ, 𝑥3 = 𝑥2 + ℎ, … , 𝑥𝑛 = 𝑥𝑛−1 + ℎ
Also
𝑦0 = 𝑓(𝑥0 ), 𝑦1 = 𝑓(𝑥1 ), 𝑦2 = 𝑓(𝑥2 ), … , 𝑦𝑛 = 𝑓(𝑥𝑛 )
Now
∆𝒚𝟎 = ∆𝑓(𝑥0 ) = 𝑓(𝑥0 + ℎ) − 𝑓(𝑥0 ) = 𝑓(𝑥1 ) − 𝑓(𝑥0 ) = 𝒚𝟏 − 𝒚𝟎
∆𝒚𝟏 = ∆𝑓(𝑥1 ) = 𝑓 (𝑥1 + ℎ) − 𝑓(𝑥1 ) = 𝑓(𝑥2 ) − 𝑓(𝑥1 ) = 𝒚𝟐 − 𝒚𝟏
∆𝒚𝟐 = ∆𝑓 (𝑥2 ) = 𝑓(𝑥2 + ℎ) − 𝑓(𝑥2 ) = 𝑓 (𝑥3 ) − 𝑓(𝑥2 ) = 𝒚𝟑 − 𝒚𝟐
Similarly
∆𝟐 𝒚𝟎 = ∆2 𝑓 (𝑥0 ) = ∆(∆𝑓(𝑥0 )) = ∆(𝑦1 − 𝑦0 ) = ∆𝒚𝟏 − ∆𝒚𝟎
∆𝟐 𝒚𝟏 = ∆2 𝑓 (𝑥1 ) = ∆(∆𝑓(𝑥1 )) = ∆(𝑦2 − 𝑦1 ) = ∆𝒚𝟐 − ∆𝒚𝟏
and
∆𝟑 𝒚𝟎 = ∆3 𝑓(𝑥0 ) = ∆(∆2 𝑓(𝑥0 )) = ∆(∆𝑦1 − ∆𝑦0 ) = ∆𝟐 𝒚𝟏 − ∆𝟐 𝒚𝟎
Question: Find the interpolating polynomial that passes through (2,4), (3,7), (4,8),
(5,11), (6,15) hence manipulate the value of 𝑦 at 𝑥 = 2.5
Solution: First we write data in tabular form to make it easy to understand
𝑿 𝒀
𝑥0 = 2 𝑦0 = 4
𝑥1 = 3 𝑦1 = 7
𝑥2 = 4 𝑦2 = 8
𝑥3 = 5 𝑦3 = 11
𝑥4 = 6 𝑦4 = 15
Since we have 5 data points, so we are going to have polynomial of degree 4
𝑃(𝑃 − 1) 2 𝑃(𝑃 − 1)(𝑃 − 2) 3
𝑃4 (𝑥 ) = 𝑦0 + 𝑃∆𝑦0 + ∆ 𝑦0 + ∆ 𝑦0
2! 3!
𝑃(𝑃 − 1)(𝑃 − 2)(𝑃 − 3) 4
+ ∆ 𝑦0
4!
Let’s generate forward difference interpolation table to get all ∆
𝒙 𝒚 ∆ ∆𝟐 ∆𝟑 ∆𝟒
𝑥0 = 2 𝑦0 = 4
∆𝒚𝟎 = 𝟑
𝑥1 = 3 𝑦1 = 7 ∆𝟐 𝒚𝟎 = −𝟐
∆𝑦1 = 1 ∆𝟑 𝒚𝟎 = 𝟒
𝑥2 = 4 𝑦2 = 8 ∆2 𝑦1 = 2 ∆𝟒 𝒚𝟎 = −𝟓
∆𝑦2 = 3 ∆3 𝑦1 = −1
𝑥3 = 5 𝑦3 = 11 ∆2 𝑦2 = 1
∆𝑦3 = 4
𝑥0 = 6 𝑦4 = 15
𝑃(𝑃 − 1) 2 𝑃(𝑃 − 1)(𝑃 − 2) 3 𝑃(𝑃 − 1)(𝑃 − 2)(𝑃 − 3) 4
𝑃4 (𝑥 ) = 𝑦0 + 𝑃∆𝑦0 + ∆ 𝑦0 + ∆ 𝑦0 + ∆ 𝑦0
2! 3! 4!
𝑥 − 𝑥0 𝑥 − 2
𝑷= = =𝒙−𝟐
ℎ 1
(𝑥 − 2)(𝑥 − 3) (𝑥 − 2)(𝑥 − 3)(𝑥 − 4)
𝑃4 (𝑥 ) = 4 + (𝑥 − 2)3 + (−2) + (4)
2! 3!
(𝑥 − 2)(𝑥 − 3)(𝑥 − 4)(𝑥 − 5)
+ (−5)
4!
5𝑥 4 43𝑥 3 523𝑥 2 689𝑥
𝑃4 (𝑥 ) = − + − + − 49
24 12 24 12
𝑃4 (2.5) = 6.1953
2) Newton Backward difference Interpolation Formula:
If 𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 , … 𝑥𝑛 are uniformly spaced nodes and 𝑦0 , 𝑦1 , 𝑦2 , 𝑦3 , … 𝑦𝑛 are
corresponding entries. The Newton’s Backward difference interpolation formula is:
𝑃(𝑃 + 1) 2 𝑃(𝑃 + 1)(𝑃 + 2) 3
𝑓 (𝑥 ) ≈ 𝑃(𝑥 ) = 𝑓(𝑥𝑛 ) + 𝑃∇𝑓 (𝑥𝑛 ) + ∇ 𝑓 (𝑥𝑛 ) + ∇ 𝑓(𝑥𝑛 ) + ⋯
2! 3!
OR
𝑃(𝑃 + 1) 2 𝑃(𝑃 + 1)(𝑃 + 2) 3
𝑓(𝑥 ) ≈ 𝑃(𝑥 ) = 𝑦𝑛 + 𝑃∇𝑦𝑛 + ∇ 𝑦𝑛 + ∇ 𝑦𝑛 + ⋯
2! 3!
𝒙−𝒙𝒏
Where 𝑷 =
𝒉
𝑥𝑛 = Last abscissa
ℎ = step size
𝑥 = point of interpolation
Backward Difference Operator 𝛁:
Let 𝑦 = 𝑓(𝑥 ) be a function and ℎ is fixed step size then
𝛁𝒇(𝒙) = 𝒇(𝒙) − 𝒇(𝒙 − 𝒉)
Let 𝑥 = 𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 , … 𝑥𝑛 such that
𝑥1 = 𝑥0 + ℎ, 𝑥2 = 𝑥1 + ℎ, 𝑥3 = 𝑥2 + ℎ, … , 𝑥𝑛 = 𝑥𝑛−1 + ℎ
Also
𝑦0 = 𝑓(𝑥0 ), 𝑦1 = 𝑓(𝑥1 ), 𝑦2 = 𝑓(𝑥2 ), … , 𝑦𝑛 = 𝑓(𝑥𝑛 )
Now
𝛁𝒚𝟏 = ∇𝑓(𝑥1 ) = 𝑓(𝑥1 ) − 𝑓(𝑥1 − ℎ) = 𝑓(𝑥1 ) − 𝑓(𝑥0 ) = 𝒚𝟏 − 𝒚𝟎
𝛁𝒚𝟐 = ∇𝑓(𝑥2 ) = 𝑓(𝑥2 ) − 𝑓(𝑥2 − ℎ) = 𝑓(𝑥2 ) − 𝑓(𝑥1 ) = 𝒚𝟐 − 𝒚𝟏
𝛁𝒚𝟑 = ∇𝑓(𝑥3 ) = 𝑓(𝑥3 ) − 𝑓(𝑥3 − ℎ) = 𝑓(𝑥3 ) − 𝑓 (𝑥2 ) = 𝒚𝟑 − 𝒚𝟐
Similarly
∇𝟐 𝒚𝟐 = ∇2 𝑓 (𝑥2 ) = ∇(∇𝑓(𝑥2 )) = ∇(𝑦2 − 𝑦1 ) = ∇𝒚𝟐 − ∇𝒚𝟏
∇𝟐 𝒚𝟑 = ∇2 𝑓 (𝑥3 ) = ∇(∇𝑓(𝑥3 )) = ∇(𝑦3 − 𝑦2 ) = ∇𝒚𝟑 − ∇𝒚𝟐
and
∇𝟑 𝒚𝟑 = ∇3 𝑓(𝑥3 ) = ∇(∇2 𝑓(𝑥3 )) = ∇(∇𝑦3 − ∇𝑦2 ) = ∇𝟐 𝒚𝟑 − ∇𝟐 𝒚𝟐
Question: Find the interpolating polynomial that passes through (2,4), (3,7), (4,8),
(5,11), (6,15) hence manipulate the value of 𝑦 at 𝑥 = 4.5 using Newton Backward
Interpolation Technique.
Solution: First we write data in tabular form to make it easy to understand
𝑿 𝒀
𝑥0 = 2 𝑦0 = 4
𝑥1 = 3 𝑦1 = 7
𝑥2 = 4 𝑦2 = 8
𝑥3 = 5 𝑦3 = 11
𝑥4 = 6 𝑦4 = 15
Since we have 5 data points, so we are going to have polynomial of degree 4
𝑃(𝑃 + 1) 2 𝑃(𝑃 + 1)(𝑃 + 2) 3 𝑃(𝑃 + 1)(𝑃 + 2)(𝑃 + 3) 4
𝑃4 (𝑥 ) = 𝑦4 + 𝑃∇𝑦4 + ∇ 𝑦4 + ∇ 𝑦4 + ∇ 𝑦4
2! 3! 4!
Let’s generate backward difference interpolation table to get all ∇
𝒙 𝒚 𝛁 𝛁𝟐 𝛁𝟑 𝛁𝟒
𝑥0 = 2 𝑦0 = 4
∇𝒚𝟏 = 𝟑
𝑥1 = 3 𝑦1 = 7 ∇𝟐 𝒚𝟐 = −𝟐
∇𝑦2 = 1 ∇𝟑 𝒚𝟑 = 𝟒
𝑥2 = 4 𝑦2 = 8 ∇2 𝑦3 = 2 ∇𝟒 𝒚𝟒 = −𝟓
∇𝑦3 = 3 ∇3 𝑦4 = −1
𝑥3 = 5 𝑦3 = 11 ∇2 𝑦4 = 1
∇𝑦4 = 4
𝑥0 = 6 𝑦4 = 15
𝑃(𝑃 + 1) 2 𝑃(𝑃 + 1)(𝑃 + 2) 3 𝑃(𝑃 + 1)(𝑃 + 2)(𝑃 + 3) 4
𝑃4 (𝑥 ) = 𝑦4 + 𝑃∇𝑦4 + ∇ 𝑦4 + ∇ 𝑦4 + ∇ 𝑦4
2! 3! 4!
𝑥 − 𝑥4 𝑥 − 6
𝑷= = =𝒙−𝟔
ℎ 1
(𝑥 − 6)(𝑥 − 5) (𝑥 − 6)(𝑥 − 5)(𝑥 − 4)
𝑃4 (𝑥 ) = 15 + (𝑥 − 6)4 + (1) + (−1)
2! 3!
(𝑥 − 6)(𝑥 − 5)(𝑥 − 4)(𝑥 − 3)
+ (−5)
4!
5𝑥 4 43𝑥 3 523𝑥 2 689𝑥
𝑃4 (𝑥 ) = − + − + − 49
24 12 24 12
𝑃4 (4.5) = 9.1953
Practice Questions:
1. Given the data of some trigonometric function.
45𝜊 0.7071
50𝜊 0.7660
55𝜊 0.8191
60𝜊 0.8660
a) Find the value at 48𝜊 using appropriate interpolation formula.
b) Find the value at 57𝜊 using appropriate interpolation formula.
2. The time vs velocity data of some train is given by:
𝑡 (𝑚𝑖𝑛) 𝑣 (𝑚/𝑚𝑖𝑛)
3 220
7 248
11 269
Is Newton Forward and Newton Backward interpolation formula applicable on
this data? If yes, then find the interpolating polynomial using both NFIF and
NBIF.