## You are here

Homelinear interpolation

## Primary tabs

# linear interpolation

Among the many interpolation techniques that are available, *linear interpolation* is one of the easiest to understand and implement, as the interpolating function is pieced together by a series of line segments connecting the breakpoints.

Suppose we have a finite set $S$ of ordered pairs $(x_{1},y_{1}),\ldots,(x_{n},y_{n})$ of real numbers such that $x_{1}<x_{2}<\cdots<x_{n}$. The *linear interpolation function* of $S$ is a real-valued function $f$ defined on $[x_{1},x_{n}]$ such that, for $i=1,\ldots,n-1$,

$f(x)=y_{i}+m_{i}(x-x_{i}),\quad\mbox{ where }m_{i}=\frac{y_{{i+1}}-y_{i}}{x_{{% i+1}}-x_{i}}\mbox{ and }x\in[x_{i},x_{{i+1}}].$ |

In other words, $f$ is a piecewise linear function such that $f$ is linear in each of the interval $[x_{i},x_{{i+1}}]$ for $i=1,\ldots,n-1$. When the points (in $S$) belong to the graph of a function $g$ defined on a subset of $[x_{1},x_{n}]$, we say that $f$ interpolates $g$. We also say that $f$ interpolates $S$, as $S$ can be viewed as the graph of the function $g_{S}$ defined on $\{x_{1},\ldots,x_{n}\}$ such that $g_{S}(x_{i})=y_{i}$.

Visually, the interpolation function can be constructed by line segments whose end points are pairs of points $(x_{i},y_{i})$ and $(x_{{i+1}},y_{{i+1}})$ for each $i=1,\ldots,n-1$. The follow graph shows the linear interpolation function $f$ (in blue) of a set consisting of seven points (in dark green). Note that $f$ interpolates any function $g$ defined on a subset of $[x_{1},x_{n}]$ such that $g(x_{i})=y_{i}$.

(-7,-1.5)(7,3.5) \pssetunit=0.8cm \rput[l](-7,0). \rput[r](7,0). \rput[a](3,-1). \rput[b](-3.7,3.1). \psaxes[Dx=10,Dy=10]¡-¿(-2,0)(-7,-1.5)(7,3.5) \pscurve[linecolor=red]¡-¿(-6,1)(-4,3)(-3,3)(0,0.5)(1,1)(3,-1)(6,2) \rput[b](6.74,-0.4)$x$ \rput[b](-1.75,3.2)$y$ \rput[b](4.75,-1)$g(x)$ \rput[b](4.5,1)$f(x)$ \psline[linecolor=blue]-(-6,1)(-4,3)(-3,3)(0,0.5)(1,1)(3,-1)(6,2) \newrgbcolordarkgreen0 0.75 0 \psdots[linecolor=darkgreen,dotsize=5pt](-6,1)(-4,3)(-3,3)(0,0.5)(1,1)(3,-1)(6,2)

Example. Interpolate $\{(4,7),(2,3),(6,1)\}$ using linear interpolation.

Arrange the points so the $x$-coordinates are in the ascending order. There are two line segments associated with these three points: $\ell_{1}$ with end points $(2,3),(4,7)$ and $\ell_{2}$ with end points $(4,7),(6,1)$. Next, calculate the slopes with respect to each line segments:

$m_{1}=\frac{7-3}{4-2}=2\qquad\mbox{ and }\qquad m_{2}=\frac{1-7}{6-4}=-3.$ |

Therefore, the linear interpolation function $f$ is given by

$f(x)=\left\{\begin{array}[]{ll}3+2(x-2)=2x-1&\textrm{if }x\in[2,4]\\ 7+(-3)(x-4)=-3x+19&\textrm{if }x\in[4,6].\end{array}\right.$ |

## Mathematics Subject Classification

65D05*no label found*41A05

*no label found*

- Forums
- Planetary Bugs
- HS/Secondary
- University/Tertiary
- Graduate/Advanced
- Industry/Practice
- Research Topics
- LaTeX help
- Math Comptetitions
- Math History
- Math Humor
- PlanetMath Comments
- PlanetMath System Updates and News
- PlanetMath help
- PlanetMath.ORG
- Strategic Communications Development
- The Math Pub
- Testing messages (ignore)

- Other useful stuff
- Corrections