How this calculation works
Substitute all three x-values into the recovered polynomial to verify the fit. Coincident x-values do not uniquely determine the coefficients.
Use divided differences to interpolate a polynomial of degree at most twoA worked example
(0,1), (1,4), (2,9) lie on x²+2x+1.
Good to know
If the points are collinear, the quadratic coefficient is zero.
Reference: OpenStax Algebra and Trigonometry (opens in a new tab) ↗
Use divided differences to recover the coefficients
The default points are (0,1), (1,4) and (2,9). The first two-point slope is (4 − 1)/(1 − 0) = 3, and the second is (9 − 4)/(2 − 1) = 5. Their difference divided by the full x span gives the quadratic coefficient a = (5 − 3)/(2 − 0) = 1.
Next b = 3 − 1 × (0 + 1) = 2. Substituting the first point gives c = 1. The resulting polynomial is x² + 2x + 1. Evaluating it at x = 0, 1 and 2 returns exactly 1, 4 and 9, checking all three observations.
Separate interpolation from evidence about a wider trend
Three distinct x-coordinates determine a unique polynomial of degree at most two. Collinear points give a = 0 and therefore a linear polynomial. Repeated x-coordinates are rejected because the divided differences would divide by zero and the three inputs would fail the distinct-x requirement.
Interpolation exactly fits the supplied points. Additional measurements can still lie away from the fitted curve, particularly when the observations contain error or the relationship changes outside the measured interval. The Quadratic finite difference extrapolation calculator makes a similar degree-two assumption for equally spaced sequence terms. When x-coordinates are very close, small measurement changes can substantially alter the fitted coefficients.
A few questions, answered
Must the x values be equally spaced?
No. Divided differences work with arbitrary distinct x-coordinates. The equal spacing in the default example only simplifies the arithmetic.
How can I check the output?
Compute ax² + bx + c at each entered x-coordinate and compare it with the corresponding supplied y value.