Lagrange Interpolation
Lagrange Interpolation
Applications
In chapter 1 we found polynomial approximation of a function using Taylor’s
formula about a point x 0 . What if we have a data set of two or more points? Like
population of a country taken every 10 years as:
Geometric Meaning
Algorithm
Lagrange Interpolating Polynomials
A polynomial of degree one passing through points (x 0 , y 0) and (x 1 , y 1 ) is same as
approximating a function f with y 0=f (x 0 ) and y 1=f (x 1).
Lagrange polynomial for it is
P1 ( x ) =L0 ( x ) f ( x 0 ) + L1 ( x ) f ( x 1 ) with
x−x 1 x −x 0
L0 ( x ) = and L1 ( x )= .
x 0−x 1 x 1−x 0
(x−x 1 )( x−x 2)
L0 ( x ) =
(x−x 0 )(x−x 2) and
(x ¿ ¿ 0−x 1 )( x ¿ ¿ 0−x 2), L1 ( x )= ¿¿
(x ¿ ¿ 1−x 0 )( x ¿ ¿ 1−x 2)¿ ¿
(x−x 0)(x−x 1 )
L2 ( x ) =
(x ¿ ¿2−x 0)(x ¿ ¿ 2−x 1 )¿ ¿
Yes…
For ( x 0 , y 0 ) , ( x 1 , y1 ) ,(x 2 , y 2) and (x 3 , y 3 ), Lagrange polynomial will be
P3 ( x )=L0 ( x ) f ( x 0 ) + L1 ( x ) f ( x 1 ) + L2 ( x ) f ( x 2 ) + L3 ( x ) f ( x 3 ) with
Example 1
Determine the linear Lagrange interpolating polynomial that passes through the points
(2 , 4 ) and (5 , 1) .
with
x−x 1 x−5 x −x 0 x−2
L0 ( x ) = = and L1 ( x )= = .
x 0−x 1 −3 x 1−x 0 3
Hence,
−1 1
P1 ( x ) = ( x −5 ) 4+ ( x −2 ) 1=−x+ 6 .
3 3
*You can see that it is the same linear equation, you have derived in calculus from
the point slope form of the equation using two points. The advantage is that the
Lagrange polynomial is not only for polynomials of degree one but can be
extended to polynomials of degree n using n+1 points of any given data.
Example 2
1
Use x 0=2 , x1 =2.75 and x 2=4 to find Lagrange polynomial for f ( x )= . Use this
x
polynomial to approximate f ( 3 ).
Solution: First determine coefficient polynomials L0 ( x ) , L1 ( x ) ,∧¿ L2 (x) as
(x−x 1)(x−x 2 )
L0 ( x ) =
(x−2.75)(x−4) 2
(x ¿ ¿ 0−x 1 )( x ¿ ¿ 0−x 2)= = ( x−2.75 ) ( x−4 ) ,¿ ¿
(2−2.75)(2−4) 3
( x−x 0)( x−x 2 )
L1 ( x ) =
(x −2)(x −4) −16
(x ¿ ¿1−x 0)(x ¿ ¿ 1−x 2 )= = ( x−2 ) ( x−4 ) ,¿ ¿
(2.75−2)(2.75−4) 15
( x−x 0)(x−x 1 )
¿ L2 ( x ) =
( x−2)(x−2.75) 2
(x ¿ ¿2−x 0)(x ¿ ¿ 2−x 1 )= = ( x −2 )( x−2.75 ) . ¿ ¿
( 4−2)(4−2.75) 5
2 1 16 1 2 1
¿ ( x−2.75 )( x−4 ) − ( x−2 ) ( x−4 ) + ( x−2 ) ( x −2.75 )
3 2 15 2.75 5 4
1 2 35 49
⟹ P2 (x)= x − x+
22 88 44
1
So, P2 (3)=0.32955 while f ( 3 )= =0.33333 .
3
Problem 1
The following data of the velocity of a body is given as a function of time.
Time (s) 10 15 18 22 24
Velocity (m/s) 22 24 37 25 123
A quadratic Lagrange interpolating polynomial is formed using three data points,
t 15 , 18, & 22. Use this information to evaluate that at what times (in seconds) is the
velocity of the body 26 m/s during the time interval of t=15 to t=22 seconds.
Problem 2
The following table shows the population of US from 1960 to 2010
Year 1960 1970 1980 1990 2000 2010
Population 179,323 203,302 226,542 249,633 281,422 308,746
(in
thousands)
a. Use Lagrange Interpolation to approximate the population in the years 1950,
1975, 2014, and 2020.
b. The population in 1950 was approximately 150,697,360, and in 2014 the
population was estimated to be 317,298,000. How accurate do you think
your 1975 and 2020 figures are?
Problem 3
Let P3 (x ) be the Lagrange interpolating polynomial for the data
( 0 , 0 ) , ( 0.5 , y ) , ( 1 , 3 ) ,∧( 2 , 2 ) .
a. Find y if the coefficient of x 3 in P3 (x ) is 6.
b. Find P3 (x ).
Practice
Exercise 3.1
Q. For x 0=0 , x 1=0. 6, x 2=0.9 and f ( x )= √ 1+ x , construct
Lagrange interpolation polynomial of degree 1 & 2 to approximate f ( 0.45 ) and find error.
x−x 1 x−0.6 −5
L0 ( x ) = = = ( x−0.6 )
x 0−x 1 −0.6 3
x−x 0 x−0 5
and L1 ( x )= = = x.
x1 −x0 0.6 3
5 5
Hence, P1 ( x ) =L0 ( x ) f ( x 0 ) + L1 ( x ) f ( x 1 ) ¿− 3 ( x−0.6 ) 1+ 3 x √1.6
⟹ P ( 0.45 )=1.19868 ,