# Multilinear Interpolation

There is a neat visualization of linear interpolation that generalizes to higher-dimensional spaces, including bilinear (2D) interpolation, trilinear (3D) interpolation and general multilinear interpolation. At all levels it is much easier to remember the visualization than the formulas directly. Let’s start with the simplest case…

## Linear Interpolation

Linear interpolation is a weighted average of 2 neighbors. Consider the 1D domain between the 2 neighbors. This line is divided into 2 segments by the point in question. The weight of each neighbor is given by the length of the opposite segment, as a fraction of the whole line.

If has neighboring data points at and at then the linear interpolation at is given by

.

## Bilinear Interpolation

Bilinear interpolation is a weighted average of 4 neighbors. Consider the 2D domain between the 4 neighbors. This rectangle is divided into 4 sub-rectangles by the point in question. The weight of each neighbor is given by the area of the opposite sub-rectangle, as a fraction of the whole rectangle.

If has neighboring data points at , at , at , and at , then the bilinear interpolation at is given by

## Trilinear Interpolation

Trilinear interpolation is a weighted average of 8 neighbors. Consider the 3D domain between the 8 neighbors. This box is divided into 8 sub-boxes by the point in question. The weight of each neighbor is given by the volume of the opposite sub-box, as a fraction of the whole box.

This is easy to visualize but hard to draw – so sorry no diagram.

If has neighboring data points , , , , , , , at , , , , , , , respectively, then the trilinear interpolation at is given by

## General Multilinear Interpolation

N-linear interpolation is a weighted average of 2^{N} neighbors. Consider the N-dimensional domain between the 2^{N} neighbors. This hyper-box is divided into 2^{N} sub-hyper-boxes by the point in question. The weight of each neighbor is given by the hyper-volume of the opposite sub-hyper-box, as a fraction of the whole hyper-box.

You get the idea…

You might want to improve your description:

1) explain that “f” is the value (or set of values) for that point.

2) the formula has a result, with is f(x), i.e. the value (or set of values) of “f” for the point x.

3) your formulas don’t work if x1 = x0 or y1 = y0, i.e. these case require a fallback on n-1 interpolation or whatever.

Thanks. I’ve incorporated number 1 and 2, and anyone concerned about special cases can come and find number 3 in your comment.

Hi there! It’s difficult to find anything interesting about this topic (that is not overly simplistic), because everything related to 3D seems very difficult. You however sound like you know what you’re talking about 🙂 Thank you for spending your time writing some relevant content for us!