Lagrange Interpolation Formula

Theorem
Let $\left({x_0, \ldots, x_n}\right)$ and $\left({a_0, \ldots, a_n}\right)$ be tuples of real numbers such that $x_i \ne x_j$ for $i \ne j$.

Then there exists a unique polynomial $P \in \R \left[{X}\right]$ of degree at most $n$ such that
 * $P \left({x_i}\right) = a_i,\ i = 0, \ldots, n$

Moreover $P$ is given by the formula:
 * $\displaystyle P \left({X}\right) = \sum_{j \mathop = 0}^n a_i L_j \left({X}\right)$

where $L_j \left({X}\right)$ is the $j$th Lagrange basis polynomial associated to the $x_i$.

Proof
Recall the definition:
 * $\displaystyle L_j \left({X}\right) = \prod_{\substack{0 \mathop \le i \mathop \le n \\ i \mathop \ne j}} \frac {X - x_i} {x_j - x_i} \in \R \left[{X}\right]$

From this we see that:
 * $L_j \left({x_i}\right) = \delta_{ij}$

Therefore:
 * $\displaystyle P \left({x_i}\right) = \sum_{j \mathop = 0}^n a_i \delta_{ij} = a_i$

Moreover, by Degree of Product of Polynomials over Integral Domain and Degree of Sum of Polynomials, the degree of $P$ as defined above is at most $n$.

It remains to show that the choice of $P$ is unique.

Let $\tilde P$ be another polynomial with the required properties, and let $\Delta = P - \tilde P$.

By Degree of Sum of Polynomials, the degree of $\Delta$ is at most $n$.

Now we see that for $i = 0,\ldots,n$,
 * $\Delta \left({x_i}\right) = P \left({x_i}\right) - \tilde P \left({x_i}\right) = a_i - a_i = 0$

Since by hypothesis the $x_i$ are distinct, $\Delta$ has $n+1$ distinct zeros in $\R$.

But by the corollary to the Polynomial Factor Theorem this shows that:
 * $\displaystyle \Delta \left({X}\right) = \alpha \prod_{i \mathop = 0}^n \left({X - x_i}\right)$

If $\alpha \ne 0$, then this shows that the degree of $\Delta$ is $n+1$, a contradiction.

Therefore $\Delta = 0$, and $P = \tilde P$. This establishes uniqueness.