Main Page | See live article | Alphabetical index

# Linear interpolation

Linear interpolation is a process employed in linear algebra, and numerous applications thereof including computer graphics and numerical analysis.

 Table of contents 1 How to do linear interpolation 2 Linear Interpolation as Approximation 3 Other Uses of Linear Interpolation

## How to do linear interpolation

You know the coordinates and . You want to pick points on this line by knowing either an x or y in the interval . For example you want to increase x by a constant factor from up to and get the corresponding y values. By inspecting the figure we see that:

By manipulating this algebraically, and writing

you get:

or if you prefer:

The same formula can easily be derived for x when y is known.

## Linear Interpolation as Approximation

In numerical analysis a linear interpolation of certain points that are in reality values of some function is typically used to approximate the function . In this case the in the formulas above is substituted for the linear interpolation polynomial of degree one, over the two known function values and thusly:

The truncation error of this approximation is defined as

and this error can for a function with 2 continuous derivatives be proven to be:

As you see, the approximation between two points on a given function gets worse with the second derivative of the function that is approximated. This is intuitively correct as well: the "curvier" the function is, the worse is the approximations made with simple linear interpolation. The proof for this error can be performed using Rolle's theorem.

## Other Uses of Linear Interpolation

The basic linear interpolation operation is so commonly used in computer graphics that it is known as a lerp. Lerp operations are built into the hardware of all modern computer graphics processors.

Linear interpolatiom can also be extended to Bilinear interpolation, for example to interpolate a function z(x, y) where z can be written in terms of an α factor for the x-direction and a β factor for the y-direction. Bilinear interpolation is often used as a crude anti-aliasing filter. ....