Lagrange Interpolating Polynomials

1 min read Last updated Sat Jun 27 2026 08:46:52 GMT+0000 (Coordinated Universal Time)

A rearranged form of Newton’s divided difference polynomial.

The kk-th Lagrange basis polynomial for n+1n+1 nodes is:

Ln,k(x)=i=0iknxxixkxiL_{n,k}(x) = \prod_{\substack{i=0 \\ i \neq k}}^{n} \frac{x - x_i}{x_k - x_i}

Here:

  • x0,x1,,xnx_0, x_1, \ldots, x_n: the n+1n+1 distinct data points (nodes)
  • Ln,k(xk)=1L_{n,k}(x_k) = 1 and Ln,k(xi)=0L_{n,k}(x_i) = 0 for iki \neq k

The nn-th Lagrange interpolating polynomial through the data (xk,f(xk))(x_k, f(x_k)) is:

Pn(x)=k=0nLn,k(x)f(xk)P_n(x) = \sum_{k=0}^{n} L_{n,k}(x)\, f(x_k)

Example

Interpolate through (1,1)(1, 1), (2,4)(2, 4), (3,9)(3, 9) (i.e., f(x)=x2f(x) = x^2).

Basis polynomials for n=2n = 2:

L2,0(x)=(x2)(x3)(12)(13)=(x2)(x3)2L_{2,0}(x) = \frac{(x-2)(x-3)}{(1-2)(1-3)} = \frac{(x-2)(x-3)}{2} L2,1(x)=(x1)(x3)(21)(23)=(x1)(x3)L_{2,1}(x) = \frac{(x-1)(x-3)}{(2-1)(2-3)} = -(x-1)(x-3) L2,2(x)=(x1)(x2)(31)(32)=(x1)(x2)2L_{2,2}(x) = \frac{(x-1)(x-2)}{(3-1)(3-2)} = \frac{(x-1)(x-2)}{2} P2(x)=1(x2)(x3)24(x1)(x3)+9(x1)(x2)2P_2(x) = 1 \cdot \frac{(x-2)(x-3)}{2} - 4(x-1)(x-3) + 9 \cdot \frac{(x-1)(x-2)}{2}

At x=4x = 4: L2,0(4)=1L_{2,0}(4) = 1, L2,1(4)=3L_{2,1}(4) = -3, L2,2(4)=3L_{2,2}(4) = 3, so:

P2(4)=1(1)+4(3)+9(3)=112+27=16=42P_2(4) = 1(1) + 4(-3) + 9(3) = 1 - 12 + 27 = 16 = 4^2 \checkmark

Was this helpful?