# Calculating Lagrange error of a Taylor polynomial approximation

So I am slightly confused when it comes to finding the error of a Taylor series approximation.

I know the equation is : $E_n(x)=\frac M {(n+1)!}(x-a)^{n-1}$

where a is the point that it is centered around and n is the nth term that you are going out to. My question is is how do you calculate M?

We generally use a value for $M$ that we know to be greater than or equal to the absolute value of the (n + 1)-th derivative of $f$ between $x$ and $a$. Or,

$$M\geq |f^{(n+1)}(x)|$$

Example 1. To approximate a value of $\sin{x}$, we could use $M = 1$ no matter how many terms we are using in our approximation. This is because any derivative of $\sin{x}$ will oscillate between -1 and 1.

Example 2. To approximate $e^2$ with the second-degree Taylor polynomial for $e^x$ at $x=0$ ($1 + x + x^2/2!$), we would use a value for $M$ that we know to be greater than the third derivative of $e^x$ on [0,2]. We might choose 9, for instance (rounding $e$ to 3). The lower we make $M$, the stronger the claim about the error bound.

Let $E$, $F$ be normed vector spaces, $\mathcal{U}\subset E$ an open and $f:\mathcal{U}\rightarrow F$ a map which is $p$ times differentiable at $a\in\mathcal{U}$.

The general formula of the Taylor development of $f$ at $a$ is the following : for any $h\in E$ such that $a+h\in\mathcal{U}$, $$f\left(a+h\right)=f\left(a\right)+\sum_{k=1}^{p-1}\frac{1}{k!}\mathrm{d}^kf\left(a\right)\left[h\right]^k+\intop_{t=0}^1\frac{\left(1-t\right)^{p-1}}{\left(p-1\right)!}\mathrm{d}^pf\left(a+th\right)\left[h\right]^pdt$$ where $\mathrm{d}^kf\left(a\right)\left[h\right]^k$ means $\mathrm{d}^kf\left(a\right)\underbrace{\left[h,\ldots,h\right]}_{k\text{ times}}$.

For real valued funcions (i.e. if $F=\mathbb{R}$), then we have the Taylor-Lagrange formula : there is $\theta\in\left]0,1\right[$ such that $$f\left(a+h\right)=f\left(a\right)+\sum_{k=1}^{p-1}\frac{1}{k!}\mathrm{d}^kf\left(a\right)\left[h\right]^k+\frac{1}{p!}\mathrm{d}^pf\left(a+\theta h\right)\left[h\right]^p.$$

Take $p=n-1$ and $h=x-a$ to obtain the rest at the $\left(n-1\right)$-th order $$\frac{|||\mathrm{d}^pf\left(a+\theta\left(x-a\right)\right)|||}{\left(n-1\right)!}\left(x-a\right)^{n-1}$$ where $|||.|||$ is the operator norm on the space of bounded linear maps on $E$ (I assumed here that $\mathrm{d}^pf\left(a+\theta\left(x-a\right)\right)$ was bounded on a neighborhood of $a$ in $\mathcal{U}$).