Lagrange Interpolation Formula
Lagrange interpolation finds a polynomial passing through given data points.
Learn the formula with step-by-step worked examples.
The Formula
The Lagrange interpolation formula constructs a polynomial of degree at most n-1 that passes exactly through n given data points. It was published by Joseph-Louis Lagrange in 1795, although it was discovered independently by Edward Waring in 1779.
For each data point (xᵢ, yᵢ), the formula creates a basis polynomial Lᵢ(x) that equals 1 at xᵢ and 0 at all other data points. The final polynomial is the weighted sum of these basis polynomials, where the weights are the y-values.
This method requires no matrix operations or system of equations, making it conceptually simple. However, for large datasets, other methods like Newton's divided differences may be more computationally efficient.
Variables
| Symbol | Meaning |
|---|---|
| P(x) | The interpolating polynomial evaluated at x |
| (xᵢ, yᵢ) | The given data points (i = 0, 1, ..., n-1) |
| Lᵢ(x) | The i-th Lagrange basis polynomial |
| n | Number of data points |
Example 1
Given points (1, 2), (2, 5), (4, 17), find P(3) using Lagrange interpolation.
L₀(3) = (3-2)(3-4) / (1-2)(1-4) = (1)(-1) / (-1)(-3) = -1/3
L₁(3) = (3-1)(3-4) / (2-1)(2-4) = (2)(-1) / (1)(-2) = -2/-2 = 1
L₂(3) = (3-1)(3-2) / (4-1)(4-2) = (2)(1) / (3)(2) = 2/6 = 1/3
P(3) = 2(-1/3) + 5(1) + 17(1/3) = -2/3 + 5 + 17/3 = -2/3 + 15/3 + 17/3 = 30/3
P(3) = 10
Example 2
Given points (0, 1) and (2, 9), find P(1) — linear interpolation.
With 2 points, this is linear interpolation (a special case of Lagrange).
L₀(1) = (1-2)/(0-2) = -1/-2 = 1/2
L₁(1) = (1-0)/(2-0) = 1/2
P(1) = 1(1/2) + 9(1/2) = 0.5 + 4.5
P(1) = 5
When to Use It
Lagrange interpolation is used whenever you need to estimate values between known data points.
- Estimating function values from a table of known values
- Reconstructing polynomials from their roots or values
- Numerical analysis and scientific computing
- Cryptography (Shamir's secret sharing scheme uses this formula)