Lagrange Interpolation
Lagrange Interpolation
and Computation
(Interpolation)
Lagrange 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.
2) Lagrange Interpolation
Lagrange Interpolation:
Given some list of abscissas and ordinates (𝑥𝑘, 𝑦𝑘) where 𝑘 = 0,1,2, … 𝑛 ,
We have to find polynomial 𝑃𝑁(𝑥) of degree N which passes through those
points.
If we are given only two points i.e. (𝑥0, 𝑦0) and (𝑥1, 𝑦1)
The maximum we can find is a line so
𝑃1(𝑥) = 𝑎0 + 𝑎1𝑥
If we are given only three points i.e. (𝑥0, 𝑦0), (𝑥1, 𝑦1) and (𝑥2, 𝑦2)
The maximum we can find is a line so
𝑃2(𝑥) = 𝑎0 + 𝑎1𝑥 + 𝑎2𝑥2
(𝑥 − 𝑥1) (𝑥 − 𝑥0)
𝑃1 (𝑥) = 𝑦0 + 𝑦1
(𝑥0 − 𝑥1) (𝑥 1 − 𝑥 0)
• If we are given only three points i.e. (𝑥0, 𝑦0) , (𝑥1, 𝑦1) and (𝑥2, 𝑦2). The
maximum we can find is parabolic equation which is polynomial of degree 2
In general
𝑃𝑁(𝑥) = ∑ 𝐿𝑗𝑦𝑗
𝑗=0
Question 1: Find the Lagrange polynomial that passes through (2,11), (4,10.5),
(7,7) hence manipulate the value of 𝑦 at 𝑥 = 5
Solution: First we write data in tabular form to make it easy to understand
𝑿 𝒀
𝑥0 = 2 𝑦0 = 11
𝑥1 = 4 𝑦1 = 10.5
𝑥2 = 7 𝑦2 = 7
L= 𝐿0𝑦0
𝐿1 𝑦 1
𝐿2 𝑦 2
𝑃2(5) = 9.7000
Question 2: Use appropriate Lagrange polynomial of degree one, two and three
to approximate the following:
𝑓(0.43) if 𝑓(0) = 1, 𝑓(0.25) = 1.64872 , 𝑓(0.5) = 2.71828 , 𝑓(0.75) =
4.48169
Solution:
Since we have 4 data points, so maximum we can find is polynomial of
degree ?
For 𝑃1: 𝑃1(𝑥) = 𝐿0𝑦0 + 𝐿1𝑦1
(𝑥 − 𝑥1) (𝑥 − 𝑥0)
𝑃1 (𝑥) = 𝑦0 + 𝑦
(𝑥0 − 𝑥1) (𝑥1 − 𝑥0) 1
So, which 2 data points should we consider from the given data.?
Since 0.43 lies between 0.25 and 0.5 so we should consider these two points.
𝑿 𝒀
𝑥0 = 0.25 𝑦0 = 1.64872
𝑥1 = 0.5 𝑦1 = 2.71828
(𝑥 − 0.5) (𝑥 − 0.25)
𝑃1(𝑥) = 1.64872 + 2.71828
(0.25 − 0.5) (0.5 − 0.25)
𝑃1(0.43) = 2.4188
For 𝑃2: 𝑃2(𝑥) = 𝐿0𝑦0 + 𝐿1𝑦1 + 𝐿2𝑦2
So, which 3 data points should we consider from the given data.?
Since 0.43 lies close to ending data. so we should consider these two points
skip first data point.
𝑿 𝒀
𝑥0 = 0.25 𝑦0 = 1.64872
𝑥1 = 0.5 𝑦1 = 2.71828
𝑥2 = 0.75 𝑦2 = 4.48169
𝑃2(0.43) = 2.3489
Concept of inverse Lagrange:
If 𝑦(1) = 4, 𝑦(3) = 12, 𝑦(4) = 19. Find 𝑥 when 𝑦(𝑥) = 7
There are two possibilities
1. Inverse the formula of langrage. Write all x as y’s and all y’s as x.
2. Switch the initial data. Write abscissas as ordinates and ordinates as abscissas
and use the same formula that we learned.