Lok Nayak Jai Prakash Institute of Technology
Chapra, Bihar-841302
Lagrange’s In-
terpolation...
Dr. G.K.
Prajapati
Mathematics-II (Numerical Methods)
LNJPIT,
Lecture Notes
Chapra
May 21, 2020
Lagrange’s
Interpolation
formula:
by
Dr. G.K.Prajapati
Department of Applied Science and Humanities
LNJPIT, Chapra, Bihar-841302
Dr. G.K. Prajapati LNJPIT, Chapra Lagrange’s Interpolation...
Lagrange’s In-
terpolation...
Dr. G.K.
Prajapati
Let the data
LNJPIT,
x x0 x1 x2 ... xn
Chapra
f(x) f (x1 ) f (x2 ) f (x2 ) ... f (xn )
Lagrange’s
Interpolation be given at distinct unevenly spaced points or non-uniform
formula:
points x0 , x1 , ..., xn . This data may also be given at evenly
spaced points. For this data, we can fit a unique polynomial of
degree ≤ n. Since the interpolating polynomial must use all
the ordinates f (x0 ), f (x1 ), ...f (xn ), it can be written as a
linear combination of these ordinates. That is, we can write the
polynomial as
Dr. G.K. Prajapati LNJPIT, Chapra Lagrange’s Interpolation...
Lagrange’s In-
terpolation...
Dr. G.K.
Prajapati
LNJPIT,
Chapra
Pn (x) = l0 (x)f (x0 ) + l1 (x)f (x1 ) + ... + ln (x)f (xn )
Lagrange’s
Interpolation
formula: where
(x − x0 ), (x − x1 ), (x − x2 ), ..., (x − xi−1 ), (x − xi+1 ), ..., (x − xn )
li (x) =
(xi − x0 ), (xi − x1 ), (xi − x2 ), ..., (xi − xi−1 ), (xi − xi+1 ), ..., (xi − xn )
Dr. G.K. Prajapati LNJPIT, Chapra Lagrange’s Interpolation...
Lagrange’s In-
terpolation...
Dr. G.K.
Prajapati
LNJPIT,
Chapra Example
Lagrange’s
Use Lagrange’s formula, to find the quadratic polynomial that
Interpolation
formula:
takes the values
x 0 1 3
f(x) 0 1 0
Dr. G.K. Prajapati LNJPIT, Chapra Lagrange’s Interpolation...
Lagrange’s In-
terpolation...
Dr. G.K.
Prajapati Solution: Since f (x0 ) and f (x2 ) are zero, we need to compute
l1 (x) only. We have
LNJPIT,
Chapra
(x − x0 )(x − x2 ) (x − 0)(x − 3) 1
l1 (x) = = = − (x2 − 3x)
Lagrange’s
Interpolation
(x1 − x0 )(x1 − x2 ) (1 − 0)(1 − 3) 2
formula:
The Lagrange quadratic polynomial is given by
P2 (x) = f (x) = l0 f (x0 ) + l1 f (x1 ) + l2 f (x2 ) =
1 2 1
0 + − (x − 3x)(1) + 0 = (3x − x2 ).
2 2
Dr. G.K. Prajapati LNJPIT, Chapra Lagrange’s Interpolation...
Lagrange’s In-
terpolation... Example
Dr. G.K.
Prajapati Construct the Lagrange interpolation polynomial for the data
LNJPIT, x −1 1 4 7
Chapra
f (x) −2 0 63 342
Lagrange’s
Interpolation
formula:
Hence, interpolate at x = 5.
Solution: Since f (x1 ) is zero, we need to compute l0 (x),
l2 (x), l3 (x) only. We have
(x − x1 )(x − x2 )(x − x3 )
l0 (x) = =
(x0 − x1 )(x0 − x2 )(x0 − x3 )
(x − 1)(x − 4)(x − 7) 1
= − (x3 − 12x2 + 39x − 28).
(−1 − 1)(−1 − 4)(−1 − 7) 80
Dr. G.K. Prajapati LNJPIT, Chapra Lagrange’s Interpolation...
Lagrange’s In-
terpolation...
Dr. G.K.
Prajapati
(x − x0 )(x − x1 )(x − x3 )
l2 (x) = =
LNJPIT, (x2 − x0 )(x2 − x1 )(x2 − x3 )
Chapra
(x + 1)(x − 1)(x − 7) 1
= − (x3 − 7x2 − x + 7).
Lagrange’s (4 + 1)(4 − 1)(4 − 7) 45
Interpolation
formula:
(x − x0 )(x − x1 )(x − x2 )
l3 (x) = =
(x3 − x0 )(x3 − x1 )(x3 − x2 )
(x + 1)(x − 1)(x − 4) 1
= (x3 − 4x2 − x + 4).
(7 + 1)(7 − 1)(7 − 4) 144
The Lagrange quadratic polynomial is given by
Dr. G.K. Prajapati LNJPIT, Chapra Lagrange’s Interpolation...
Lagrange’s In-
terpolation...
Dr. G.K.
Prajapati
LNJPIT,
Chapra
f (x) = l0 f (x0 ) + l1 f (x1 ) + l2 f (x2 ) + l3 f (x3 )
1 3 2 1 3 2 1 3 2
Lagrange’s = − (x − 12x + 39x − 28)(−2) + 0 −(x − 7x − x + 7)(63) + (x − 4x
Interpolation 80 45 144
1 7 171 3 49 171 39 7 171 7 4
formula: 3 2
= − + x + − + − x + + − x+ − −
40 5 72 10 5 18 40 5 72 10
3
= x − 1.
Hence, f (5) = P3 (5) = 53 − 1 = 124.
Dr. G.K. Prajapati LNJPIT, Chapra Lagrange’s Interpolation...
Lagrange’s In-
terpolation...
Dr. G.K.
Prajapati
LNJPIT,
Chapra
Example
Given that f (0) = 1, f (1) = 3, f (3) = 55, find the unique
Lagrange’s
Interpolation polynomial of degree 2 or less, which fits the given data.
formula:
Solution: We have
x0 = 0, f (x0 ) = 1, x1 = 1, f (x1 ) = 3, x2 = 3, f (x2 ) = 55. The
Lagrange fundamental polynomials are given by
Dr. G.K. Prajapati LNJPIT, Chapra Lagrange’s Interpolation...
Lagrange’s In-
terpolation...
Dr. G.K.
Prajapati
(x − x1 )(x − x2 ) (x − 1)(x − 3)
l0 (x) = = =
LNJPIT, (x0 − x1 )(x0 − x2 ) (0 − 1)(0 − 3)
Chapra
1 2
(x − 4x + 3).
Lagrange’s 3
Interpolation
formula:
(x − x0 )(x − x2 ) (x − 0)(x − 3) 1
l1 (x) = = = (3x − x2 ).
(x1 − x0 )(x1 − x2 ) (1 − 0)(1 − 3) 2
(x − x0 )(x − x1 ) (x − 0)(x − 1) 1
l2 (x) = = = (x2 − x).
(x2 − x0 )(x2 − x1 ) (3 − 0)(3 − 1) 6
Dr. G.K. Prajapati LNJPIT, Chapra Lagrange’s Interpolation...
Lagrange’s In-
terpolation...
Dr. G.K.
Prajapati
LNJPIT,
Chapra The Lagrange quadratic polynomial is given by
Lagrange’s P2 (x) = f (x) = l0 f (x0 ) + l1 f (x1 ) + l2 f (x2 )
Interpolation 1 2 1 2 1 2
formula: = (x − 4x + 3)(1) + (3x − x )(3) + (x − x)(55)
3 2 6
2
= 8x − 6x + 1.
Dr. G.K. Prajapati LNJPIT, Chapra Lagrange’s Interpolation...
Lagrange’s In-
terpolation...
Dr. G.K.
Prajapati
LNJPIT, Quiz
Chapra
Lagrange’s Question 1: Using the data sin(0.1) = 0.09983 and
Interpolation
formula: sin(0.2) = 0.19867, find an approximate value of sin(0.15) by
Lagrange interpolation.
Question 2: Give two uses of interpolating polynomials.
Question 3: Write the property satisfied by Lagrange
fundamental polynomials li (x).
Dr. G.K. Prajapati LNJPIT, Chapra Lagrange’s Interpolation...
Lagrange’s In-
terpolation...
Dr. G.K.
Prajapati
LNJPIT,
Chapra
Lagrange’s
Interpolation
formula:
Thanks !!!
Dr. G.K. Prajapati LNJPIT, Chapra Lagrange’s Interpolation...