On this page
Given three points, the classroom method is to assume y = ax² + bx + c and solve three equations. With four or five points that algebra grows fast. Lagrange interpolation writes the answer down directly, and the idea behind it, uniqueness, cracks a famous olympiad problem in four lines.
How do you find a polynomial through given points?
The Lagrange interpolating polynomial is the unique polynomial of lowest degree that passes through a given set of points (Wikipedia: Lagrange polynomial). If you have n + 1 points with different x values, that polynomial has degree at most n.
For each point, build a small polynomial that is 1 at that point's x and 0 at every other given x. Multiply each by its y value and add. For points (x₀, y₀), (x₁, y₁), ..., (xₙ, yₙ):
Lᵢ(x) is the product of (x − xⱼ)/(xᵢ − xⱼ) over every j that is not i.
P(x) = y₀L₀(x) + y₁L₁(x) + ... + yₙLₙ(x).
The denominator is the numerator evaluated at xᵢ, so Lᵢ(xᵢ) = 1.
What is the parabola through (0, 1), (1, 3) and (2, 7)?
L₀(x) = (x − 1)(x − 2) / ((0 − 1)(0 − 2)) = (x − 1)(x − 2)/2.
L₁(x) = (x − 0)(x − 2) / ((1 − 0)(1 − 2)) = −x(x − 2).
L₂(x) = (x − 0)(x − 1) / ((2 − 0)(2 − 1)) = x(x − 1)/2.
P(x) = 1·L₀ + 3·L₁ + 7·L₂ = (x² − 3x + 2)/2 − 3x² + 6x + (7x² − 7x)/2.
Collect terms: P(x) = x² + x + 1.
Check: P(0) = 1, P(1) = 3, P(2) = 7. If you only need one new value, say P(5), put x = 5 into each Lᵢ and skip the expansion. (Rusty on that step? See finding the value of a polynomial at a point.)
Why is the polynomial through n + 1 points unique?
Suppose P and Q both have degree at most n and agree at n + 1 points. Then P − Q has degree at most n but n + 1 roots, which only the zero polynomial can have. So P = Q. Wolfram MathWorld states the same result: the Lagrange formula gives the unique polynomial of degree at most n − 1 through n points (MathWorld: Lagrange Interpolating Polynomial).
This is what exam problems really test: a polynomial of degree n + 1 that is zero at n + 1 given points is a constant times the product of the factors (x − xᵢ).
What is P(n + 1) if P(k) = k/(k + 1)?
This is Problem 3 of the 1975 USA Mathematical Olympiad: a polynomial P of degree n has P(k) = k/(k + 1) for k = 0, 1, ..., n; find P(n + 1) (USAMO 1975 Problem 3, Kalva archive). Lagrange's formula would be painful here; use uniqueness.
Clear the fraction. Let Q(x) = (x + 1)P(x) − x. Q has degree n + 1.
Find its roots. For k = 0, 1, ..., n, Q(k) = (k + 1)·k/(k + 1) − k = 0. That is n + 1 roots, so Q(x) = c·x(x − 1)(x − 2)...(x − n) for some constant c.
Find c. At x = −1, Q(−1) = 0 − (−1) = 1. The product gives (−1)(−2)...(−1 − n) = (−1)ⁿ⁺¹(n + 1)!, so c = (−1)ⁿ⁺¹/(n + 1)!.
Evaluate at n + 1. The product becomes (n + 1)!, so Q(n + 1) = (−1)ⁿ⁺¹. That means (n + 2)P(n + 1) − (n + 1) = (−1)ⁿ⁺¹.
So P(n + 1) = 1 when n is odd and n/(n + 2) when n is even. Sanity check: for n = 1, P(x) = x/2 and P(2) = 1.
When should you use Lagrange, and when something else?
Two or three points, coefficients wanted: solve the equations.
One new value wanted: Lagrange's formula, unexpanded.
P(k) follows a formula at many integers: an auxiliary polynomial, as above.
A factor or remainder wanted: the factor theorem and polynomial long division, or the rational root theorem for integer polynomials.
The name is a historical accident: Edward Waring published the method in 1779 (Waring, "Problems concerning interpolations", doi:10.1098/rstl.1779.0008), and Lagrange published it in 1795 (Wikipedia: Lagrange polynomial). The same source notes its use in Shamir's secret sharing and Reed–Solomon error correction, and warns that with many equally spaced points the curve can swing wildly near the ends (Runge's phenomenon).
To practise, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer. If the factor theorem feels shaky, the Fermi Concept Library gives each mathematics concept its own lesson.
Next time three points turn up, write the three Lᵢ first and solve equations only if you must.



