Linear Interpolation Formula: Worked Examples (and Newton's Divided Differences)
You know a value at 10 and at 20, and you need it at 14. Linear interpolation draws a straight line between the two known points and reads off the value in between — simple, fast, and often surprisingly accurate. This guide shows the formula, three worked examples, where the straight line misleads you, and the next method up when it does.
Key takeaways
- Linear interpolation formula: y = y₁ + (x − x₁) × (y₂ − y₁)/(x₂ − x₁). It assumes the function is straight between the two known points.
- Accuracy depends on curvature: interpolation is excellent for nearly-straight segments and poor across bends — halve the interval and the error roughly quarters.
- Newton’s divided differences extend the idea to curves: with three or more points, fit a parabola (or higher curve) instead of a line, and the error drops sharply.
The formula
Given two known points (x₁, y₁) and (x₂, y₂), the value at any x between them is found by travelling the same fraction along y as you travel along x. The fraction is (x − x₁)/(x₂ − x₁); the interpolated value is:
y = y₁ + (x − x₁) × (y₂ − y₁) / (x₂ − x₁)
The term (y₂ − y₁)/(x₂ − x₁) is the slope of the line between the points, so the formula is just point-slope form with the segment’s slope. That is the whole method — there is no hidden step. The interpolation calculator on this page evaluates it for any two points and any x between them.
Worked examples
Example 1 — temperature. A table gives water density 999.7 kg/m³ at 10°C and 998.2 kg/m³ at 20°C. Estimate at 14°C: y = 999.7 + (14 − 10) × (998.2 − 999.7)/(20 − 10) = 999.7 + 4 × (−0.15) = 999.7 − 0.6 = 999.1 kg/m³. The true value is about 999.1 — density is nearly linear over this range, so interpolation is nearly exact.
Example 2 — a missing table value. A tax table gives tax of $4,200 at $40,000 income and $5,800 at $50,000. Estimate at $47,000: y = 4200 + (7000) × (1600)/(10000) = 4200 + 1120 = $5,320. This is an estimate, not a tax computation — real tax tables have brackets and rounding, and interpolation across a bracket boundary can mislead.
Example 3 — backwards (inverse interpolation). Given the same temperature table, at what temperature is density 999.0? Solve the formula for x: x = x₁ + (y − y₁) × (x₂ − x₁)/(y₂ − y₁) = 10 + (999.0 − 999.7) × 10/(−1.5) = 10 + 4.67 ≈ 14.7°C. Inverse interpolation swaps the roles of x and y and is just as mechanical.
How wrong can it be?
Linear interpolation is exact for straight lines and approximate for everything else. The error at a point between x₁ and x₂ is bounded by (M/8) × (x₂ − x₁)², where M is the largest magnitude of the function’s second derivative on the interval — a measure of curvature. Two consequences: halving the interval quarters the error (the squared term), and interpolating across a sharp bend is far worse than interpolating along a gentle curve.
Practical rules: interpolate only between neighbouring table entries, never across a wide gap; distrust interpolation near kinks, thresholds, or phase changes; and never extrapolate — extending the line beyond the known points is a different, much riskier operation, because nothing guarantees the function keeps going straight. A straight line through the last two points of a curve is a guess about the future dressed as arithmetic.
Newton's divided differences: the upgrade
With three points, you can fit a parabola instead of a line, and with n points a polynomial of degree n − 1. Newton’s divided-difference form builds that polynomial incrementally: start with the constant through the first point, add a linear correction through the second, a quadratic correction through the third, and so on. Each divided difference is a slope of slopes: f[x₀, x₁] = (f₁ − f₀)/(x₁ − x₀), and f[x₀, x₁, x₂] = (f[x₁, x₂] − f[x₀, x₁])/(x₂ − x₀).
Example: points (0, 1), (1, 3), (2, 9). First differences: f[0,1] = 2, f[1,2] = 6. Second difference: f[0,1,2] = (6 − 2)/(2 − 0) = 2. Polynomial: P(x) = 1 + 2x + 2x(x − 1) = 2x² + 1. Check: P(0) = 1, P(1) = 3, P(2) = 9. Estimate at x = 1.5: P(1.5) = 2 × 2.25 + 1 = 5.5. Linear interpolation between (1, 3) and (2, 9) would give 6 — the parabola’s 5.5 is the better estimate whenever the underlying function curves, which most do.
Where interpolation actually gets used
Engineering tables (steam tables, material properties, fluid densities) were built for interpolation — generations of engineers read between the lines daily. Surveying and geodesy interpolate elevations between contour lines. Finance interpolates yield curves between quoted maturities. Computer graphics interpolates colours and positions between keyframes — every smooth animation is interpolation running thousands of times a second. And in statistics, interpolating a z-table or t-table between printed values is the classic student use: a z-score of 1.47 falls between the table’s 1.4 and 1.5 rows, and linear interpolation gives a serviceable tail probability.
The common thread: interpolation is what you do when the table is authoritative and the function between entries is smooth. When either condition fails — a table with jumps, or a function with a kink — interpolation is the wrong tool, and the honest answer is to measure more points or model the function properly.
Frequently asked questions
What is the linear interpolation formula?
y = y₁ + (x − x₁) × (y₂ − y₁)/(x₂ − x₁). It finds the value on the straight line between two known points (x₁, y₁) and (x₂, y₂) at any x between them.
When is linear interpolation accurate?
When the function is nearly straight between the two points, or the interval is small. Error grows with curvature and with the square of the interval width, so halving the interval roughly quarters the error.
What is the difference between interpolation and extrapolation?
Interpolation estimates between known points; extrapolation extends beyond them. Interpolation is bounded by the table’s accuracy; extrapolation assumes the trend continues, which it often does not.
How does Newton's divided-difference method improve on linear interpolation?
It uses three or more points to fit a curve (parabola, cubic, and so on) instead of a line, which captures curvature and sharply reduces error for smooth functions.
Can I interpolate backwards to find x from y?
Yes — inverse interpolation swaps x and y in the formula: x = x₁ + (y − y₁) × (x₂ − x₁)/(y₂ − y₁). It works when the function is monotonic (one-to-one) on the interval.
Why do tables still matter if calculators exist?
Because many real quantities (material properties, tax tables, statistical distributions) are defined by measured or tabulated values, not by formulas. Interpolation is how you use a table at values the table does not list.
Interpolate any value between two points
Run your own numbers instead of guessing from someone else’s example.
