Lagrange Interpolation Formula

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

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

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

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

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

From which we see that $L_j(x_i) = \delta_{ij}$.

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

Moreover, by Degree of Product of Polynomials over Integral Domain and Degree of Sum of Polynomials that 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 t most $n$.

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

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

But by the polynomial factor theorem this shows that
 * $\displaystyle \Delta(X) = \alpha\prod_{i=0}^n (X - x_i)$

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

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