Skip to content
CALX
Appearance

Appearance

Light or dark

Colour
Accessibility

Linear interpolation calculator

y from x or x from y between two points, with slope, y-intercept, line equation and extrapolation alert.

Parameters

Result

Awaiting the quantities required for the calculation.

Calculation, assumptions and sources

OverviewTwo points (x1, y1) and (x2, y2) give y for a given x, or x for a given y, assuming a linear relationship between the two quantities.

Two points (x1, y1) and (x2, y2) give y for a given x, or x for a given y, assuming a linear relationship between the two quantities. The calculation gives the slope, the y-intercept and the line equation, and flags an extrapolation when the sought value falls outside the interval of the two points.

Method & formulasm = (y2 − y1) / (x2 − x1)
m = (y2 − y1) / (x2 − x1)b = y1 − m × x1y = m × x + bx = x1 + (y − y1) × (x2 − x1) / (y2 − y1)

Two points (x1, y1) and (x2, y2) define a unique line, y = m×x + b, which its inverted form solves for x.

Interpolation
estimation of y (or x) for a value between x1 and x2 (or between y1 and y2), within the observed interval.
Extrapolation
estimation outside this interval, which assumes the linear relationship extends beyond the measured points.
Slope (m)
change in y for a one-unit change in x; negative if y decreases when x increases.
Y-intercept (b)
value of y at x = 0 on the extended line, not necessarily observed.
Validity domainThe calculation assumes a linear relationship over the whole interval considered.

The calculation assumes a linear relationship over the whole interval considered. It is undefined when the two x-values are equal (no slope) and, in the inverse direction, when the two y-values are equal (a horizontal line gives no x).