You are on page 1of 17

Bilinear and Trilinear Interpolations

Bilinear and Trilinear Interpolations


Bilinear Interpolation

Bilinear Interpolation:
It is an extension of the linear interpolation for interpolating
functions of, for example, two variables x , and y . The
basic idea is to perform linear interpolation first in one
direction and then in the other direction. For this one needs
to write Lagrange polynomial for x and then for y , which
further will be combined to get a single relationship, i.e., a
function f (x, y).
To start the algorithm first thing which is needed is the
number of x, and y, data points along with the
function values at these given x , and y points.
Let the given data be x0, x1, y0, y1,and f (x0, y0), f (x0, y1),
f (x1, y0), f (x1, y1).

Bilinear and Trilinear Interpolations


Bilinear Interpolation

To start derivation we write down the two linear interpolations


in two directions separately, i.e.,

f (x) = f (x0)L1,0(x) + f (x1)L1,1(x), (1)

f (y) = f (y0)L1,0(y) + f (y1)L1,1(y). (2)

Bilinear and Trilinear Interpolations


Bilinear Interpolation

Considering equation (1) and introducing y , in it we get

f (x, y) = f (x0, y)L1,0(x) + f (x1, y)L1,1(x). (3)

The above equation contains f (x0, y), and f (x1, y), that are
obtainable from equation (2), just by inserting x0, and x1,

f (x0, y) = f (x0, y0)L1,0(y) + f (x0, y1)L1,1(y), (4)

f (x1, y) = f (x1, y0)L1,0(y) + f (x1, y1)L1,1(y), (5)

respectively.

Bilinear and Trilinear Interpolations


Bilinear Interpolation

Hence using equation (4) and (5) in (3), one finally obtains

f (x, y) = f (x0, y0)L1,0(x)L1,0(y) + f (x0, y1)L1,0(x)L1,1(y)


+ f (x1, y0)L1,1(x)L1,0(y) + f (x1, y1)L1,1(x)L1,1(y),
(6)

which in compact form can be written as

1 1
f (x, y) = Σ Σ f (xi , yj )L1,i (x)L1,j (y)
i=0 j=0

Bilinear and Trilinear Interpolations


Bilinear Interpolation

Example 1: If x0=0.1, x1=0.2, y0=0.25, y1=0.35,


f(0.1,0.25)=0.0094117647, f(0.1,0.35)=0.008908686,
f(0.2,0.25)=0.0376470588, f(0.2,0.35)=0.0356347439, then
interpolate f(x,y) to approximate f(0.15,0.31).
1 1
Using f (x, y) = Σ Σ f (xi , yj )L1,i (x)L1,j (y)
i=0 j=0

We obtain f(x,y)=-0.150923620xy+0.3200838460x
+0.0100615750y-0.02133892315

And
f(0.15,0.31)=0.02277479367

Bilinear and Trilinear Interpolations


Bilinear Interpolation

Now extending it further to include two x, and three y, points,


i.e., if the given data is x0, x1, y0, y1, y2,and f (x0, y0), f (x0, y1),
f (x0, y2), f (x1, y0), f (x1, y1), f (x1, y2). To start derivation we write
down the two linear interpolations in two directions separately,
i.e.,

f (x) = f (x0)L1,0(x) + f (x1)L1,1(x), (8)

f (y) = f (y0)L2,0(y) + f (y1)L2,1(y) + f (y2)L2,2(y). (9)

Bilinear and Trilinear Interpolations


Bilinear Interpolation

Considering equation (8) and introducing y , in it we get

f (x, y) = f (x0, y)L1,0(x) + f (x1, y)L1,1(x). (10)

The above equation contains f (x0, y), and f (x1, y), that are
obtainable from equation (9), just by inserting x0, and x1,

f (x0, y) = f (x0, y0)L2,0(y) + f (x0, y1)L2,1(y) + f (x0, y2)L2,2(y), (11)

f (x1, y) = f (x1, y0)L2,0(y) + f (x1, y1)L2,1(y) + f (x1, y2)L2,2(y), (12)

respectively.

Bilinear and Trilinear Interpolations


Bilinear Interpolation

Hence using equation (11) and (12) in (10), one finally obtains

f (x, y) = f (x0, y0)L1,0(x)L2,0(y) + f (x0, y1)L1,0(x)L2,1(y)


+ f (x0, y2)L1,0(x)L2,2(y) + f (x1, y0)L1,1(x)L2,0(y)
+ f (x1, y1)L1,1(x)L2,1(y) + f (x1, y2)L1,1(x)L2,2(y),
(13)

which in compact form can be written as

1 2
f (x, y) = Σ Σ f (xi , yj )L1,i (x)L2,j (y)
i=0 j=0

Bilinear and Trilinear Interpolations


Bilinear Interpolation

Example 2: If x0=0.1, x1=0.2, y0=0.25, y1=0.35, y2=0.41


f(0.1,0.25)=0.0094117647, f(0.1,0.35)=0.008908686,
f(0.1,0.41)=0.0085609109, f(0.2,0.25)=0.0376470588,
f(0.2,0.35)=0.0356347439, f(0.2,0.41)=0.0342436435, then
interpolate f(x,y) to approximate f(0.19,0.39).
1 2
f (x, y) = Σ Σ f (x , y )L (x)L (y)
i j 1,i 1,j
Using i=0 j=0

We obtain f(x,y)=0.307525445x+0.004320592y-0.06480887xy
-0.14352457xy2+0.009568304y2-0.0205016965

and

f(0.19,0.39)=0.03211845415
Bilinear and Trilinear Interpolations
Trilinear Interpolation

Trilinear Interpolation:
To interpolate functions of three variables x , y , and z , one
has to perform linear interpolations in three directions, i.e., in
x, y, and z, directions. For this one needs to write Lagrange
polynomials in these three directions, which further will be
combined to get a single relationship, i.e., a function
f (x, y, z).
Let the given data be x0, x1, y0, y1, z0, z1,and f (x0, y0, z0),
f (x0, y0, z1), f (x0, y1, z0), f (x0, y1, z1), f (x1, y0, z0),
f (x1, y0, z1), f (x1, y1, z0), f (x1, y1, z1).

Bilinear and Trilinear Interpolations


Trilinear Interpolation

Now write down the three linear interpolations in two


directions separately, i.e.,

f (x) = f (x0)L1,0(x) + f (x1)L1,1(x), (15)

f (y) = f (y0)L1,0(y) + f (y1)L1,1(y). (16)

f (z) = f (z0)L1,0(z) + f (z1)L1,1(z). (17)

Bilinear and Trilinear Interpolations


Trilinear Interpolation

Considering equation (15) and introducing y , in it weget

f (x, y) = f (x0, y)L1,0(x) + f (x1, y)L1,1(x). (18)

The above equation contains f (x0, y), and f (x1, y), that are
obtainable from equation (16), just by inserting x0, and x1,

f (x0, y) = f (x0, y0)L1,0(y) + f (x0, y1)L1,1(y), (19)

f (x1, y) = f (x1, y0)L1,0(y) + f (x1, y1)L1,1(y), (20)

respectively.

Bilinear and Trilinear Interpolations


Trilinear Interpolation

Further using equation (19) and (20) in (18), leads to

f (x, y) = f (x0, y0)L1,0(x)L1,0(y) + f (x0, y1)L1,0(x)L1,1(y)


+ f (x1, y0)L1,1(x)L1,0(y) + f (x1, y1)L1,1(x)L1,1(y),
(21)

Introducing another direction in the above equation provides

f (x, y, z) = f (x0, y0, z)L1,0(x)L1,0(y) + f (x0, y1, z)L1,0(x)L1,1(y)


+ f (x1, y0, z)L1,1(x)L1,0(y) + f (x1, y1, z)L1,1(x)L1,1(y),
(22)

Bilinear and Trilinear Interpolations


Trilinear Interpolation
In equation (22) f (x0, y0, z), f (x0, y1, z), f (x1, y0, z), and
f (x1, y1, z), are needed, that can be written using (17). The final
relationship becomes
f (x, y, z) = f (x0, y0, z0)L1,0(x)L1,0(y)L1,0(z)
+ f (x0, y0, z1)L1,0(x)L1,0(y)L1,1(z)
+ f (x0, y1, z0)L1,0(x)L1,1(y)L1,0(z)
+ f (x0, y1, z1)L1,0(x)L1,1(y)L1,1(z)
+ f (x1, y0, z0)L1,1(x)L1,0(y)L1,0(z)
+ f (x1, y0, z1)L1,1(x)L1,0(y)L1,1(z)
+ f (x1, y1, z0)L1,1(x)L1,1(y)L1,0(z)
+ f (x1, y1, z1)L1,1(x)L1,1(y)L1,1(z) (23)
This can be converted to the following formula (24)
1 1 1
f (x, y, z) = Σ Σ Σ f (xi , yj , zk )L1,i (x)L 1,j (y)L 1,k (z).
i=0 j=0 k=0
Bilinear and Trilinear Interpolations
Bilinear and Trilinear Interpolations

Both the Bilinear and Trilinear formulas for any number of


points be written as

p q
f (x, y) = Σ Σ f(x i,,y j)L p,i (x)L q,j (y), (25)
i=0 j=0

and

p q r
f (x, y, z) = Σ Σ Σ f (x i, y j, z k)L p,i (x)L q,j (y)L r,k (z). (26)
i=0 j=0 k=0

Bilinear and Trilinear Interpolations


Trilinear Interpolation

Example 3: If x0=0.05, x1=0.06, y0=1.23, y1=1.41, z0=0.1,


z1=0.2, f(0.05,1.23,0.1)=2.6629, f(0.05,1.23,0.2)=2.7629,
f(0.05,1.41,0.1)=3.1381, f(0.05,1.41,0.2)=3.2381,
f(0.06,1.23,0.1)=2.6729, f(0.06,1.23,0.2)=2.7729,
f(0.06,1.41,0.1)=3.1481,f(0.06,1.41,0.2)=3.2481, then
approximate f(0.06,1.32,0.11) using trilinear interpolation.

Using formula (24), we obtain f(0.06,1.32,0.11)=2.9205

Bilinear and Trilinear Interpolations

You might also like