Professional Documents
Culture Documents
Lec # 10 (LAGRANGES INTERPOLATION) PDF
Lec # 10 (LAGRANGES INTERPOLATION) PDF
By
LAGRANGE'S INTERPOLATION
Lec # 10
1
LAGRANGE'S INTERPOLATION FORMULA
THEOREM:
If 𝑥0 , 𝑥1 , … , 𝑥𝑛 are 𝑛 + 1 distinct numbers and 𝑓 is a function whose values are given
at these numbers, then a unique polynomial 𝑝(𝑥) of degree at most 𝑛 exists with
𝑓(𝑥) = 𝑃 𝑥𝑘 Eq. 1
for each 𝑘 = 0,1,2, … 𝑛
This polynomial is given by
𝑃(𝑥) = 𝑓 𝑥0 𝐿0 (𝑥) + 𝑓 𝑥1 𝐿1 (𝑥) + ⋯ + 𝑓 𝑥𝑛 𝐿𝑛 (𝑥)
𝑛
𝑃(𝑥) = 𝑓 𝑥𝑘 𝐿𝑘 (𝑥)
𝑘=0
where,
𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2 ⋯ 𝑥 − 𝑥𝑛
𝐿k (𝑥) =
𝑥k − 𝑥0 𝑥k − 𝑥1 𝑥k − 𝑥2 ⋯ 𝑥k − 𝑥𝑛
This is interpolation coefficient.
𝑛
𝑥 − 𝑥𝑖
𝐿𝑘 (𝑥) = ෑ
𝑥𝑘 − 𝑥𝑖
𝑖=0
𝑖≠𝑘
2
So, Eq. (1) can be written as
𝑦 = 𝑓(𝑥) = 𝑃(𝑥) = 𝑓 𝑥0 𝐿0 (𝑥) + 𝑓 𝑥1 𝐿1 (𝑥) + 𝑓 𝑥2 𝐿2 (𝑥) + ⋯ + 𝑓 𝑥𝑛 𝐿𝑛 (𝑥)
where, Eq. 2
𝑥 − 𝑥1 𝑥 − 𝑥2 𝑥 − 𝑥3 ⋯ 𝑥 − 𝑥𝑛
𝐿0 𝑥 =
𝑥0 − 𝑥1 𝑥0 − 𝑥2 𝑥0 − 𝑥3 ⋯ 𝑥0 − 𝑥𝑛
𝑥 − 𝑥0 𝑥 − 𝑥2 𝑥 − 𝑥3 ⋯ 𝑥 − 𝑥𝑛
𝐿1 𝑥 =
𝑥1 − 𝑥0 𝑥1 − 𝑥2 𝑥1 − 𝑥3 ⋯ 𝑥1 − 𝑥𝑛
𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥3 𝑥 − 𝑥4 ⋯ 𝑥 − 𝑥𝑛
𝐿2 𝑥 =
𝑥2 − 𝑥0 𝑥2 − 𝑥1 𝑥2 − 𝑥3 𝑥2 − 𝑥4 ⋯ 𝑥2 − 𝑥𝑛
…
𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2 ⋯ 𝑥 − 𝑥𝑛−1
𝐿𝑛 𝑥 =
𝑥𝑛 − 𝑥0 𝑥𝑛 − 𝑥1 𝑥𝑛 − 𝑥2 ⋯ 𝑥𝑛 − 𝑥𝑛−1
𝑥 − 𝑥0 𝑥 − 𝑥2 𝑥 − 𝑥3 ⋯ 𝑥 − 𝑥𝑛
+ 𝑓 𝑥1
𝑥1 − 𝑥0 𝑥1 − 𝑥2 𝑥1 − 𝑥3 ⋯ 𝑥1 − 𝑥𝑛
𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥3 𝑥 − 𝑥4 ⋯ 𝑥 − 𝑥𝑛
+ 𝑓 𝑥2
𝑥2 − 𝑥0 𝑥2 − 𝑥1 𝑥2 − 𝑥3 𝑥2 − 𝑥4 ⋯ 𝑥2 − 𝑥𝑛
𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2 ⋯ 𝑥 − 𝑥𝑛−1
+⋯+ 𝑓 𝑥n
𝑥𝑛 − 𝑥0 𝑥𝑛 − 𝑥1 𝑥𝑛 − 𝑥2 ⋯ 𝑥𝑛 − 𝑥𝑛−1
Eq. 3
The formula Eq. (3) is known as Lagrange’s Interpolation formula
PROOF: Try to proof formula (3) Yourself.
HINT Let the polynomial is define as follows:
𝑓 𝑥 = 𝑎0 𝑥 − 𝑥1 𝑥 − 𝑥2 ⋯ 𝑥 − 𝑥𝑛 + 𝑎1 𝑥 − 𝑥0 𝑥 − 𝑥2 𝑥 − 𝑥3 ⋯ 𝑥 − 𝑥𝑛
+ 𝑎2 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥3 𝑥 − 𝑥4 ⋯ 𝑥 − 𝑥𝑛 + ⋯
+𝑎𝑛 𝑥 − 𝑥0 𝑥 − 𝑥1 ⋯ 𝑥 − 𝑥𝑛−1
4
NOTE:
1) This formula can be used irrespective of whether the values 𝑥0 , 𝑥1 , … , 𝑥𝑛
are equally spaced or not.
2) It is simple and easy to remember but its application is not speedy.
3) The main drawback of it is that if another interpolation value is inserted,
then the interpolation Coefficients are required to be recalculated.
EXAMPLE # 1:
The function 𝑦 = 𝑓(𝑥) is given at the point 7,3 , (8,1), (9,1) and (10,9).
Find the value of 𝑦 for 𝑥 = 9.5 using Lagrange interpolation formula
SOLUTION: we are given
𝑥 𝑥0 = 7 𝑥1 = 8 𝑥2 = 9 𝑥3 = 10
𝑓(𝑥) 3 = 𝑦0 1 = 𝑦1 1 = 𝑦2 9 = 𝑦3
8
4 1
𝑓(𝑥) = − 𝑥−2 𝑥−7 𝑥−8 + 𝑥−1 𝑥−7 𝑥−8 5
42 30
1 1
− 𝑥 − 1 𝑥 − 2 (𝑥 − 8)(5) + (𝑥 − 1)(𝑥 − 2)(𝑥 − 7)(4)
30 42
Now at 𝑥 = 6
4 1
y=𝑓 6 =− 6−2 6−7 6−8 + 6−1 6−7 6−8 5
42 30
1 4
− 6−1 6−2 6−8 5 + 6−1 6−2 6−7
30 42
𝑓(6) = 5.667
1
=− 𝑥 𝑥−2 𝑥−6
9
𝑦 = 𝑓 𝑥 = 𝑓 𝑥0 𝐿0 𝑥 + 𝑓 𝑥1 𝐿1 𝑥 + 𝑓 𝑥2 𝐿2 𝑥 + 𝑓 𝑥3 𝐿3 𝑥
−1 704 −729
= 𝑥 − 2 𝑥 − 3 𝑥 − 6 648 + 𝑥 𝑥−3 𝑥−6 + 𝑥 𝑥−2 𝑥−6
36 8 9
792
+ (𝑥(𝑥 − 2)(𝑥 − 3))
72 10
𝑓 𝑥 = −18 𝑥 − 2 𝑥 − 3 𝑥 − 6 + 88𝑥 𝑥 − 3 𝑥 − 6 − 81𝑥 𝑥 − 2 𝑥 − 6
+11𝑥 𝑥 − 2 𝑥 − 3
𝑓 𝑥 = 𝑥 − 3 𝑥 − 6 −18 𝑥 − 2 + 88𝑥 + 𝑥 𝑥 − 2 −81 𝑥 − 6 + 11 𝑥 − 3
= 70𝑥 3 + 36𝑥 2 − 630𝑥 2 − 324𝑥 + 1260𝑥 + 648 − 70𝑥 3 + 453𝑥 2 + 140𝑥 2 − 906𝑥
= −𝑥 2 + 30𝑥 + 648
𝑦(𝑥) = 𝑓(𝑥) = −𝑥 2 + 30𝑥 + 648
11
EXAMPLE # 4: Find by Lagrange's formula to find the value of
(1) 𝑢5 if 𝑢0 = 1, 𝑢3 = 19, 𝑢4 = 49, 𝑢6 = 181
(2) 𝑢4 if 𝑢3 = 16, 𝑢5 = 36, 𝑢7 = 64, 𝑢8 = 81, 𝑢9 = 100.
SOLUTION
(1) Given that 𝑢0 = 1, 𝑢3 = 19, 𝑢4 = 49, 𝑢6 = 181 So, In tabular
form we write the given data as follows
𝑥 𝑥0 = 0 𝑥1 = 3 𝑥2 = 4 𝑥3 = 6
𝑢(𝑥) 1 = 𝑢0 19 = 𝑢1 49 = 𝑢2 181 = 𝑢3
Now by Lagrange's formula
𝑢 𝑥 = 𝑢0 𝑥 𝐿0 𝑥 + 𝑢1 𝑥 𝐿1 𝑥 + 𝑢2 𝑥 𝐿2 𝑥 + 𝑢3 𝑥 𝐿3 (𝑥)
1
= − (𝑥 − 3)(𝑥 − 4)(𝑥 − 6)
72
So,
𝑢 𝑥 = 𝑢0 𝑥 𝐿0 𝑥 + 𝑢1 𝑥 𝐿1 𝑥 + 𝑢2 𝑥 𝐿2 𝑥 + 𝑢3 𝑥 𝐿3 (𝑥)
1 19
𝑢 𝑥 = 1 − 𝑥−3 𝑥−4 𝑥−6 + 𝑥 𝑥−4 𝑥−6
7 9
49 181
− 𝑥(𝑥 − 3)(𝑥 − 6) + x(𝑥 − 3)(𝑥 − 4)
8 36
Now at 𝑥 = 5
1 19 49 181
𝑢(5) = 𝑢5 = − (2)(1)(−1) + (5)(1)(−1) − (5)(2)(−1) + (5)(2)(1)
72 9 8 36
𝑥 −5 −3 3 5
𝑦 𝑦−5 𝑦−3 𝑦3 𝑦5
𝑦(𝑥) = 𝑦𝑥
y(−5) = 𝑦−5
TRY YOURSELF
14
EXERCISE
15
16
17
18
19
20