Linear Polynomial Interpolation

# Linear Polynomial Interpolation

We will now begin to discuss various techniques of interpolation. Given a set of discrete points, we sometimes want to construct a function out of polynomials that is an approximation of another known (or possibly unknown) function. Sometimes interpolations can be useful as the original function may not be readily integrable or nicely differentiable, while polynomials are easy to integrate/differentiate. Sometimes we use interpolations because they're easier to work with in general. If we're given a set of discrete points, then sometimes we want to create a model function that interpolates these points.

The first technique of interpolation that we will look at is Linear Polynomial Interpolation.

Suppose that we have two points $(x_0, y_0)$ and $(x_1, y_1)$ where $x_0 \neq x_1$. Let's construct a straight line that passes through these two points. The slope of this line will be $\frac{y_1 - y_0}{x_1 - x_0}$, and so in point-slope form, we have that:

(1)
\begin{align} y - y_1 = \frac{y_1 - y_0}{x_1 - x_0} (x - x_1) \\ y = y_1 + \frac{y_1 - y_0}{x_1 - x_0} (x - x_1) \\ y = \frac{y_1(x_1 - x_0) + (y_1 - y_0)(x - x_1)}{x_1 - x_0} \\ y = \frac{y_1x_1 - y_1x_0 + y_1x - y_1x_1 - y_0x + y_0x_1}{x_1 - x_0} \\ y = \frac{- y_1x_0 + y_1x - y_0x + y_0x_1}{x_1 - x_0} \\ y = \frac{y_1(x - x_0) + y_0(x_1 - x)}{x_1 - x_0} \end{align}

We will denote this linear function above as $P_1(x)$, that is:

(2)
\begin{align} P_1(x) = \frac{y_1(x - x_0) + y_0(x_1 - x)}{x_1 - x_0} \end{align}

Note that indeed this function passes through the points $(x_0, y_0)$ and $(x_1, y_1)$ since $P_1(x_0) = y_0$ and $P_1(x_1) = y_1$.

Let's not look at some examples of applying linear polynomial interpolations.

## Example 1

Find the linear polynomial interpolation $P_1(x)$ that passes through the points $(1, 2)$ and $(3, 4)$.

The function $P_1$ can be obtained directly by substituting the the points $(1, 2)$ and $(3, 4)$ into the formula above to get:

(3)
\begin{align} \quad P_1(x) = \frac{4(x - 1) + 2(3 - x)}{3 - 1} = \frac{4x - 4 + 6 - 2x}{2} = \frac{2x + 2}{2} = x + 1 \end{align}

## Example 2

Estimate the value of $\sqrt{5}$ using the linear polynomial interpolation with the points $(1, 1)$ and $(9, 3)$ and evaluate the error of this approximation with the true value of $\sqrt{5} \approx 2.23606...$.

Note that $(1, 1)$ and $(9, 3)$ are points on the function $f(x) = \sqrt{x}$. We first set up the linear polynomial interpolation $P_1(x)$ as follows:

(4)
\begin{align} \quad P_1(x) = \frac{3(x -1) + 1(9 - x)}{9 - 1} = \frac{3x - 3 + 9 - x}{8} = \frac{2x + 6}{8} = \frac{x + 3}{4} \end{align}

Now our approximation of $f(5) = \sqrt{5}$ is given by $P_1(5)$:

(5)
\begin{align} \quad P_1(5) = \frac{5 + 3}{4} = 2 \end{align}

As we can see, our approximation is an underestimate of the true value of $\sqrt{5}$. We only obtained one significant digit of accuracy.