Quadratic Lagrange Interpolating Polynomials Examples 1

# Quadratic Lagrange Interpolating Polynomials Examples 1

Recall from the Quadratic Lagrange Interpolating Polynomials page that given three points $(x_0, y_0)$, $(x_1, y_1)$, and $(x_2, y_2)$ where $x_0$, $x_1$, and $x_2$ are distinct numbers, then we can construct a quadratic interpolating polynomial $P_2$ of degree less than or equal to $2$ that interpolates these points where:

(1)
\begin{align} \quad P_2(x) = y_0L_0(x) + y_1L_1(x) + y_2L_2(x) \end{align}

The functions $L_0$, $L_1$, and $L_2$ are given by the following formulas:

(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 will now look at some examples of constructing quadratic Lagrange interpolating polynomials

## Example 1

Find the quadratic Lagrange interpolating polynomial $P_2$ that interpolates the function $y = \tan x$ at the points $(0, 0)$, $\left ( \frac{\pi}{4}, 1 \right )$, and $(1, \tan(1))$.

Applying the formula above and we have that:

(5)
\begin{align} \quad P_2(x) = \frac{(x - 0)(x - 1)}{\left (\frac{\pi}{4} - 0 \right ) \left (\frac{\pi}{4}- 1 \right)} + \tan (1) \frac{(x-0)\left (x - \frac{\pi}{4} \right )}{(1 - 0)\left (1 - \frac{\pi}{4} \right )} \end{align}

## Example 2

Find the quadratic Lagrange interpolating polynomial $P_2$ that interpolates the function $y = e^x$ at the points $(0, 1)$, $(1, e)$, and $(2, e^2)$.

Applying the formula above and we have that:

(6)
\begin{align} \quad P_2(x) = \frac{(x - 1)(x - 2)}{(0 - 1)(0 - 2)} + e \frac{(x - 0)(x - 2)}{(1 - 0)(1- 2)} + e^2 \frac{(x-0)(x - 1)}{(2 - 0)(2 - 1)} \end{align}