Table of Contents
Last modified on December 11th, 2024
Interpolation is a method to estimate unknown values of a function based on its known values. For a given set of data points (x0, y0), (x1, y1), (x2, y2),…,(xn, yn) interpolation helps us to predict the function value y at a new point x within the range of known xi values.
The Lagrange interpolation technique does the same. It uses a set of known data points to construct a polynomial that passes through each of them, thus defining the behavior of the function.
It has wide applications in image scaling, AI modeling, and NLPs, among others.
The nth-order Lagrange polynomial is expressed as:
${P\left( x\right) =\sum ^{n-1}_{i=0}y_{i}\cdot L_{i}\left( x\right)}$
Here,
The 1st-order Lagrange interpolation polynomial approximates a function using two data points (x0, y0) and (x1, y1).
These polynomials are expressed as
P1(x) = y0L0(x) + y1L1(x)
⇒ ${P_{1}\left( x\right) =\dfrac{\left( x-x_{1}\right) }{\left( x_{0}-x_{1}\right) }y_{0}+\dfrac{\left( x-x_{0}\right) }{\left( x_{1}-x_{0}\right) }y_{1}}$
The 2nd-order Lagrange interpolation polynomial approximates a function using three data points (x0, y0), (x1, y1), and (x2, y2).
Lagrange Interpolation Formula for 2nd order polynomials is:
P2(x) = y0L0(x) + y1L1(x) + y2L2(x)
⇒ ${P_{2}\left( x\right) =\dfrac{\left( x-x_{1}\right) \left( x-x_{2}\right) }{\left( x_{0}-x_{1}\right) \left( x_{0}-x_{2}\right) }y_{0}+\dfrac{\left( x-x_{0}\right) \left( x-x_{2}\right) }{\left( x_{1}-x_{0}\right) \left( x_{1}-x_{2}\right) }y_{1}+\dfrac{\left( x-x_{0}\right) \left( x-x_{1}\right) }{\left( x_{2}-x_{0}\right) \left( x_{2}-x_{1}\right) }y_{2}}$
Similarly, the 3rd-order interpolation polynomial is given by:
P3(x) = y0L0(x) + y1L1(x) + y2L2(x) + y3L3(x)
Now, let us verify whether Lagrange interpolating polynomial P(x) satisfies the interpolation property.
Constructing the Lagrange Basis Polynomials Li(x)
Each basis polynomial Li(x) is:
${L_{i}\left( x\right) =\prod ^{n-1}_{j=0,j\neq i}\dfrac{x-x_{j}}{x_{i}-x_{j}}}$
This means
Verifying the Interpolation Condition
Let us substitute x = xk into P(x). We have:
${P\left( x_{k}\right) =\sum ^{n-1}_{i=0}y_{i}\cdot L_{i}\left( x_{k}\right)}$
Thus, only when i = k, P(x) becomes
${P\left( x_{k}\right) =\sum ^{n-1}_{i=0}y_{i}\cdot L_{i}\left( x_{k}\right)}$ = yk ⋅ 1 = yk
⇒ P(xk) = yk, showing that the Lagrange polynomial interpolates the given data points.
from the fact
Verifying the Uniqueness of the Polynomial
The interpolation polynomial P(x) is unique. Now, let us suppose there exists another polynomial Q(x) of degree n – 1 that also interpolates the same data points.
Then, R(x) = P(x) – Q(x), a polynomial of degree ≥ n – 1 with n roots at x0, x1, …, xn – 1
Since a polynomial of degree n – 1 can have at most n – 1 roots, R(x) must be identically zero.
Thus, P(x) = Q(x), proving that any two polynomials interpolating the same data points must be identical.
The uniqueness of the polynomials is followed.
Finding Lagrange Polynomial
Let us interpolate the data points (1, 2), (3, 6), and (5, 10) using the Lagrange interpolation method.
Identifying the Data Points
Constructing the Basis Polynomials
Computing each Li(x) for each i, we get
Forming the Interpolating Polynomial
On multiplying each Li(x) by its corresponding yi and adding them, we get
P(x) = 2 ⋅ L0(x) + 6 ⋅ L1(x) + 10 ⋅ L2(x)
⇒ P(x) = ${\dfrac{2\left( x-3\right) \left( x-5\right) }{8}-\dfrac{6\left( x-1\right) \left( x-5\right) }{4}+\dfrac{10\left( x-1\right) \left( x-3\right) }{8}}$
⇒ P(x) = ${\dfrac{2\left( x-3\right) \left( x-5\right) }{8}-\dfrac{12\left( x-1\right) \left( x-5\right) }{8}+\dfrac{10\left( x-1\right) \left( x-3\right) }{8}}$
⇒ P(x) = ${\dfrac{1}{8}\left[ 2\left( x-3\right) \left( x-5\right) -12\left( x-1\right) \left( x-5\right) +10\left( x-1\right) \left( x-3\right) \right]}$ …(i)
Now, expanding each term inside the brackets of the equation (i), we get
2(x – 3)(x – 5) = 2(x2 – 8x + 15) = 2x2 – 16x + 30 …..(ii)
-12(x – 1)(x – 5) = -12(x2 – 6x + 5) = -12x2 + 72x – 60 …..(iii)
10(x – 1)(x – 3) = 10(x2 – 4x + 3) = 10x2 – 40x + 30 …..(iv)
Now, combining the equations (ii), (iii), and (iv), we get
2(x – 3)(x – 5) – 12(x – 1)(x – 5) + 10(x – 1)(x – 3)
= 2x2 – 16x + 30 – 12x2 + 72x – 60 + 10x2 – 40x + 30
= (2x2 – 12x2 + 10x2) + (-16x + 72x – 40x) + (30 – 60 + 30)
= 16x …..(v)
Substituting the value of (v) in the equation (i), we get
P(x) = ${\dfrac{1}{8}\left( 16x\right)}$
⇒ P(x) = 2x
Thus, the Lagrange interpolation polynomial is P(x) = 2x
The Lagrange polynomial follows the following properties:
The Lagrange Polynomial, P(x), is of degree n – 1, where n is the number of data points. It is mathematically expressed as:
P(xi) = yi, for all i = 0, 1, …, n – 1
Here,
(x0, y0), (x1, y1), …, (xn – 1, yn – 1) represent the given set of n data points
For a given set of n+ distinct data points, the Lagrange interpolating polynomial is unique. Also, the polynomial passes exactly through the given data points.
Use the Lagrange interpolation method to estimate the value of P(x) at x = 4 for the following data points:
(1, 2), (2, 4), (3, 6), and (5, 10)
Given Points: (1, 2), (2, 4), (3, 6), and (5, 10)
As we know, the Lagrange polynomial is given by:
${P\left( x\right) =\sum ^{n-1}_{i=0}y_{i}\cdot L_{i}\left( x\right)}$
Here,
${L_{i}\left( x\right) =\prod ^{n-1}_{j=0,j\neq i}\dfrac{x-x_{j}}{x_{i}-x_{j}}}$
For x = 4, calculating each Li(4), we get
1. Since L0(x) = ${\dfrac{\left( x-2\right) \left( x-3\right) \left( x-5\right) }{\left( 1-2\right) \left( 1-3\right) \left( 1-5\right) }}$
Here, L0(4) = ${\dfrac{\left( 4-2\right) \left( 4-3\right) \left( 4-5\right) }{\left( 1-2\right) \left( 1-3\right) \left( 1-5\right) }}$ = ${-\dfrac{1}{4}}$
2. Since L1(x) = ${\dfrac{\left( x-\right) \left( x-3\right) \left( x-5\right) }{\left( 2-1\right) \left( 2-3\right) \left( 2-5\right) }}$
Here, L1(x) = ${\dfrac{\left( 4-1\right) \left( 4-3\right) \left( 4-5\right) }{\left( 2-1\right) \left( 2-3\right) \left( 2-5\right) }}$ = ${-1}$
3. Since L2(x) = ${\dfrac{\left( x-1\right) \left( x-2\right) \left( x-5\right) }{\left( 3-1\right) \left( 3-2\right) \left( 3-5\right) }}$
Here, L2(4) = ${\dfrac{\left( 4-1\right) \left( 4-2\right) \left( 4-5\right) }{\left( 3-1\right) \left( 3-1\right) \left( 3-5\right) }}$ = ${\dfrac{3}{2}}$
4. Since L3(x) = ${\dfrac{\left( x-1\right) \left( x-2\right) \left( x-3\right) }{\left( 5-1\right) \left( 5-2\right) \left( 5-3\right) }}$
Here, L3(x) = ${\dfrac{\left( 4-1\right) \left( 4-2\right) \left( 4-3\right) }{\left( 5-1\right) \left( 5-2\right) \left( 5-3\right) }}$ = ${\dfrac{1}{4}}$
Now, substituting the above values in P(x), we get
P(4) = 2 ⋅ L0(4) + 4 ⋅ L1(4) + 6 ⋅ L2(4) + 10 ⋅ L3(4)
⇒ P(4) = ${2\cdot \left( -\dfrac{1}{4}\right) +4\cdot \left( -1\right) +6\cdot \dfrac{3}{2}+10\cdot \dfrac{1}{4}}$
⇒ P(4) = 7
Thus, P(4) = 7
Last modified on December 11th, 2024