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=3xy011327x= 3 \quad \begin{array}{cc}\text{x} & \text{y} \\ 0 & 1 \\ 1 & 3 \\ 2 & 7\end{array}

Step 2 — Basis L0

Compute basis value ell 0 equals 1.

0=1\ell_{ 0 }= \hl{1}

Step 3 — Basis L1

Compute basis value ell 1 equals -3.

1=-3\ell_{ 1 }= \hl{-3}

Step 4 — Basis L2

Compute basis value ell 2 equals 3.

2=3\ell_{ 2 }= \hl{3}

Step 5 — Combine

Combine 1 times 1 plus 3 times -3 plus 7 times 3 to get 13.

11+33+73=131 \cdot 1 + 3 \cdot -3 + 7 \cdot 3 = \hl{13}

Step 6 — Result

The Lagrange value at 3 is 13.

L(3)=13L( 3 )= \hl{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)