Error formula when using a polynomial interpolation You have a function f that has a continous $(n+1)th$ derivative.
And you use a polynomial $p_n$ to interpolate the function at points
 $(x_0,f_0), (x_1,f_1) ... (x_n,f_n)$.
Then the error for the interpolation is given by
$$f(x) - p_n(x) = (x-x_0)(x-x_1)...(x-x_n)\frac{f^{n+1}(t)}{(n+1)!}$$
with $x_0 \leq t \leq x_n$
My text simply states the formula and doesnt show how it is derived. I dont see how you get to the right hand side of the equation, how can I derive that formula?

For some fixed $\tilde{x} \notin \{ x_0, \dots, x_n \}$ construct the function
$$
F(x) = f(x) - p_n(x) - g(\tilde{x}) \prod_{i=0}^n (x - x_i),
$$
where $g(\tilde{x})$ is defined such that $F(\tilde{x}) = 0$, i.e.
$$
g(\tilde{x}) = (f(\tilde{x}) - p_n(\tilde{x})) \left( \prod_{i=0}^n (x - x_i) \right)^{-1}.
$$
$F(x)$ has $(n+2)$ distinct roots, namely $x_0, \dots, x_n, \tilde{x}$. From what you stated about continuity of the derivatives of $f$ it follows that $F$ is $(n+1)$ times continuously differentiable.
Now, apply Rolles theorem $(n+1)$ times, from which it follows that there is some $t$ such that $F^{(n+1)}(t) = 0.$ Since $p_n$ is a polynomial of degree $n$ we have
$$
F^{(n+1)}(x) = f^{(n+1)}(x) - g(\tilde{x})(n+1)!
$$
Insert $t$ in the above expression gives us
$$
g(\tilde{x}) = \frac{f^{(n+1)}(t)}{(n+1)!},
$$
which completes the proof.
