Bilinear interpolation formula derivation step 1
Corner points coordinates
x₁
y₁
x₂
y₂
Corner points values
Q₁₁
Q₂₁
Q₁₂
Q₂₂
Interpolated point
x
y
P

Welcome to Omni's bilinear interpolation calculator! Are you a bilinear interpolation professional? Or rather wondering what bilinear interpolation is all about? Here you can find a brief overview of the bilinear interpolation method as well as a detailed explanation and derivation of the formula for bilinear interpolation.

As a bonus, we provided an example of how to perform bilinear interpolation by hand.

What is a bilinear interpolation?

Bilinear interpolation is a popular method for two-dimensional interpolation on a rectangle. That is, we assume that we know the values of some unknown function at four points that form a rectangle. Let these points equal (x₁, y₁), (x₁, y₂), (x₂, y₁) and (x₂, y₂) and the values of the function are the following:

  • The value at (x₁, y₁) is Q₁₁;
  • The value at (x₁, y₂) is Q₂₁;
  • The value at (x₂, y₁) is Q₁₂; and
  • The value at (x₂, y₂) is Q₂₂.

Using bilinear interpolation, we can estimate this function's value at any point (x, y) inside this rectangle. We will denote this unknown value by P.

Bilinear interpolation formula derivation step 1

This interpolation scheme is widespread and has many applications, in particular in computer vision and image processing. It is based on a much simpler and widely taught procedure of linear interpolation. For details, see the sections below.

It's worth knowing that the data required for bilinear interpolation is often collected in the form of the following table. Compare it to the plot above to see how smart the design of this table is!

Bilinear interpolation table

How to use this bilinear interpolation calculator?

Using this calculator is straightforward:

  1. Enter the data:

    • x₁, y₁, x₂, y₂ for the coordinates of the base points of interpolation;

    • Q₁₁, Q₁₂, Q₂₁, Q₂₂ for the values at these points; and

    • x, y for the point at which we want to interpolate the unknown function by means of bilinear interpolation

  2. That's it! Our bilinear interpolation calculator returns the result, i.e., the value of P at (x, y). A piece of cake, isn't it? 🍰

Bilinear interpolation formula

The general idea of the bilinear interpolation method is the following:

  • Start by performing two linear interpolations in the x-direction (horizontal): first at (x, y₁), then at (x, y₂).
  • Next, perform linear interpolation in the y-direction (vertical): use the interpolated values at (x, y₁) and (x, y₂) to obtain the interpolation at the final point (x, y).

Let's have a look at the details.

  1. We find the linear interpolation of function f at (x, y₁) using the values of f at (x₁, y₁) and (x₂, y₁) which are Q₁₁ and Q₂₁ respectively:
Bilinear interpolation formula derivation step 1
  1. We find the linear interpolation of f at (x, y₂) using the values of f at (x₁, y₂) and (x₂, y₂) which are Q₁₂ and Q₂₂ respectively:
Bilinear interpolation formula derivation step 1
  1. Finally, we find the linear interpolation at (x, y) using the interpolated values of f at (x, y₁) and (x, y₂):
Bilinear interpolation formula derivation step 2

All that's let to do is to rewrite the above expression for P to get rid of the intermediate values R₁ and R₂.

  • Substituting the expressions for R₁ and R₂ from Steps 1 & 2, we get the following formula for P:
Bilinear interpolation final formula
  • Using vectors and matrices, we can rewrite the above bilinear interpolation formula for P into the following form:
Bilinear interpolation formula matrix form

Tip: You may want to use to our matrix multiplication calculator while using the matrix form of the bilinear interpolation formula.

Bilinear interpolation example

That was lots of theory, wasn't it? If you feel a bit overwhelmed, don't worry! In this section, we'll solve an example to show you how to use the bilinear interpolation formula in practice.

Assume that an unknown function has:

  • Value 12 at (0, 1);
  • Value -4 at (0, 3);
  • Value 0 at (4, 1); and
  • Value 8 at (4, 3).

We want to estimate the value of this function at (1, 2).

  1. Let's begin by writing down some data.

    • For the rectangle corners, we have:

      x₁ = 0, x₂ = 4, y₁ = 1, and y₂ = 3

    • The respective function values are:

      Q₁₁ = 12, Q₂₁ = -4, Q₁₂ = 0, and Q₂₂ = 8

    • The point at which we perform the bilinear interpolation is:

      x = 1, y = 2

  2. Let's calculate the terms that appear in the bilinear interpolation formula for P:

    • (x₂ - x₁) * (y₂ - y₁) = (4 - 0) * (3 - 1) = 8

    • (x₂ - x) * (y₂ - y) = (4 - 1) * (3 - 2) = 3

    • (x - x₁) * (y₂ - y) = (1 - 0) * (3 - 2) = 1

    • (x₂ - x) * (y - y₁) = (4 - 1) * (2 - 1) = 3

    • (x - x₁) * (y - y₁) = (1 - 0) * (2 - 1) = 1

  3. Let's put those values together into the formula for P. We obtain:

    P = 3/8 * Q₁₁ + 1/8 * Q₂₁ + 3/8 * Q₁₂ + 1/8 * Q₂₂

  4. It's time to substitute the values Q₁₁, Q₂₁, Q₁₂, and Q₂₂:

    P = 3/8 * 12 + 1/8 * (-4) + 3/8 * 0 + 1/8 * 8

  5. Finally, we have:

    P = 9/2 - 1/2 + 1 = 5

Properties of bilinear interpolation

Let's look once again at the final formula for P and point out some of its properties:

Bilinear interpolation final formula

From this formula we see that:

  1. Bilinear interpolation is

    • Linear with respect to the values Q₁₁, Q₁₂, Q₂₁, and Q₂₂ of the unknown function at the corners of the rectangle;

    • Linear along every horizontal line (where x changes and y is constant) and along every vertical line (where x is constant and y changes); but

    • Quadratic with respect to the location of the interpolation point, i.e., as a function of both x and y.

  2. Bilinear interpolation is the weighted average of the values Q₁₁, Q₁₂, Q₂₁, and Q₂₂ at the four corners of the rectangle, and the weights are determined by the distance between the corners and the point (x, y). The closer a corner is to (x, y), the more weight that corner gets.

Anna Szczepanek, PhD
People also viewed…

Coffee kick

A long night of studying? Or maybe you're on a deadline? The coffee kick calculator will tell you when and how much caffeine you need to stay alert after not sleeping enough 😀☕ Check out the graph below!

Perimeter of a triangle

How to find the perimeter of a triangle? What's the perimeter of a triangle formula? Find out with this perimeter of a triangle calculator!

Regular polygon

What is the polygon definition? What are the names of regular polygons? Find the answers with our polygon calculator.

Schwarzschild radius

Calculate the gravitational acceleration at the event horizon of a black hole of a given mass using the Schwarzschild radius calculator.