Polynomial Interpolation Calculator (Lagrange)

Fit the unique polynomial through up to 10 points with Lagrange interpolation, get its coefficients and value at x, or look up a value in a table.

Lagrange: 2 to 10 points. Table lookup: 2 or more (as many as fit in the box). Every x must be different. Use a point for decimals.

Results

P(x) at x = 1.5
4.75
Interpolating polynomial P(x)
P(x) = x² + x + 1
Degree
2
At most 3 for 4 points; lower if the points happen to lie on a simpler curve.
Coefficients (highest power first)
1, 1, 1

How it’s calculated

Given n points with different x values, exactly one polynomial of degree n − 1 or lower passes through all of them. The Lagrange form builds it from one basis polynomial per point, each equal to 1 at its own x and 0 at the others.

P(x) = Σ yᵢ × Lᵢ(x) Lᵢ(x) = Π (x − xⱼ) ÷ (xᵢ − xⱼ) over all j ≠ i

The calculator expands the sum into coefficients and evaluates P at your x. It does this in exact fractions, so the coefficients are right even for x values far from 0 (such as years), and a coefficient shown as 0 really is 0.

Example: the points (0, 1), (1, 3), (2, 7), (3, 13) lie on y = x² + x + 1, so the cubic coefficient comes out as 0 and P(1.5) = 2.25 + 1.5 + 1 = 4.75.

Table lookup mode instead joins neighboring points with straight lines. For x = 1.5 in the same table it finds the rows (1, 3) and (2, 7) and gives 3 + 0.5 × 4 = 5. It refuses x outside the table. Use it for lookups where a single high-degree curve would be a poor model.

Caution: with many points a single polynomial can oscillate between them (Runge's phenomenon), so prefer fewer points near the one you need, or table lookup.

Frequently asked questions

What does Lagrange interpolation do?

It finds the one polynomial of degree at most n − 1 that passes through n given points, then lets you evaluate it at any x.

Why does the calculator reject two points with the same x?

A function has one y for each x, so no polynomial can pass through two different points above the same x.

Should I use the polynomial or the table lookup?

Use the polynomial when you believe the data follows a smooth curve. Use table lookup when you just need to read between rows of a table, which is the safer choice for many points.

Why is the answer so strange outside my data?

High-degree polynomials can grow very quickly beyond the first and last points. The calculator flags extrapolation; do not trust it far from the data.

Embed this calculator

Add this free calculator to your own website. Copy the code below into your page’s HTML:

Need this calculator branded, changed or built around your own prices?See custom business solutions →

Sources

Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.

Added · Last updated · How we check our calculators

Spotted a mistake or missing option? Report a problem· Suggest a calculator