Solution (source code)

= Solution

The <Lagrange interpolation polynomial> is
$$
\boxed{p(x)=\sum_{j=0}^nf(x_j)\ell_j(x),\qquad\ell_j(x)=\prod_{\substack{0\leq k\leq n\\k\ne j}}\frac{x-x_k}{x_j-x_k}.}
$$
The distinct nodes make all denominators nonzero. Each <Lagrange basis polynomial> has degree $n$ and satisfies $\ell_j(x_i)=\delta_{ij}$, so the sum has degree at most $n$ and interpolates every specified value.