Lagrange Interpolation Calculator

Enter your known data points as x, y coordinate pairs and specify the interpolation value x₀ to evaluate. The Lagrange Interpolation Calculator constructs the unique polynomial passing through all your points and computes f(x₀) — the estimated function value — along with the interpolating polynomial equation in expanded form.

Enter one point per line as: x y (space-separated). Example: 0 1

The x value at which to estimate f(x₀) using the interpolating polynomial.

Results

Interpolated f(x₀)

--

Number of Data Points

--

Polynomial Degree

--

Interpolating Polynomial P(x)

--

Data Points & Interpolated Curve

Results Table

Frequently Asked Questions

What is Lagrange interpolation?

Lagrange interpolation is a numerical method for finding the unique polynomial P(x) of degree at most n that passes through n+1 given distinct data points {(x₀,y₀), (x₁,y₁), …, (xₙ,yₙ)}. It expresses this polynomial as a weighted sum of basis polynomials, making it useful for estimating unknown function values between (or beyond) known data.

How do I enter data points into the calculator?

Enter one data point per line in the Data Points field, with the x and y values separated by a space. For example, '0 1' on the first line, '1 3' on the second, and so on. Make sure all x values are distinct — duplicate x values will cause the calculation to fail.

How is the Lagrange interpolating polynomial constructed?

The polynomial is built as P(x) = Σ yᵢ · Lᵢ(x), where each basis polynomial Lᵢ(x) equals the product of (x − xⱼ)/(xᵢ − xⱼ) for all j ≠ i. Each Lᵢ equals 1 at xᵢ and 0 at every other data point, so the weighted sum passes exactly through all given points.

What are the limits of Lagrange interpolation?

Lagrange interpolation works best with a small number of well-spaced data points. With many points, high-degree polynomials can suffer from Runge's phenomenon — large oscillations between data points, especially near the edges of the interval. For large datasets, piecewise methods like cubic splines are generally more stable.

Can I use the calculator to extrapolate beyond my data range?

Yes — you can enter any x₀ value, including values outside the range of your data points. However, extrapolation is inherently less reliable than interpolation, since the polynomial behavior outside the known range can diverge significantly from the true function.

What is the degree of the interpolating polynomial?

If you provide n+1 data points, the Lagrange interpolating polynomial has degree at most n. For example, 2 points produce a degree-1 polynomial (a line), 3 points produce a degree-2 polynomial (a parabola), and so on.

How does this differ from Newton's interpolation formula?

Both methods produce the same unique interpolating polynomial, but they express it differently. Newton's formula uses divided differences and is more efficient when adding new data points incrementally. Lagrange's formula is more symmetric and easier to write directly from the data, making it simpler for manual computation and understanding.

Why must x values be distinct?

The Lagrange formula requires dividing by (xᵢ − xⱼ) for every pair of points. If two x values are equal, this denominator becomes zero, causing division by zero and making the polynomial undefined. Each x value must be unique for the interpolation to be valid.

More Math Tools