What is a Lagrange Interpolation Calculator?
The Lagrange Interpolation Calculator is a free online tool that evaluates the single polynomial that passes exactly through a set of data points, at any x you choose. Numerical-methods, engineering and mathematics students use it when a value at a point between their measurements, using all the points at once instead of just the nearest two. Instead of building the Lagrange basis polynomials by hand, where each term is a product of fractions and one slip ruins the whole sum, you type the x and y values of your points, two to six of them, and the x you want to evaluate at and the calculator returns the value of the interpolating polynomial at your x, and the degree of that polynomial straight away.
The working idea is simple. the calculator builds one Lagrange basis polynomial per point — a polynomial that equals 1 at its own point and 0 at every other point — multiplies each by its y value, and adds them up Because each basis polynomial is 0 at all the other points, the sum passes exactly through every point you gave. The degree of the result is one less than the number of points: two points give a line, three give a parabola, four give a cubic. There is no sign-up and nothing to install: the page runs entirely in your browser, so your numbers never leave your device.
That matters because two points only support a straight line, but three or more points can reveal a curve, and Lagrange interpolation uses every point you have instead of throwing most of them away The polynomial is exact at your points but only an estimate between them, and it can swing wildly outside the range of your points — that is the nature of high-degree polynomials, not a bug in the calculator. The rest of this page walks through the formula, the input people get wrong most often, and a worked example with real numbers you can check by hand.
How a Lagrange Interpolation Calculator works
At its core, the calculator applies the interpolating polynomial is the sum over i of yᵢ times the product over j ≠ i of (x − xⱼ) ÷ (xᵢ − xⱼ). Each product term is a fraction that equals 1 when x is xᵢ and 0 when x is any other xⱼ, so the term contributes exactly yᵢ at its own point and nothing at the others. Adding all the terms gives the unique polynomial of degree n − 1 through n points. The formula box at the top of this page shows the same rule in symbols: P(x) = Σ yᵢ × Π (x − xⱼ) ÷ (xᵢ − xⱼ) over j ≠ i.
The calculator checks that all x values are distinct — a repeated x would divide by zero — then evaluates each basis product at your x and adds the weighted terms. With six points the arithmetic is still instant in the browser. You need between two and six points, all with different x values, and the two lists must match in length. More than six points makes the polynomial wobble badly between points, so this tool caps the count at six on purpose.
The arithmetic is exact for the interpolating polynomial, so any error in the answer comes from the data itself or from evaluating far outside the points, not from the calculation A linear equation calculator can help you check the numbers that feed into this step, and it is worth doing that check before you trust an answer that looks surprising.
The the X values of the points explained
The x values must all be distinct, and their spacing matters more than people expect. Evenly spaced points give a well-behaved polynomial, but points bunched at one end with a gap at the other let the polynomial swing between them — the classic Runge wobble. The mistake is to add more points hoping for a better answer: beyond about six points, each extra point usually makes the swings between points worse, not better.
Use the fewest points that capture the shape — three for a gentle bend, four or five for a stronger one — and keep them spread across the range you care about. If two points share an x value, the calculator shows dashes, because no single function can pass through both. Keep the evaluation x inside the range of your points. Between the points the polynomial is an estimate; outside them it is an extrapolation that can be wrong by a large factor.
Test the tool on its own points: evaluating at one of your x values must return exactly that point's y value. If it does not, a list was mistyped. A slope calculator is a good cross-check when the input comes from a measurement or a table rather than from a textbook problem.
A worked example
Take the default points on this page: (0, 1), (1, 2) and (2, 5). These lie on the curve y = x² + 1, and you want the value at x = 3.
With three points the interpolating polynomial has degree 2. The Lagrange sum gives P(3) = 10, and the true curve gives 3² + 1 = 10, so the interpolation is exact — as it should be, because three points determine a parabola and these three points came from one.
The result is exact here only because the points really do lie on a parabola. In real measurements the points carry noise, and then the polynomial through them is an estimate that follows the noise as well as the trend. Evaluate at x = 1 to check: the calculator must return 2, the y value of the middle point, because the polynomial passes exactly through every point you gave.
Where the Lagrange Interpolation Calculator is used
In engineering, Lagrange interpolation estimates a material property at a temperature between tested values, using all the test points instead of just the nearest pair.
In computer graphics, it builds smooth curves through control points, and in numerical analysis it is the starting point for more advanced methods such as spline interpolation. A quadratic equation calculator often sits next to it in the same workflow, because the two answers answer different halves of the same question.
In lab work, it fills in a missing reading: if a sensor dropped one sample, the polynomial through the neighbouring readings gives a sensible estimate of what it would have been.
It also helps to keep the units consistent from the first number to the last. Mixing units — metres with centimetres, degrees with radians, seconds with minutes — is the quietest way to get an answer that looks plausible and is wrong by a large factor. Write the unit next to every number you enter, and check the result's unit against the unit you expect before you use the answer anywhere else.
Lagrange Interpolation Calculator vs Linear Interpolation Calculator
Linear interpolation uses only the two nearest points and draws a straight line between them. Lagrange interpolation uses all your points at once and draws the polynomial through all of them, so it can follow a curve where the straight line cuts across it.
Use the straight line when you have only two points, or when the points are close together and the relationship is nearly straight. Use Lagrange when you have three or more points and the pattern clearly bends. The scientific calculator covers the other side of the same problem, so the two tools complement each other rather than compete.
The extra power has a price: the Lagrange polynomial can swing between points and blow up outside the range, while the straight line stays calm. For noisy data, the straight line between near neighbours is often the safer estimate.
Common mistakes with the Lagrange Interpolation Calculator
The first mistake is evaluating far outside the points. A polynomial that fits nicely between x = 0 and x = 2 can be wildly wrong at x = 10, because high-degree polynomials grow fast. Stay inside the range of your points.
The second mistake is using too many points. Six points give a degree-5 polynomial that can wiggle between the points even when the data is smooth, so more points do not always mean a better answer. Use the fewest points that capture the shape.
The third mistake is feeding in a repeated x value, or lists of different lengths. The calculator shows dashes in that case, and the fix is to check the counts and the x values, not to keep pressing buttons.
A last mistake is trusting the first answer without a rough check. Before you accept a result, estimate it by hand to one significant figure: if the calculator says 400 and your rough estimate says 40, something is off — usually a misplaced decimal point or a wrong unit. The calculator does the arithmetic; the judgement about whether the answer makes sense still belongs to you.
How to use this Lagrange Interpolation Calculator
Open the page and enter the x and y values of your points, two to six of them, and the x you want to evaluate at. Enter two to six points with distinct x values, then the x to evaluate at. A column copied from a spreadsheet works as it is.
Read the interpolated y as the value of the unique polynomial through your points at your x, and read the degree as one less than the number of points. If the degree is 1, you have two points and the answer is the same as a straight-line interpolation; the power of this tool shows with three or more points.
Everything runs in your browser. No account, no upload, no data sent anywhere — your numbers never leave your device. If a result looks wrong, re-check the inputs first: a single mistyped number is the usual cause, and a linear equation calculator will confirm the arithmetic.