The following figure shows the problem of bilinear interpolation. It is assumed you know the values of a function at points \((x_1, y_1)\), \((x_1, y_2)\), \((x_2, y_1)\), and \((x_2, y_2)\) defined on a grid, which for practical purposes, can be assumed to be rectilinear. The goal is to estimate the function value at a point with coordinates \((x_q, y_q)\) by using the known values at the surrounding points. In the following figure, green dots represent known values, and the red dot represents the value to be estimated.
Figure 1 - Bilinear Interpolation Problem
Bilinear interpolation is a two-step process, where linear interpolation is first performed over one dimension then the other. The following figure shows the first step of the process. Here, the function values at the blue dots are computed from the known values at the green dots, using linear interpolation over the variable \(x\).
Figure 2 - First Linear Interpolation
These two intermediate points can be expressed in terms of the known values as
and
Figure 3 shows the second step of the process, where the desired value at the red dot is derived from the computed values at the blue dots using linear interpolation over the variable \(y\).
Figure 3 - Second Linear Interpolation
The resulting interpolated point is
Combining equations, the bilinear interpolation formula can be expressed as