Numerical Methods:
Module 3: INTERPOLATION
Prakash Chandra, PhD (IIT Patna)
Assistant Professor
Department of Mathematics
Birla Institute of Technology, Mesra
prakash@[Link]
What is Interpolation?
Interpolation is the process of estimating the value of a function
for an intermediate value of the independent variable when a
set of known data points is given.
Given data points:
(x0 , y0 ), (x1 , y1 ), . . . , (xn , yn )
Find a function f (x) such that:
f (xi ) = yi for all i.
Its importance
Why do we need interpolation?
▶ Real-life data is often available only at discrete points.
▶ To estimate missing or unknown values.
▶ To construct smooth curves from experimental data.
▶ Useful in scientific and engineering computations.
Example:
Temperature recorded at 10 AM and 12 PM. Find the
temperature at 11 AM.
Types of Interpolation Methods
▶ Linear Interpolation
▶ Polynomial Interpolation
▶ Newton’s Forward Interpolation
▶ Newton’s Backward Interpolation
▶ Lagrange Interpolation
▶ Spline Interpolation
Lagrange Interpolation
Definition: It is a polynomial interpolation technique used to
find a polynomial that passes exactly through a given set of
data points.
If there are n + 1 data points, there exists a unique polynomial
of degree at most n passing through those points.
Lagrange Interpolation Formula
The interpolating polynomial is:
n
X
P(x) = yi Li (x)
i=0
where
n
Y x − xj
Li (x) =
xi − x j
j=0
j̸=i
Important Property:
(
1, i =j
Li (xj ) =
0, i ̸= j
Advantages:
▶ Simple and direct formula.
▶ No need for equally spaced data.
▶ Produces a unique polynomial.
Example (Three Points)
Given data:
(1, 2), (2, 3), (4, 5)
Construct Lagrange basis polynomials:
(x − 2)(x − 4)
L0 (x) =
(1 − 2)(1 − 4)
(x − 1)(x − 4)
L1 (x) =
(2 − 1)(2 − 4)
(x − 1)(x − 2)
L2 (x) =
(4 − 1)(4 − 2)
Then
P(x) = 2L0 (x) + 3L1 (x) + 5L2 (x)
2x 2 − 12x + 16 3x 2 − 15x + 12 5x 2 − 15x + 10
= − +
3 2 6
=x +1
Example (Four Points)
Given data:
(0, 1), (1, 3), (2, 2), (3, 5)
Construct Lagrange basis polynomials:
(x − 1)(x − 2)(x − 3)
L0 (x) =
(0 − 1)(0 − 2)(0 − 3)
(x − 0)(x − 2)(x − 3)
L1 (x) =
(1 − 0)(1 − 2)(1 − 3)
(x − 0)(x − 1)(x − 3)
L2 (x) =
(2 − 0)(2 − 1)(2 − 3)
(x − 0)(x − 1)(x − 2)
L3 (x) =
(3 − 0)(3 − 1)(3 − 2)
Continued..
Then
P(x) = 1L0 (x) + 3L1 (x) + 2L2 (x) + 5L3 (x)
(x − 1)(x − 2)(x − 3) 3x(x − 2)(x − 3)
= +
−6 2
2x(x − 1)(x − 3) 5x(x − 1)(x − 2)
− +
2 6
5 3 2 37
= x − 4x + x +1
6 6
Application Example: Population Data
The population (in lakhs) of a town is recorded as follows:
Year Population (lakhs)
2010 50
2012 56
2014 63
2016 72
Estimate the population in the year 2013 using Lagrange’s
Interpolation.
Step 1: Assign Variables
Let
x = Year, y = Population
Given points:
(2010, 50), (2012, 56), (2014, 63), (2016, 72)
For simplification, shift origin:
Let
x = 0, 2, 4, 6
for years
2010, 2012, 2014, 2016
Thus data becomes:
(0, 50), (2, 56), (4, 63), (6, 72)
We need population at year 2013 → x = 3.
Step 2: Lagrange Basis Polynomials
(x − 2)(x − 4)(x − 6)
L0 (x) =
(0 − 2)(0 − 4)(0 − 6)
x(x − 4)(x − 6)
L1 (x) =
(2 − 0)(2 − 4)(2 − 6)
x(x − 2)(x − 6)
L2 (x) =
(4 − 0)(4 − 2)(4 − 6)
x(x − 2)(x − 4)
L3 (x) =
(6 − 0)(6 − 2)(6 − 4)
Step 3: Form Interpolating Polynomial
P(x) = 50L0 (x) + 56L1 (x) + 63L2 (x) + 72L3 (x)
After simplifying
1 3 3 2 7
P(x) = x + x + x + 50
16 8 4
Step 3: Form Interpolating Polynomial
P(x) = 50L0 (x) + 56L1 (x) + 63L2 (x) + 72L3 (x)
After simplifying
1 3 3 2 7
P(x) = x + x + x + 50
16 8 4
Step 4: Estimate Population for 2013
For the year 2013: x = 3
1 3 7
P(3) = (27) + (9) + (3) + 50 = 59.3125
16 8 4
Practice Problems
1. Using Lagrange interpolation, find the interpolating polyno-
mial for
(2, 5), (4, 9), (6, 15)
and estimate the value at x = 5.
2. Construct the Lagrange interpolating polynomial for
(1, 1), (2, 8), (3, 27), (4, 64).
3. The population (in thousands) of a town is
(2000, 120), (2005, 150), (2010, 190), (2015, 250).
Estimate the population in the year 2008 using Lagrange
interpolation.