Lagrange Interpolation Calculator

Interpolated value
—
Degree
—
Points
—
Slope at x
—
Area under P
—
The curve
The polynomial
How each point adds up tap a row to see its term

Lagrange interpolation calculator: find the polynomial through your points, evaluate it at any x, and copy it as text, LaTeX or an Excel formula.

Result
—

Lagrange interpolation step by step: every basis polynomial, its value at x, the weighted sum and the expanded polynomial, with exact fractions.

Largest error
—
Points
—
Degree
—
Equal spacing
—
Chebyshev
—
The function and its polynomial
Largest error as you add points

Runge phenomenon demo: interpolate any function with equally spaced or Chebyshev points and compare the largest error as the degree grows.

The basis polynomials for x = 0, 1, 2, 3
Questions
What is Lagrange interpolation?

A way to find the polynomial of lowest degree that passes exactly through a set of points. With n points you get a polynomial of degree n − 1 or less, and there is only one.

What is the Lagrange formula?

P(x) = Σ yᵢ Lᵢ(x), where each basis polynomial Lᵢ(x) = ∏ (x − xⱼ) / (xᵢ − xⱼ) over every other point j. Lᵢ is 1 at xᵢ and 0 at every other xⱼ.

Why must every x be different?

Each Lᵢ divides by xᵢ − xⱼ, which would be zero. A function also can't pass through two different y values at the same x.

Is it the same as Newton's interpolation?

Yes. Both give the same unique polynomial. Newton's divided differences just build it in a different order, which makes adding a point cheaper.

What is the Runge phenomenon?

With many equally spaced points, the polynomial can swing wildly near the ends of the interval, even for a smooth function like 1/(1 + 25x²). Chebyshev points, bunched toward the ends, fix it. Try it on the Runge & Error tab.

Can I predict values outside my points?

That's extrapolation. Polynomials often shoot off beyond the data, so trust values between your smallest and largest x much more.

How exact are the results?

The polynomial, its coefficients and P(x) are worked out with exact fractions, so nothing is rounded until it's displayed. The charts use the barycentric formula, a stable way to plot the same polynomial.

Learn Lagrange interpolation: the formula, the basis polynomials, how to do it by hand, and how it compares with Newton's method.