Recall from the Linear Lagrange Interpolating Polynomials page that given two points, $(x_0, y_0)$ and $(x_1, y_1)$ where $x_0$ and $x_1$ are distinct, we can construct a line $P_1$ that passes through these points. We also saw that we could approximate a function with this line that also passes through these two points.

(1)
$$P_1(x) = y_0L_0(x) + y_1L_1(x)$$

Realistically, using a straight line interpolating polynomial to approximate a function is generally not very practical because many functions are curved. The accuracy of approximating the values of a function with a straight line depends on how straight/curved the function is originally between these two points, and on how close we are to the points $(x_0, y_0)$ and $(x_1, y_1)$. We will now introduce quadratic Lagrange Interpolating polynomials

This time we will need three points to interpolate. Let $(x_0, y_0)$, $(x_1, y_1)$, and $(x_2, y_2)$ be the points that we want to interpolate where $x_0 \neq x_1 \neq x_2$, and define the functions $L_0(x)$, $L_1(x)$, and $L_2(x)$ as follows:

(2)
\begin{align} \quad L_0(x) = \frac{(x - x_1)(x - x_2)}{(x_0 - x_1)(x_0 - x_2)} \end{align}
(3)
\begin{align} \quad L_1(x) = \frac{(x - x_0)(x - x_2)}{(x_1 - x_0)(x_1- x_2)} \end{align}
(4)
\begin{align} \quad L_2(x) = \frac{(x-x_0)(x - x_1)}{(x_2 - x_0)(x_2 - x_1)} \end{align}

We then define the quadratic Lagrange interpolating polynomial, $P_2$ through the points $(x_0, y_0)$, $(x_1, y_1)$, and $(x_2, y_2)$ as the following function:

(5)
\begin{align} \quad P_2(x) = y_0L_0(x) + y_1L_1(x) + y_2L_2(x) = y_0 \frac{(x - x_1)(x - x_2)}{(x_0 - x_1)(x_0 - x_2)} + y_1 \frac{(x - x_0)(x - x_2)}{(x_1 - x_0)(x_1- x_2)} + y_2 \frac{(x-x_0)(x - x_1)}{(x_2 - x_0)(x_2 - x_1)} \end{align}

Note that $P_2$ does in fact pass through all the points specified above since $P_2(x_0) = y_0$, $P_2(x_1) = y_1$, and $P_2(x_2) = y_2$. A formal definition of the polynomial above is given below.

 Definition: The Quadratic Lagrange Interpolating Polynomial through the points $(x_0, y_0)$, $(x_1, y_1)$, and $(x_2, y_2)$ where $x_0$, $x_1$, and $x_2$ are distinct is the polynomial $P_2(x) = y_0L_0(x) + y_1L_1(x) + y_2L_2(x)$.

It is important to note that while we define $P_2$ to be the "quadratic" Lagrange interpolating polynomial, it is possible that $P_2$ may have degree less than $2$.

Let's now look at some examples of constructing a quadratic Lagrange interpolating polynomials.

## Example 1

Construct the quadratic Lagrange interpolating polynomial $P_2(x)$ that interpolates the points $(1, 4)$, $(2, 1)$, and $(5, 6)$.

Applying the formula given above directly and we get that:

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

The graph of $y = P_2(x)$ is given below:

## Example 2

Construct the quadratic Lagrange interpolating polynomial $P_2(x)$ that interpolates the points $(1, 2)$, $(3, 4)$, and $(5, 6)$.

Applying the formula given above directly and we get that:

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

The graph of $y = P_2(x)$ is given below:

Note that example 2 shows that $P_2$ need not be quadratic and may be a polynomial of lesser degree.