In
mathematics
Mathematics is a field of study that discovers and organizes methods, Mathematical theory, theories and theorems that are developed and Mathematical proof, proved for the needs of empirical sciences and mathematics itself. There are many ar ...
, bilinear interpolation is a method for
interpolating functions of two variables (e.g., ''x'' and ''y'') using repeated
linear interpolation
In mathematics, linear interpolation is a method of curve fitting using linear polynomials to construct new data points within the range of a discrete set of known data points.
Linear interpolation between two known points
If the two known po ...
. It is usually applied to functions sampled on a 2D
rectilinear grid, though it can be generalized to functions defined on the vertices of (a
mesh of) arbitrary
convex quadrilateral
In Euclidean geometry, geometry a quadrilateral is a four-sided polygon, having four Edge (geometry), edges (sides) and four Vertex (geometry), corners (vertices). The word is derived from the Latin words ''quadri'', a variant of four, and ''l ...
s.
Bilinear interpolation is performed using linear interpolation first in one direction, and then again in another direction. Although each step is linear in the sampled values and in the position, the interpolation as a whole is not linear but rather
quadratic in the sample location.
Bilinear interpolation is one of the basic
resampling techniques in
computer vision
Computer vision tasks include methods for image sensor, acquiring, Image processing, processing, Image analysis, analyzing, and understanding digital images, and extraction of high-dimensional data from the real world in order to produce numerical ...
and
image processing
An image or picture is a visual representation. An image can be two-dimensional, such as a drawing, painting, or photograph, or three-dimensional, such as a carving or sculpture. Images may be displayed through other media, including a pr ...
, where it is also called bilinear filtering or bilinear texture mapping.
Computation
Suppose that we want to find the value of the unknown function ''f'' at the point (''x'', ''y''). It is assumed that we know the value of ''f'' at the four points ''Q''
11 = (''x''
1, ''y''
1), ''Q''
12 = (''x''
1, ''y''
2), ''Q''
21 = (''x''
2, ''y''
1), and ''Q''
22 = (''x''
2, ''y''
2).
Repeated linear interpolation
We first do linear interpolation in the ''x''-direction. This yields
:
We proceed by interpolating in the ''y''-direction to obtain the desired estimate:
:
Note that we will arrive at the same result if the interpolation is done first along the ''y'' direction and then along the ''x'' direction.
Polynomial fit
An alternative way is to write the solution to the interpolation problem as a
multilinear polynomial
:
where the coefficients are found by solving the linear system
:
yielding the result
:
Weighted mean

The solution can also be written as a
weighted mean of the ''f''(''Q''):
:
where the weights sum to 1 and satisfy the transposed linear system
:
yielding the result
:
which simplifies to
:
in agreement with the result obtained by repeated linear interpolation. The set of weights can also be interpreted as a set of
generalized barycentric coordinates for a rectangle.
Alternative matrix form
Combining the above, we have
:
On the unit square
If we choose a coordinate system in which the four points where ''f'' is known are (0, 0), (0, 1), (1, 0), and (1, 1), then the interpolation formula simplifies to
:
or equivalently, in matrix operations:
:
Here we also recognize the weights:
:
Alternatively, the interpolant on the unit square can be written as
:
where
:
In both cases, the number of constants (four) correspond to the number of data points where ''f'' is given.
Properties
As the name suggests, the bilinear interpolant is ''not'' linear; but it is linear (i.e. affine) along lines
parallel to either the ''x'' or the ''y'' direction, equivalently if ''x'' or ''y'' is held constant. Along any other straight line, the interpolant is
quadratic. Even though the interpolation is ''not'' linear in the position (''x'' and ''y''), at a fixed point it ''is'' linear in the interpolation values, as can be seen in the (matrix) equations above.
The result of bilinear interpolation is independent of which axis is interpolated first and which second. If we had first performed the linear interpolation in the ''y'' direction and then in the ''x'' direction, the resulting approximation would be the same.
The interpolant is a
bilinear polynomial, which is also a
harmonic function satisfying
Laplace's equation. Its
graph is a bilinear
Bézier surface patch.
Inverse and generalization
In general, the interpolant will assume any value (in the
convex hull of the vertex values) at an infinite number of points (forming branches of
hyperbolas), so the interpolation is not invertible.
However, when bilinear interpolation is applied to two functions simultaneously, such as when interpolating a
vector field, then the interpolation is invertible (under certain conditions). In particular, this inverse can be used to find the "unit square coordinates" of a point inside any
convex quadrilateral
In Euclidean geometry, geometry a quadrilateral is a four-sided polygon, having four Edge (geometry), edges (sides) and four Vertex (geometry), corners (vertices). The word is derived from the Latin words ''quadri'', a variant of four, and ''l ...
(by considering the coordinates of the quadrilateral as a vector field which is bilinearly interpolated on the unit square). Using this procedure bilinear interpolation can be extended to any convex quadrilateral, though the computation is significantly more complicated if it is not a parallelogram. The resulting map between quadrilaterals is known as a ''bilinear transformation'', ''bilinear warp'' or ''bilinear distortion''.
Alternatively, a
projective mapping between a quadrilateral and the unit square may be used, but the resulting interpolant will not be bilinear.
In the special case when the quadrilateral is a
parallelogram, a linear mapping to the unit square exists and the generalization follows easily.
The obvious extension of bilinear interpolation to three dimensions is called
trilinear interpolation.
Let
be a vector field that is bilinearly interpolated on the unit square parameterized by