Lagrange Interpolation – Points to Polynomial
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
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
Enter your points
Distinct x values with their y values
- 2
Build each basis
Lᵢ(x) products are expanded symbolically
- 3
Weight and sum
P(x) = Σ yᵢLᵢ(x) is assembled
- 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?
How many points for a quadratic?
What is Runge’s phenomenon?
Interpolation or extrapolation at x=10 for those points?
Related tools
Pick another tool to continue your calculation.
Modular Arithmetic Calculator – Mod Operations
Calculate modular arithmetic operations.
Modular Inverse Calculator – a⁻¹ mod m
Calculate the modular inverse of a number.
Riemann Sum Calculator – Left, Right & Midpoint
Calculate approximate integral using Riemann sum.
Signed Magnitude Converter – 8-Bit Binary
Convert between decimal and binary signed magnitude.
Divisor Sum Calculator – σ(n) Function
Calculate sum of divisors and Euler functions.
Stirling’s Approximation Calculator – n! Estimate
Calculate factorial using Stirling's approximation.