# 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)We will denote this linear function above as $P_1(x)$, that is:

(2)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)## 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)Now our approximation of $f(5) = \sqrt{5}$ is given by $P_1(5)$:

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