What Is Linear Interpolation?

Linear interpolation is the process of determining a value that lies on a straight line between two established points. Suppose you measure a physical quantity at two distinct locations or times and want to estimate what happens in between. If the relationship follows a linear pattern, interpolation gives you that estimate.

Consider a practical example: a thermometer reads 15°C at 9 am and 21°C at 3 pm. Assuming steady temperature change, you can calculate the temperature at noon. This is interpolation—finding values within a tested range.

When you extend the line beyond the known range (predicting temperature at 8 pm, for instance), that operation is called extrapolation. Extrapolation carries greater uncertainty because you're assuming the linear trend continues unchanged outside your observed data.

The Linear Interpolation Equation

The core formula estimates an unknown y-coordinate given two reference points and an x-coordinate. Rearranging the slope formula yields:

y = (x − x₁) × (y₂ − y₁) / (x₂ − x₁) + y₁

slope (m) = (y₂ − y₁) / (x₂ − x₁)

intercept (b) = y₁ − m × x₁

  • x₁, y₁ — Coordinates of the first known point
  • x₂, y₂ — Coordinates of the second known point
  • x, y — Coordinates of the point you wish to find
  • m — Slope of the line (rise over run)
  • b — Y-intercept (where the line crosses the y-axis)

How to Apply the Interpolation Formula

To find a missing value, follow these steps:

  1. Identify your two known points. Record them as (x₁, y₁) and (x₂, y₂). Ensure x₁ ≠ x₂ to avoid division by zero.
  2. Choose the x-coordinate of your target point. Call it x. Verify it lies between x₁ and x₂ for true interpolation.
  3. Substitute into the formula. Calculate the difference quotients and apply the formula step-by-step.
  4. Interpret the result. Check whether the answer is reasonable—it should fall between y₁ and y₂.

Worked example: Given points (200, 15) and (300, 20), find y when x = 250.

y = (250 − 200) × (20 − 15) / (300 − 200) + 15
y = 50 × 5 / 100 + 15
y = 17.5

Common Pitfalls and Best Practices

Avoid these frequent mistakes when using linear interpolation:

  1. Verify the linearity assumption — Linear interpolation only works if the relationship between variables is truly linear. If your data follows a curved trend or has non-linear behaviour, the interpolated value will be inaccurate. Always plot your points mentally or visually to check.
  2. Watch your boundaries — Confirm that your target x-value falls strictly between x₁ and x₂. Going beyond this range switches from interpolation to extrapolation, which is less reliable. Extrapolated values should only be trusted if you have strong confidence the trend continues.
  3. Ensure x₁ ≠ x₂ — The formula requires division by (x₂ − x₁). If both points share the same x-coordinate, the slope is undefined and the calculation fails. Always use two distinct points on different positions along the x-axis.
  4. Round appropriately for context — Consider the precision of your original data when rounding results. Reporting 17.5 cookies makes sense; reporting 17.53847 cookies does not. Match significant figures to your measurement accuracy.

Interpolation vs. Extrapolation

Interpolation estimates values within the range of your data. It is generally reliable because you're working between observed points where the linear assumption is least likely to fail.

Extrapolation extends the line beyond your data range. It assumes the trend continues indefinitely, which often breaks down in real-world systems. Temperature might follow a linear pattern from 9 am to 3 pm, but that doesn't mean it continues rising at the same rate at midnight.

Whenever possible, gather actual data instead of extrapolating far from your measurements. If you must extrapolate, use it for short-range predictions only and acknowledge the increased uncertainty in your findings.

Frequently Asked Questions

When should I use linear interpolation instead of other methods?

Linear interpolation works best when you have two reliable data points and the relationship between variables is genuinely linear. It's quick, intuitive, and requires minimal computation. Use it for preliminary estimates or when assuming a straight-line relationship is justified by physics, theory, or prior observation. For curved relationships or when you have many data points, polynomial interpolation or regression analysis may be superior.

Can linear interpolation work with negative coordinates?

Yes, entirely. The formula handles negative x- and y-values without modification. For example, if your points are (−10, 5) and (10, 15) and you want y at x = 0, you substitute normally: y = (0 − (−10)) × (15 − 5) / (10 − (−10)) + 5 = 10. Negative coordinates are common in physics, engineering, and finance, so the method remains robust.

What's the difference between slope and intercept?

The <strong>slope</strong> (m) measures how steeply the line rises or falls. It equals the change in y divided by the change in x. The <strong>intercept</strong> (b) is the y-value where the line crosses the y-axis (where x = 0). Together, they define the line's equation: y = mx + b. Knowing both lets you predict y for any x-value, whether inside or outside your original data range.

How accurate is linear interpolation?

Accuracy depends entirely on whether your underlying relationship is linear. If it is, interpolation within your data range is typically accurate to within a small error determined by measurement precision. However, if the true relationship is curved, linear interpolation introduces systematic error proportional to how far the curve deviates from the straight line. Always validate your assumption with additional measurements when possible.

Can I use linear interpolation with more than two data points?

Linear interpolation classically uses two points to estimate one unknown value. If you have three or more points, you could fit a linear regression line through all of them and then interpolate, which reduces random measurement error. Alternatively, you might use all available points to verify linearity before trusting a two-point interpolation.

What happens if my two points are very close together?

Points that are very close can amplify measurement noise when you calculate the slope. Small errors in either point's coordinates get magnified as you divide by a tiny denominator (x₂ − x₁). For best results, choose points that are well-separated along the x-axis so the slope calculation is robust to minor measurement imprecision.

More math calculators (see all)