Algebra
Interpolation from the slope
Walk along the line from the first point using the slope between the two known points.
Last updated
The Formula
y = y1 + (x - x1) x (y2 - y1) / (x2 - x1)
Walk along the line from the first point using the slope between the two known points.
| Symbol | Meaning | Unit | Notes |
|---|---|---|---|
| y | Interpolated value | same as y1 | The value at the target input. |
| x | Target input | same as x1 | The input you want a value for. |
| x1, y1 | Lower point | same as inputs | The known point below the target. |
| x2, y2 | Upper point | same as inputs | The known point above the target. |
What Each Symbol Means
ysame as y1
Interpolated value
The value at the target input.
xsame as x1
Target input
The input you want a value for.
x1, y1same as inputs
Lower point
The known point below the target.
x2, y2same as inputs
Upper point
The known point above the target.
See It Worked With Real Numbers
A formula on its own does not tell you which number goes where. The how to calculate linear interpolation page applies this equation to a concrete case, shows every intermediate step, and names the mistakes that produce a wrong answer even when the algebra is right.
Where This Formula Appears
This equation is the working core of How To Calculate Linear Interpolation, filed under Math. Every number the guide produces comes from substituting into this one line.
Common Questions
What is the formula for Interpolation from the slope?
The formula for Interpolation from the slope is y = y1 + (x - x1) x (y2 - y1) / (x2 - x1). Walk along the line from the first point using the slope between the two known points.
What does each symbol in Interpolation from the slope stand for?
y is interpolated value; x is target input; x1, y1 is lower point; x2, y2 is upper point.
What units should I use with Interpolation from the slope?
Substitute y in same as y1, x in same as x1, x1, y1 in same as inputs, x2, y2 in same as inputs. Convert every input to those units before you start, because the equation only returns the right answer when the units on both sides agree.
What is a common mistake when using Interpolation from the slope?
Interpolating outside the two known points. That is extrapolation, not interpolation. The straight line has no support beyond the data, and errors grow quickly the further you go.