1. Adv. Engg. Mathematics
MTH-812 Lagrange Interpolation
Dr. Yasir Ali (yali@ceme.nust.edu.pk)
DBS&H, CEME-NUST
November 24, 2017
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
2. Interpolation Problem
Given 1 The (n + 1) nodes: x0, x1, ..., xn
2 The functional values f0, f1, ..., fn at these nodes
3 An Intermediate (nontabulated) point: xI
Predict fI : the value at x = xI.
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
3. Lagrange Interpolating Polynomials
The problem of determining a polynomial of degree one that passes
through the distinct points (x0, y0) and (x1, y1) is the same as
approximating a function f for which
f(x0) = y0 and f(x1) = y1
by means of a first-degree polynomial interpolating.
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
4. Lagrange Interpolating Polynomials
The problem of determining a polynomial of degree one that passes
through the distinct points (x0, y0) and (x1, y1) is the same as
approximating a function f for which
f(x0) = y0 and f(x1) = y1
by means of a first-degree polynomial interpolating.
We need a polynomial
P(x) = L0(x)f(x0) + L1(x)f(x1)
that satisfies
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
5. Lagrange Interpolating Polynomials
The problem of determining a polynomial of degree one that passes
through the distinct points (x0, y0) and (x1, y1) is the same as
approximating a function f for which
f(x0) = y0 and f(x1) = y1
by means of a first-degree polynomial interpolating.
We need a polynomial
P(x) = L0(x)f(x0) + L1(x)f(x1)
that satisfies
(i) P(x0) = f(x0), that is, L0(x0) = 1 and L1(x0) = 0 at x0
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
6. Lagrange Interpolating Polynomials
The problem of determining a polynomial of degree one that passes
through the distinct points (x0, y0) and (x1, y1) is the same as
approximating a function f for which
f(x0) = y0 and f(x1) = y1
by means of a first-degree polynomial interpolating.
We need a polynomial
P(x) = L0(x)f(x0) + L1(x)f(x1)
that satisfies
(i) P(x0) = f(x0), that is, L0(x0) = 1 and L1(x0) = 0 at x0
(ii) P(x1) = f(x1), that is, L0(x1) = 0 and L1(x1) = 1 at x1
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
7. How can we define such L0(x) and L1(x), using x0 and x1?
We need a polynomial
P(x) = L0(x)f(x0) + L1(x)f(x1)
that satisfies
(i) P(x0) = f(x0), that is, L0(x0) = 1 and L1(x0) = 0 at x0
(ii) P(x1) = f(x1), that is, L0(x1) = 0 and L1(x1) = 1 at x1
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
8. How can we define such L0(x) and L1(x), using x0 and x1?
We need a polynomial
P(x) = L0(x)f(x0) + L1(x)f(x1)
that satisfies
(i) P(x0) = f(x0), that is, L0(x0) = 1 and L1(x0) = 0 at x0
(ii) P(x1) = f(x1), that is, L0(x1) = 0 and L1(x1) = 1 at x1
We can define
L0(x) =
x − x1
x0 − x1
L1(x) =
x − x0
x1 − x0
The linear Lagrange interpolating polynomial through (x0, y0) and
(x1, y1) is
P(x) = L0(x)f(x0) + L1(x)f(x1) =
x − x1
x0 − x1
f(x0) +
x − x0
x1 − x0
f(x1)
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
9. Example (Determine the linear Lagrange interpolating polynomial that
passes through the points (2, 4) and (5, 1).)
We know that Lagrange’s Polynomial is
P(x) = L0(x)f(x0) + L1(x)f(x1),
where
L0(x) =
x − x1
x0 − x1
L1(x) =
x − x0
x1 − x0
In this example x0 = 2, y0 = f(x0) = 4 and x1 = 5, y1 = f(x1) = 1
P(x) =
−(x − 5)
3
(4) +
(x − 2)
3
(1) = −x + 6
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
10. Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
11. Ln,k(xi) =
0, when i = k;
1, otherwise.
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
12. Ln,k(xi) =
0, when i = k;
1, otherwise.
To satisfy Ln,k(xi) = 0 for each i = k requires that the numerator of
Ln,k(x) contain the term
(x − x0)(x − x1) · · · (x − xk−1)(x − xk+1) · · · (x − xn)
product of all factors except xk
.
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
13. Ln,k(xi) =
0, when i = k;
1, otherwise.
To satisfy Ln,k(xi) = 0 for each i = k requires that the numerator of
Ln,k(x) contain the term
(x − x0)(x − x1) · · · (x − xk−1)(x − xk+1) · · · (x − xn)
product of all factors except xk
.
To satisfy Ln,k(xk) = 1, the denominator of Ln,k(x) must be this same
term but evaluated at x = xk. Thus
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
14. Ln,k(xi) =
0, when i = k;
1, otherwise.
To satisfy Ln,k(xi) = 0 for each i = k requires that the numerator of
Ln,k(x) contain the term
(x − x0)(x − x1) · · · (x − xk−1)(x − xk+1) · · · (x − xn)
product of all factors except xk
.
To satisfy Ln,k(xk) = 1, the denominator of Ln,k(x) must be this same
term but evaluated at x = xk. Thus
Ln,k(x) =
(x − x0)(x − x1) · · · (x − xk−1)(x − xk+1) · · · (x − xn)
(xk − x0)(xk − x1) · · · (xk − xk−1)(xk − xk+1) · · · (xk − xn)
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
15. If x0, x1, ..., xn are n + 1 distinct numbers and f is a function whose values
are given at these numbers, then a unique polynomial P(x) of degree at
most n exists with
f(xk) = P(xk), for each k = 0, 1, ..., n.
This polynomial is given by
P(x) = Ln,0(x)f(x0) + Ln,1(x)f(x1) + · · · +, Ln,n(x)f(xn)
=
n
k=0
f(xk)Ln,k(x),
where, for each k = 0, 1, ..., n,
Ln,k(x) =
(x − x0)(x − x1) · · · (x − xk−1)(x − xk+1) · · · (x − xn)
(xk − x0)(xk − x1) · · · (xk − xk−1)(xk − xk+1) · · · (xk − xn)
=
n
i=0
i=k
x − xi
xk − xi
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
16. Ln,k(x) =
(x − x0)(x − x1) · · · (x − xk−1)(x − xk+1) · · · (x − xn)
(xk − x0)(xk − x1) · · · (xk − xk−1)(xk − xk+1) · · · (xk − xn)
=
n
i=0
i=k
x − xi
xk − xi
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
17. Ln,k(x) =
(x − x0)(x − x1) · · · (x − xk−1)(x − xk+1) · · · (x − xn)
(xk − x0)(xk − x1) · · · (xk − xk−1)(xk − xk+1) · · · (xk − xn)
=
n
i=0
i=k
x − xi
xk − xi
It can easily be seen that
Ln,k(xi) =
0, when i = k;
1, otherwise.
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
18. Explicitly construct the Lagrange Interpolating Polynomial
and interpolate f(3).
.
i xi yi = f(xi) = fi
0 0 7
1 1 13
2 2 21
3 4 43
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
19. Explicitly construct the Lagrange Interpolating Polynomial
and interpolate f(3).
.
i xi yi = f(xi) = fi
0 0 7
1 1 13
2 2 21
3 4 43
Nodes: x0 = 0, x1 = 1, x2 = 2,
x3 = 4, n = 3
Functional values: f0 = 7, f1 = 13,
f2 = 21, f3 = 43.
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
20. Explicitly construct the Lagrange Interpolating Polynomial
and interpolate f(3).
.
i xi yi = f(xi) = fi
0 0 7
1 1 13
2 2 21
3 4 43
Nodes: x0 = 0, x1 = 1, x2 = 2,
x3 = 4, n = 3
Functional values: f0 = 7, f1 = 13,
f2 = 21, f3 = 43.
To find the polynomial we will use the following formula
P3(x) = L3,0(x)f(x0) + L3,1(x)f(x1) + L3,2(x)f(x2) + L3,3(x)f(x3)
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
21. Explicitly construct the Lagrange Interpolating Polynomial
and interpolate f(3).
.
i xi yi = f(xi) = fi
0 0 7
1 1 13
2 2 21
3 4 43
Nodes: x0 = 0, x1 = 1, x2 = 2,
x3 = 4, n = 3
Functional values: f0 = 7, f1 = 13,
f2 = 21, f3 = 43.
To find the polynomial we will use the following formula
P3(x) = L3,0(x)f(x0) + L3,1(x)f(x1) + L3,2(x)f(x2) + L3,3(x)f(x3)
P3(x) = 7L3,0(x) + 13L3,1(x) + 21L3,2(x) + 43L3,3(x)
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
22. Explicitly construct the Lagrange Interpolating Polynomial
and interpolate f(3).
.
i xi yi = f(xi) = fi
0 0 7
1 1 13
2 2 21
3 4 43
Nodes: x0 = 0, x1 = 1, x2 = 2,
x3 = 4, n = 3
Functional values: f0 = 7, f1 = 13,
f2 = 21, f3 = 43.
To find the polynomial we will use the following formula
P3(x) = L3,0(x)f(x0) + L3,1(x)f(x1) + L3,2(x)f(x2) + L3,3(x)f(x3)
P3(x) = 7L3,0(x) + 13L3,1(x) + 21L3,2(x) + 43L3,3(x)
L3,0(x) =
(x − x1)(x − x2)(x − x3)
(x0 − x1)(x0 − x2)(x0 − x3)
=
(x − 1)(x − 2)(x − 4)
(0 − 1)(0 − 2)(0 − 4)
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
23. Explicitly construct the Lagrange Interpolating Polynomial
and interpolate f(3).
.
i xi yi = f(xi) = fi
0 0 7
1 1 13
2 2 21
3 4 43
Nodes: x0 = 0, x1 = 1, x2 = 2,
x3 = 4, n = 3
Functional values: f0 = 7, f1 = 13,
f2 = 21, f3 = 43.
To find the polynomial we will use the following formula
P3(x) = L3,0(x)f(x0) + L3,1(x)f(x1) + L3,2(x)f(x2) + L3,3(x)f(x3)
P3(x) = 7L3,0(x) + 13L3,1(x) + 21L3,2(x) + 43L3,3(x)
L3,0(x) =
(x − x1)(x − x2)(x − x3)
(x0 − x1)(x0 − x2)(x0 − x3)
=
(x − 1)(x − 2)(x − 4)
(0 − 1)(0 − 2)(0 − 4)
L3,1(x) =
(x − x0)(x − x2)(x − x3)
(x1 − x0)(x1 − x2)(x1 − x3)
=
(x)(x − 2)(x − 4)
(1)(1 − 2)(1 − 4)
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics
24. Explicitly construct the Lagrange Interpolating Polynomial
and interpolate f(3).
.
i xi yi = f(xi) = fi
0 0 7
1 1 13
2 2 21
3 4 43
Nodes: x0 = 0, x1 = 1, x2 = 2,
x3 = 4, n = 3
Functional values: f0 = 7, f1 = 13,
f2 = 21, f3 = 43.
To find the polynomial we will use the following formula
P3(x) = L3,0(x)f(x0) + L3,1(x)f(x1) + L3,2(x)f(x2) + L3,3(x)f(x3)
P3(x) = 7L3,0(x) + 13L3,1(x) + 21L3,2(x) + 43L3,3(x)
L3,0(x) =
(x − x1)(x − x2)(x − x3)
(x0 − x1)(x0 − x2)(x0 − x3)
=
(x − 1)(x − 2)(x − 4)
(0 − 1)(0 − 2)(0 − 4)
L3,1(x) =
(x − x0)(x − x2)(x − x3)
(x1 − x0)(x1 − x2)(x1 − x3)
=
(x)(x − 2)(x − 4)
(1)(1 − 2)(1 − 4)
L3,2(x) =
(x − x0)(x − x1)(x − x3)
(x2 − x0)(x2 − x2)(x2 − x3)
=
(x)(x − 1)(x − 4)
(2)(2 − 1)(2 − 4)
Dr. Yasir Ali (yali@ceme.nust.edu.pk) Adv. Engg. Mathematics