Given n+1 data points, Lagrange interpolation constructs
a polynomial L(x)=Σ y_i·ℓ_i(x) where each basis polynomial
ℓ_i(x) equals 1 at x_i and 0 at all other nodes.
Example: (0,1),(1,3),(2,7) with x=3 gives L(3)=13.
Each basis polynomial is:
ℓi(xq) = product over j≠i of (xq-xj)/(xi-xj)
Example
Evaluate Lagrange basis values and combine them.
highlighted = computed this step
Step 1 — Set up
Evaluate the Lagrange polynomial at x equals 3.
x=3x012y137
Step 2 — Basis L0
Compute basis value ell 0 equals 1.
ℓ0=1
Step 3 — Basis L1
Compute basis value ell 1 equals -3.
ℓ1=-3
Step 4 — Basis L2
Compute basis value ell 2 equals 3.
ℓ2=3
Step 5 — Combine
Combine 1 times 1 plus 3 times -3 plus 7 times 3 to get 13.
1⋅1+3⋅−3+7⋅3=13
Step 6 — Result
The Lagrange value at 3 is 13.
L(3)=13
lagrange-interpolation
For three points (x0,y0),(x1,y1),(x2,y2), the Lagrange interpolating polynomial evaluated at xq is: L(xq) = y0·ℓ0(xq) + y1·ℓ1(xq) + y2·ℓ2(xq)