Solution (source code)

= Solution

For $n\geq3$, <Taylor's theorem> after $n$ terms, counting the constant term, is
$$
f(x)=f(a)+f'(a)(x-a)+\frac{f''(a)}{2!}(x-a)^2
+\cdots+\frac{f^{(n-1)}(a)}{(n-1)!}(x-a)^{n-1}+R_n(x).
$$
Under the usual hypothesis that $f$ is $n-1$ times continuously differentiable on the interval joining $a$ and $x$, and $n$ times differentiable in its interior, the <Taylor theorem with Lagrange remainder> gives
$$
\boxed{R_n(x)=\frac{f^{(n)}(\xi)}{n!}(x-a)^n,
\qquad \xi\text{ strictly between }a\text{ and }x.}
$$
This is a finite expansion with a controlled remainder; it does not assume an infinite <Taylor series> converges. For $x=a$ the remainder is zero.