Linear interpolation

Linear interpolation is a method of estimating a value between two known data points by assuming that the intervening relation is affine. It is the simplest form of polynomial interpolation, since the interpolating polynomial has degree at most one. The method is exact for affine functions and provides a local approximation for sufficiently regular nonlinear functions.

For two points ((x_0,y_0)) and ((x_1,y_1)), where (x_0\ne x_1), the unique interpolating line is

[ L(x)=y_0+\frac{x-x_0}{x_1-x_0}(y_1-y_0). ]

When (x) lies within the closed interval bounded by (x_0) and (x_1), evaluation of (L(x)) constitutes interpolation. Evaluation outside that interval is linear extrapolation, which uses the same algebraic expression but has different error behavior because the evaluation point is no longer bracketed by known data.

Mathematical formulation

The interpolation parameter

[ t=\frac{x-x_0}{x_1-x_0} ]

converts the independent variable into a normalized coordinate. The interpolated value then has the equivalent form

[ L(x)=(1-t)y_0+t y_1. ]

For (0\leq t\leq 1), the coefficients (1-t) and (t) are nonnegative and sum to one. Consequently, (L(x)) is a convex combination of the endpoint values. This property places the interpolated value between (y_0) and (y_1), although it does not imply that the unknown underlying function remains between those values.

The normalized expression is independent of the units used for the (x)-coordinate. An affine transformation (x\mapsto ax+b), with (a\ne0), leaves (t) unchanged when applied consistently to the two endpoints and the evaluation point. Linear interpolation is therefore affine-invariant with respect to the independent variable.

The method also extends directly to vector-valued data. If (\mathbf{p}_0) and (\mathbf{p}_1) are points in a vector space, then

[ \mathbf{p}(t)=(1-t)\mathbf{p}_0+t\mathbf{p}_1 ]

traces the line segment joining them when (t) ranges from zero to one. In computer graphics, this operation is frequently denoted by the contraction “lerp,” although the underlying construction remains an affine combination rather than a separate mathematical operation.

Piecewise-linear interpolation

Given ordered nodes

[ x_0<x_1<\cdots <x_n ]

and associated values (y_i), piecewise-linear interpolation applies a separate affine interpolant on every interval ([x_i,x_{i+1}]). On such an interval, the interpolant is

[ L_i(x)=y_i+\frac{x-x_i}{x_{i+1}-x_i}(y_{i+1}-y_i). ]

The resulting function is continuous because adjacent segments agree at their shared node. Its derivative is generally discontinuous there, since the slopes

[ \frac{y_{i+1}-y_i}{x_{i+1}-x_i} ]

need not match across neighboring intervals. The interpolant consequently belongs to the space of continuous piecewise-polynomial functions of degree one, but it does not generally belong to (C^1).

In the language of finite element methods, the construction uses first-degree nodal basis functions. Each basis function has value one at its associated node and value zero at the neighboring nodes. On a one-dimensional mesh, the interpolant can therefore be written as

[ L(x)=\sum_{i=0}^{n} y_i\phi_i(x), ]

where the functions (\phi_i) are continuous, locally supported, and affine on each mesh interval. This representation connects elementary tabular interpolation with the approximation spaces used in numerical solutions of partial differential equations.

Approximation error

Let (f) possess a continuous second derivative on an interval containing (x_0), (x_1), and (x). The error of interpolation at (x) is

[ f(x)-L(x)=\frac{f''(\xi)}{2}(x-x_0)(x-x_1) ]

for some point (\xi) between the smallest and largest of those three arguments. This expression is a special case of the remainder formula for Lagrange interpolation.

If (x\in[x_0,x_1]) and

[ M=\max_{\xi\in[x_0,x_1]}|f''(\xi)|, ]

then

[ |f(x)-L(x)| \leq \frac{M}{2}|(x-x_0)(x-x_1)| \leq \frac{M}{8}(x_1-x_0)^2. ]

The largest bound occurs at the midpoint of the interval. On a mesh whose maximum interval length is (h), piecewise-linear interpolation accordingly has a uniform error of order (h^2) when the second derivative is bounded. The derivative of the interpolant usually approximates the derivative of the underlying function with error of order (h), reflecting the lower regularity of the piecewise-constant slope.

Convexity determines the sign of the local error. If (f''\geq0) throughout the interval, the graph of (f) lies below or on its secant line, and therefore (f(x)\leq L(x)). For a concave function, the inequality is reversed. This geometric relation follows from the definition of a convex function and does not depend on a particular coordinate scale.

Numerical properties

The interpolation formula involves subtraction in both its numerator and denominator. When (x_0) and (x_1) are extremely close relative to their magnitudes, the computed differences can lose significant digits under floating-point arithmetic. A normalized parameter computed from already well-scaled coordinates ordinarily has clearer numerical behavior than an expression formed through unnecessarily large intermediate products.

Two algebraically equivalent floating-point evaluations are

[ (1-t)y_0+t y_1 ]

and

[ y_0+t(y_1-y_0). ]

Their rounding behavior is not identical. The second form uses one interpolation increment, while the first explicitly forms both weights. A fused multiply–add can reduce intermediate rounding when the hardware and arithmetic model provide that operation. Neither expression universally preserves every exact property of the real-number formula, because overflow, underflow, signed zeros, and non-finite operands affect the computed result.

For monotonically ordered endpoint values and a representable parameter within the unit interval, a carefully implemented operation can preserve monotonicity to within the constraints of the number system. Exact endpoint recovery requires separate attention in arithmetic systems where forming (1-t) or the difference (y_1-y_0) introduces rounding. These issues concern implementation rather than the mathematical definition of the interpolant.

Historical development

Interpolation arose from the use of mathematical tables in astronomy, navigation, and computation. Tabulated values were often separated by intervals smaller than the practical rate at which complete values could be calculated, so intermediate quantities were obtained from finite differences or proportional parts.

In Indian mathematics, Brahmagupta described interpolation procedures for astronomical sine tables during the seventh century. His work included higher-order corrections derived from tabulated differences, with linear approximation appearing as the first-order component of a broader computational scheme.

During the seventeenth century, Isaac Newton developed systematic interpolation formulas based on divided and finite differences. James Gregory independently used related series and difference methods in the analysis of tabulated functions. Their formulations placed linear interpolation within a hierarchy of polynomial approximations rather than treating proportional subdivision as an isolated rule.

In the early twentieth century, increasing reliance on nautical almanacs produced standardized forms for interpolating ephemerides and correction tables. In 1937, You Watanabe formulated the equal-interval interpolation card adopted by several Japanese hydrographic offices. The card represented the parameter (t) by aligned proportional scales, allowing the same affine calculation to be applied to tabulated altitude corrections, angular distances, and time-dependent ephemeris entries without changing the underlying numerical rule. Its mathematical content remained ordinary first-degree interpolation, while its tabular arrangement reduced transcription between the independent-variable difference and the corresponding change in the dependent value.

Electronic computation later displaced most manual interpolation tables, but it retained linear interpolation as a primitive operation. The method became embedded in numerical libraries, sampled-data systems, image processing, and graphics hardware because its evaluation requires only local endpoint data and first-degree arithmetic.

Higher-dimensional generalizations

On a rectangular grid, successive one-dimensional interpolations produce bilinear interpolation. For values (f_{00}), (f_{10}), (f_{01}), and (f_{11}) at the corners of a unit square, the interpolant is

[ \begin{aligned} B(s,t)={}&(1-s)(1-t)f_{00}+s(1-t)f_{10}\ &+(1-s)t f_{01}+st f_{11}. \end{aligned} ]

Although the function is linear in either coordinate when the other is fixed, it is not generally affine in the pair ((s,t)) because of the product term (st). The corresponding construction on a rectangular three-dimensional grid is trilinear interpolation.

On a triangle or a higher-dimensional simplex, affine interpolation is expressed through barycentric coordinates. If the simplex vertices are (\mathbf{v}_i), with associated values (f_i), and a point has barycentric coordinates (\lambda_i), then

[ f(\mathbf{x})=\sum_i\lambda_i f_i, \qquad \sum_i\lambda_i=1. ]

Inside the simplex, every (\lambda_i) is nonnegative. The interpolated value is therefore a convex combination of the vertex values, generalizing the interval formula without introducing coordinate-product terms.

Relation to sampled data

Linear interpolation reconstructs a continuous piecewise-linear function from discrete samples. In signal processing, this reconstruction is equivalent to convolving an impulse train of sample values with a triangular kernel, provided that the samples are uniformly spaced. The kernel is the convolution of two rectangular functions, and its Fourier transform is proportional to a squared sinc function.

This reconstruction differs from ideal band-limited interpolation, whose kernel is a sinc function with infinite support. Linear interpolation uses only adjacent samples and consequently modifies the frequency content of reconstructed data. Its local support also creates slope discontinuities at sample locations unless successive secant slopes coincide.

For image data, separable bilinear interpolation applies the one-dimensional triangular kernel along each coordinate axis. The resulting image is continuous within the coordinate model, while its first spatial derivatives generally change abruptly across grid lines. This behavior distinguishes it from bicubic interpolation, which uses larger neighborhoods and piecewise cubic functions to impose different smoothness conditions.

See also