Reading between two values
Tables and charts give values only at certain points: water density at 20 °C and 30 °C, a tax bracket at two incomes, a sensor reading every hour. Linear interpolation estimates the value in between by assuming it changes along a straight line from one known point to the next. It is the simplest and most widely used way to fill such gaps.
The formula
y = y₁ + (x − x₁) × (y₂ − y₁) ÷ (x₂ − x₁)
- (x₁, y₁) and (x₂, y₂) are the two known points,
- x is the value where you want y,
- (y₂ − y₁) ÷ (x₂ − x₁) is the slope of the line between the points.
The calculator also shows where x falls between x₁ and x₂ as a percentage, and the equation of the line through the two points.
Worked example
A table gives the density of water as 0.9982 g/cm³ at 20 °C and 0.9957 g/cm³ at 30 °C. What is it at 25 °C?
- Slope = (0.9957 − 0.9982) ÷ (30 − 20) = −0.00025 per °C.
- y = 0.9982 + (25 − 20) × (−0.00025) = 0.99695 g/cm³.
- 25 °C is 50% of the way from 20 to 30 °C, so the result is exactly halfway between the two densities.
The measured value at 25 °C is 0.99705 g/cm³: the interpolation is off by only 0.01%.
Interpolation versus extrapolation
| Situation | Name | Reliability |
|---|---|---|
| x between x₁ and x₂ | interpolation | good if the curve is smooth |
| x outside the two points | extrapolation | risky: the trend may change |
The calculator warns you when x falls outside the interval, since extending a straight line too far can give misleading results.
When to be careful
Linear interpolation assumes a straight line, so its error grows with the curvature of the real relationship and with the distance between the points. Interpolating the area of a circle between r = 1 and r = 3 to estimate r = 2 gives 5π instead of the true 4π, an error of 25%. Using closer points reduces the error quickly.
Common uses
- Engineering tables: steam tables, material properties, pipe friction factors.
- Finance: estimating an interest rate between two published maturities on a yield curve.
- Science: reading a calibration curve between two standards.
- Everyday life: estimating the fuel left between two gauge marks, or the temperature at noon from readings at 9 am and 3 pm.
Two-step interpolation
For a table with two inputs, such as a property that depends on temperature and pressure, interpolate along one input first, then along the other. This is called bilinear interpolation and uses the same formula three times.