Lably
Skip to content

Linear interpolation

Method of curve fitting

  • 5 min read
  • 6 chapters

Related on Lably

Through Linear function (calculus), Continuous function and Function (mathematics)

Linear interpolation between two known points

If the two known points are given by the coordinates (x0,y0) and (x1,y1), the linear interpolant is the straight line between these points. For a value x in the interval (x0,x1), the value y along the straight line is given from the equation of slopes y−y0x−x0=y1−y0x1−x0, which can be derived geometrically from the figure on the right. It is a special case of polynomial interpolation with n=1.

Solving this equation for y, which is the unknown value at x, gives y=y0+(x−x0)y1−y0x1−x0=y0(x1−x0)x1−x0+y1(x−x0)−y0(x−x0)x1−x0=y1x−y1x0−y0x+y0x0+y0x1−y0x0x1−x0=y0(x1−x)+y1(x−x0)x1−x0, which is the formula for linear interpolation in the interval (x0,x1). Outside this interval, the formula is identical to linear extrapolation.

This formula can also be understood as a weighted average. The weights are inversely related to the distance from the end points to the unknown point; the closer point has more influence than the farther point. Thus, the weights are 1−(x−x0)/(x1−x0) and 1−(x1−x)/(x1−x0), which are normalized distances between the unknown point and each of the end points. Because these sum to 1, y=y0(1−x−x0x1−x0)+y1(1−x1−xx1−x0)=y0(1−x−x0x1−x0)+y1(x−x0x1−x0)=y0(x1−xx1−x0)+y1(x−x0x1−x0) yielding the formula for linear interpolation given above.

Sign in to keep reading

5 more chapters are free with a Lably account.

More in Topics in mathematics