Linear Interpolation Formula

Linear Interpolation Equation Formula & Examples

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
Answer: (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}}$