# Linear Lagrange Interpolating Polynomials

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. Interpolations can be useful as the original function may not be readily integrable or nicely differentiable, while polynomials are relatively easy to integrate and differentiate. Sometimes we use interpolations because they're easier to work with in general for computations.

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

Suppose that we have two points $(x_0, y_0)$ and $(x_1, y_1)$ where $x_0 \neq x_1$. We will define the linear Lagrange interpolating polynomial to be the straight line that passes through both of these points. Let's construct this straight line. We first note that 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)If we let $L_0(x) = \frac{x - x_1}{x_0 - x_1}$ and $L_1(x) = \frac{x - x_0}{x_1 - x_0}$, then the polynomial above can be rewritten as $P_1(x) = y_0 L_0(x) + y_1 L_1(x)$. We 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$. We formally define this polynomial below.

Definition: The Linear Lagrange Interpolating Polynomial that passes through the points $(x_0, y_0)$ and $(x_1, y_1)$ is $P_1(x) = y_0 L_0(x) + y_1 L_1(x)$. |

Let's now look at some examples of applying linear Lagrange interpolating polynomials.

## Example 1

**Find the linear Lagrange interpolating polynomial, $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:

(2)## Example 2

**Estimate the value of $\sqrt{5}$ using the linear Lagrange interpolating polynomial $P_1(x)$ that passes through 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 Lagrange interpolating polynomial $P_1(x)$ as follows:

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

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