Interpolation, in mathematics, is a curve fitting method . Given a set of data points, we use interpolation techniques to fit different types of curves that pass through the given data points. We will see how to perform linear interpolation on a pair of data points in *2* dimensions.

Consider an unknown function whose $y$ values are ${y_0}$ and ${y_1}$ at the $x$ values ${x_0}$ and ${x_1}$ respectively. To fit a linear curve that passes through the two data points given, we simply need to find the equation of the straight line that passes through the two points. We can do this by using the two-point form of the equation of a straight line.

$\frac{{y - {y_0}}}{{x - {x_0}}} = \frac{{{y_1} - {y_0}}}{{{x_1} - {x_0}}} \Rightarrow y = {y_0} + \left( {\frac{{{y_1} - {y_0}}}{{{x_1} - {x_0}}}} \right) \times \left( {x - {x_0}} \right)$

The linear function $y = f\left( x \right)$ described above is known as the linear interpolant for the given two data points.

Linear interpolation is, in fact, a special case of Lagrangeâ€™s interpolation formula for fitting an ${n^{th}}$ degree polynomial through $n$ data points. The general Lagrangeâ€™s interpolation formula is given below.

$\frac{{\left( {x - {x_1}} \right)\left( {x - {x_2}} \right)....\left( {x - {x_n}} \right)}}{{\left( {x - {x_2}} \right)}}{y_n}\quad \frac{{\left( {x - {x_0}} \right)\left( {x - {x_n}} \right)....\left( {x - {x_n}} \right)}}{{\left( {{x_1} - {x_0}} \right)\left( {x - {x_2}} \right).....\left( {{x_1} - {x_n}} \right)}}{y_1} + .... + \frac{{\left( {x - {x_1}} \right)\left( {x - {x_2}} \right)....\left( {x - {x_n}} \right)}}{{\left( {{x_0} - {x_1}} \right)\left( {{x_0} - {x_2}} \right).....\left( {{x_0} - {x_n}} \right)}}{y_n}$

Letâ€™s look at an example to see how to use the linear interpolation formula.

**Question****:**

Find the value of $f\left( 2 \right)$using linear interpolation, given that $f\left( { - 1} \right) = 4$ and $f\left( 3 \right) = 6$.

**Solution****:**

$\begin{gathered}

Â Â {x_0} = - 1,\,\,{y_0} = 4 \hfill \\

Â Â {x_1} = 3,\,\,{y_1} = 6 \hfill \\

\end{gathered} $** **

Using the linear interpolation formula , we have the following equation.

$\begin{gathered}

Â Â y = f\left( x \right) = {y_0} + \frac{{{y_1} - {y_0}}}{{{x_1} - {x_0}}} \times \left( {x - {x_0}} \right) \hfill \\

Â Â \quad \quad \quad \quad = 4 + \frac{{6 - 4}}{{3 - \left( { - 1} \right)}} \times \left( {x - \left( { - 1} \right)} \right) = 4 + \frac{{x + 1}}{2} \hfill \\

Â Â f\left( 2 \right) = 4 + \frac{{2 + 1}}{2} = 4 + 1.5 = 5.5 \hfill \\

\end{gathered} $

Why donâ€™t you try to solve a problem to see if you are getting the hang of the methodology?

**Question:**** **The temperature of a rock at $4\,PM$was *35Â°C* and at $7PM$it was *23Â°C*. Using linear interpolation , find its temperature at $9PM$.

**Options:**

(a)*15Â°C*

(b)*15.5Â°C*

(c)*16Â°C*

(d)*16.5Â°C*

**Ans****wer****:**** **(a)

**Solution:**

$\begin{gathered}

Â Â {x_0} = 4,\,\,{y_0} = 35 \hfill \\

Â Â {x_1} = 7,\,\,{y_1} = 23 \hfill \\

\end{gathered} $

Using linear interpolation , we have the following equation.

$\begin{gathered}

Â Â y = {y_0} + \frac{{{y_1} - {y_0}}}{{{x_1} + {x_0}}} \times \left( {x - {x_0}} \right) \hfill \\

Â Â \,\,\,\, = 35 + \frac{{23 - 35}}{{7 - 4}} \times \left( {x - 4} \right) = 35 - 4\left( {x - 4} \right) = 51 - 4x \hfill \\

\end{gathered} $

Using this linear interpolant , we can calculate the temperature of the rock at $9PM$.

$y = 51 - 4 \times 9 = 51 - 36 = {15^ \circ }{\text{C}}$

Consider an unknown function whose $y$ values are ${y_0}$ and ${y_1}$ at the $x$ values ${x_0}$ and ${x_1}$ respectively. To fit a linear curve that passes through the two data points given, we simply need to find the equation of the straight line that passes through the two points. We can do this by using the two-point form of the equation of a straight line.

$\frac{{y - {y_0}}}{{x - {x_0}}} = \frac{{{y_1} - {y_0}}}{{{x_1} - {x_0}}} \Rightarrow y = {y_0} + \left( {\frac{{{y_1} - {y_0}}}{{{x_1} - {x_0}}}} \right) \times \left( {x - {x_0}} \right)$

The linear function $y = f\left( x \right)$ described above is known as the linear interpolant for the given two data points.

Linear interpolation is, in fact, a special case of Lagrangeâ€™s interpolation formula for fitting an ${n^{th}}$ degree polynomial through $n$ data points. The general Lagrangeâ€™s interpolation formula is given below.

$\frac{{\left( {x - {x_1}} \right)\left( {x - {x_2}} \right)....\left( {x - {x_n}} \right)}}{{\left( {x - {x_2}} \right)}}{y_n}\quad \frac{{\left( {x - {x_0}} \right)\left( {x - {x_n}} \right)....\left( {x - {x_n}} \right)}}{{\left( {{x_1} - {x_0}} \right)\left( {x - {x_2}} \right).....\left( {{x_1} - {x_n}} \right)}}{y_1} + .... + \frac{{\left( {x - {x_1}} \right)\left( {x - {x_2}} \right)....\left( {x - {x_n}} \right)}}{{\left( {{x_0} - {x_1}} \right)\left( {{x_0} - {x_2}} \right).....\left( {{x_0} - {x_n}} \right)}}{y_n}$

Letâ€™s look at an example to see how to use the linear interpolation formula.

Find the value of $f\left( 2 \right)$using linear interpolation, given that $f\left( { - 1} \right) = 4$ and $f\left( 3 \right) = 6$.

$\begin{gathered}

Â Â {x_0} = - 1,\,\,{y_0} = 4 \hfill \\

Â Â {x_1} = 3,\,\,{y_1} = 6 \hfill \\

\end{gathered} $

Using the linear interpolation formula , we have the following equation.

$\begin{gathered}

Â Â y = f\left( x \right) = {y_0} + \frac{{{y_1} - {y_0}}}{{{x_1} - {x_0}}} \times \left( {x - {x_0}} \right) \hfill \\

Â Â \quad \quad \quad \quad = 4 + \frac{{6 - 4}}{{3 - \left( { - 1} \right)}} \times \left( {x - \left( { - 1} \right)} \right) = 4 + \frac{{x + 1}}{2} \hfill \\

Â Â f\left( 2 \right) = 4 + \frac{{2 + 1}}{2} = 4 + 1.5 = 5.5 \hfill \\

\end{gathered} $

Why donâ€™t you try to solve a problem to see if you are getting the hang of the methodology?

(a)

(b)

(c)

(d)

$\begin{gathered}

Â Â {x_0} = 4,\,\,{y_0} = 35 \hfill \\

Â Â {x_1} = 7,\,\,{y_1} = 23 \hfill \\

\end{gathered} $

Using linear interpolation , we have the following equation.

$\begin{gathered}

Â Â y = {y_0} + \frac{{{y_1} - {y_0}}}{{{x_1} + {x_0}}} \times \left( {x - {x_0}} \right) \hfill \\

Â Â \,\,\,\, = 35 + \frac{{23 - 35}}{{7 - 4}} \times \left( {x - 4} \right) = 35 - 4\left( {x - 4} \right) = 51 - 4x \hfill \\

\end{gathered} $

Using this linear interpolant , we can calculate the temperature of the rock at $9PM$.

$y = 51 - 4 \times 9 = 51 - 36 = {15^ \circ }{\text{C}}$