Explanation of Lagrange Interpolating Polynomial

The Lagrange interpolating polynomial is a tool which helps us construct a polynomial which goes through any desired set of points.

Lets say we want a polynomial that goes through the points $(1,3), (3,4), (5,6)$ and $(7,-10)$.

First we define the polynomial $P(x)=(x-1)(x-3)(x-5)(x-7)$. This has roots at the x-coordinates of each of the points we want to interpolate. Then we construct the following polynomials from this,

$$f_1(x) = P(x)/(x-1)$$ $$f_2(x) = P(x)/(x-3)$$ $$f_3(x) = P(x)/(x-5)$$ $$f_4(x) = P(x)/(x-7)$$

Notice that in particular $f_1(x)=(x-3)(x-5)(x-7)$. This function has the following property: It is zero at $x=3,5,$ and $7$ and nonzero at $x=1$. This means that it is "on" when we are at the first x-coordinate and "off" at the others. Each of them are designed to work this way.

Now consider the following expression,

$$ L(x) = 3 \frac{f_1(x)}{f_1(1)} + 4 \frac{f_2(x)}{f_2(3)} + 6 \frac{f_3(x)}{f_3(5)} -10 \frac{f_4(x)}{f_4(7)} $$

Notice that this functions goes through all four designated points. When we plug in the desired value of $x$ only one of the four functions $f_j$ is turned on and the others are zero. The coefficients are designed to force the expression to equal the corresponding $y$-coordinates.

In particular consider $L(5)$,

$$ L(5) = 3 \frac{f_1(5)}{f_1(1)} + 4 \frac{f_2(5)}{f_2(3)} + 6 \frac{f_3(5)}{f_3(5)} -10 \frac{f_4(5)}{f_4(7)} $$

$$ L(5) = 0 + 0 + 6 \frac{f_3(5)}{f_3(5)} -0 $$

$$ L(5) = 6 \frac{f_3(5)}{f_3(5)} $$

$$ L(5) = 6 (1) $$

$$ L(5) = 6 $$

So we have the desired point $(5,6)$. Try explicitly writing out the polynomial and plugging in the other points to really see it work.