How it’s calculated
Linear interpolation estimates a value between two known points by assuming the data follows a straight line between them. The same line also gives an estimate beyond the points (extrapolation), which is less reliable the further you go.
Example: the points (1, 10) and (5, 30) and x = 3. The slope is (30 − 10) ÷ (5 − 1) = 5, so y = 10 + (3 − 1) × 5 = 20. Going the other way, y = 25 gives x = 1 + (25 − 10) × 4 ÷ 20 = 4.
This is the n = 1 case of Lagrange interpolation. If your table has more than two points, use the polynomial interpolation calculator, which also has a table-lookup mode.
Frequently asked questions
What is the linear interpolation formula?
y = y₁ + (x − x₁)(y₂ − y₁)/(x₂ − x₁). It finds the point on the straight line through (x₁, y₁) and (x₂, y₂) at the given x.
What is the difference between interpolation and extrapolation?
Interpolation finds a value between the known points. Extrapolation extends the line beyond them, which assumes the straight-line trend continues and is usually less accurate.
Why do I get an error when x₁ equals x₂?
The slope would need a division by zero. Two points with the same x lie on a vertical line, so y is not a function of x there.
Can I interpolate a table of more than two rows?
Pick the two rows on either side of your x and enter them here, or use the polynomial interpolation calculator in table-lookup mode, which does that for you.
Embed this calculator
Add this free calculator to your own website. Copy the code below into your page’s HTML:
Need this calculator branded, changed or built around your own prices?See custom business solutions →
Sources
- NIST Digital Library of Mathematical Functions, §3.3 Interpolation (Lagrange interpolation, linear case) — NIST
- College Algebra 2e, §4.1 Linear Functions (slope and the equation of a line) — OpenStax
Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.
Added · Last updated · How we check our calculators
Spotted a mistake or missing option? Report a problem· Suggest a calculator