Solution (source code)

= Solution

The <Taylor theorem with Lagrange remainder> states that if $f$ is $n$ times differentiable between $a$ and $x$, then some $\xi$ between $a$ and $x$ satisfies
$$
f(x)=\sum_{j=0}^{n-1}
\frac{f^{(j)}(a)}{j!}(x-a)^j
+\frac{f^{(n)}(\xi)}{n!}(x-a)^n.
$$

Let $T_{n-1}$ denote the displayed polynomial and choose $K$ so that
$$
F(t)=f(t)-T_{n-1}(t)-K(t-a)^n
$$
satisfies $F(x)=0$. By construction,
$$
F(a)=F'(a)=\cdots=F^{(n-1)}(a)=0.
$$
Starting with the two zeros $a,x$ and applying <Rolle theorem> repeatedly, there is a $\xi$ between them with $F^{(n)}(\xi)=0$. Since
$$
F^{(n)}(\xi)=f^{(n)}(\xi)-n!K,
$$
we have $K=f^{(n)}(\xi)/n!$, proving the theorem.