Solution (source code)

= Solution

Assume $f\in C^{n+1}[a,b]$ and set $\omega(t)=\prod_{i=0}^n(t-x_i)$, a <monic polynomial> of <polynomial degree> $n+1$. Fix $x\in[a,b]$ distinct from all the <interpolation nodes>, and choose
$$
C=\frac{f(x)-p_n(x)}{\omega(x)}.
$$
The auxiliary <function>
$$
F(t)=f(t)-p_n(t)-C\omega(t)
$$
vanishes at the $n+2$ distinct points $x_0,\ldots,x_n,x$. Order those points and repeatedly apply <Rolle's theorem>. After $n+1$ applications, there is some $\xi$ strictly between their smallest and largest values, hence in $(a,b)$, such that $F^{(n+1)}(\xi)=0$.

Because $p_n$ has <polynomial degree> at most $n$ and $\omega$ is monic of <polynomial degree> $n+1$,
$$
0=f^{(n+1)}(\xi)-C(n+1)!.
$$
Substituting the resulting value of $C$ proves the <polynomial interpolation error> formula
$$
\boxed{f(x)-p_n(x)=\frac{f^{(n+1)}(\xi)}{(n+1)!}\prod_{i=0}^n(x-x_i).}
$$
At an <interpolation node>, both sides are zero, so any $\xi\in(a,b)$ works. Such an interior point exists because $n\geq1$ and the <interpolation nodes> are distinct. The selected $\xi$ generally depends on $x$; the theorem makes an existence assertion, not a regularity assertion about that dependence.