Linear Lagrange Interpolating Polynomials

# 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)
\begin{align} \quad y - y_1 = \frac{y_1 - y_0}{x_1 - x_0} (x - x_1) \\ \quad y = y_1 + \frac{y_1 - y_0}{x_1 - x_0} (x - x_1) \\ \quad y = \frac{y_1(x_1 - x_0) + (y_1 - y_0)(x - x_1)}{x_1 - x_0} \\ \quad y = \frac{y_1x_1 - y_1x_0 + y_1x - y_1x_1 - y_0x + y_0x_1}{x_1 - x_0} \\ \quad y = \frac{- y_1x_0 + y_1x - y_0x + y_0x_1}{x_1 - x_0} \\ \quad y = \frac{y_1(x - x_0) + y_0(x_1 - x)}{x_1 - x_0} \\ \quad y = y_0 \frac{(x_1 - x)}{x_1 - x_0} + y_1 \frac{(x - x_0)}{(x_1 - x_0)} \\ \quad y = y_0 \left ( \frac{x - x_1}{x_0 - x_1}\right ) + y_1 \left ( \frac{x - x_0}{x_1 - x_0} \right ) \end{align}

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)
\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 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)
\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)$:

(4)
\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.