Skip to main content

Lagrange Interpolation – Points to Polynomial

Quick answer

Build the unique polynomial through your points: (1,3),(2,5),(4,9) lie on y=2x+1, so x=3 interpolates to 7.

  • Basis products shown.

Figures are estimates from this calculator’s standard formula — adjust the inputs in the tool below for your exact number.

How Lagrange Interpolation Works

P(x) = Σ yᵢ·Lᵢ(x), Lᵢ(x) = Π (x−xⱼ)/(xᵢ−xⱼ), j ≠ i

Given n+1 points with distinct x values, exactly one polynomial of degree ≤ n passes through all of them, and Lagrange’s formula writes it directly as a weighted sum of basis polynomials. Each basis Lᵢ equals 1 at xᵢ and 0 at every other node — for points (1,3), (2,5), (4,9): L₁(x) = (x−2)(x−4)/((1−2)(1−4)) = (x−2)(x−4)/3. Evaluating at x = 3 gives L₁ = −1/3, L₂ = 1, L₃ = 1/3, and summing yᵢLᵢ(3) = 3(−1/3) + 5(1) + 9(1/3) = 7 — correct because these points lie on the line y = 2x+1 (check: 2(3)+1 = 7). The calculator expands every basis polynomial, multiplies by yᵢ, sums, and prints the resulting polynomial. It warns about Runge’s phenomenon — high-degree interpolation oscillating at edges (as with 1/(1+25x²) on equally spaced nodes) — and recommends splines for many points.

  1. 1

    Enter your points

    Distinct x values with their y values

  2. 2

    Build each basis

    Lᵢ(x) products are expanded symbolically

  3. 3

    Weight and sum

    P(x) = Σ yᵢLᵢ(x) is assembled

  4. 4

    Evaluate anywhere

    Interpolate at your target x; extrapolation is flagged

Use Cases

Table Completion

Estimate missing entries between known data rows

Function Fitting

Recover y = 2x+1 from three sampled points

Numerical Formulas

Derive quadrature weights from interpolation theory

Tips

  • 1

    n+1 points determine a unique degree-n polynomial

  • 2

    Basis Lᵢ is 1 at its own node, 0 at all others

  • 3

    Equal spacing + high degree invites Runge oscillation

Common Mistakes

  • Repeating an x value, which breaks the basis denominators

  • Trusting extrapolation far outside the sampled range

  • Using 20 points for a straight-line trend — degree explodes needlessly

  • Sign errors assembling (x−xⱼ)/(xᵢ−xⱼ) products

FAQs

What does interpolating x=3 on (1,3),(2,5),(4,9) give?

7 — the points sit on y = 2x+1, and Lagrange reconstructs that line exactly.

How many points for a quadratic?

Three: n+1 points fix the unique degree-n polynomial.

What is Runge’s phenomenon?

High-degree interpolants through equally spaced points oscillate wildly near the ends — 1/(1+25x²) is the famous demo.

Can two polynomials share all my points?

No — the interpolating polynomial of degree ≤ n through n+1 points is unique.

Interpolation or extrapolation at x=10 for those points?

Extrapolation — 10 lies outside [1,4], and confidence drops sharply outside the data span.