# Using Taylor's inequality to estimate accuracy of the approximation $f(x) \approx T_n(x)$

So, I started out with $$f(x)=e^{-x^2}cos(x) \;\;\;at\;\;\; a=0$$ And after finding the Taylor Polynomial $T_3(x)$ for that function, I have $$T_3(x)=1-{{3x^2}\over 2}$$ Now hopefully that is correct. Next, I need to use the Taylor inequality to estimate the accuracy of the approximation $f(x) \approx T_n(x)$ where x satisfies $\left\lvert x \right\rvert \le 1$ I'm not exactly sure where to get started with this second bit. This problem can't be found in my book and the ones that are even sort of similar have more information than given here.

Any help is greatly appreciated, thank you.

EDIT: Here is an example from my book about how to go about approximating these things: This is basically the only thing I have to go off of.

Based on the excerpt from your book, the form of the Taylor remainder that you are using is called the Lagrange remainder. It says that

$$f(x)-T_n(x)=\frac{f^{(n+1)}(\xi(x))}{(n+1)!} (x-a)^{n+1}$$

where $\xi(x)$ is an unknown number between $x$ and $a$. (Generally it is also unknowable, in the sense that you wouldn't be doing Taylor approximation at all if you knew what $\xi(x)$ was.) Thus you can obtain a bound for the absolute error of

$$\frac{M}{(n+1)!} |x-a|^{n+1}$$

if you can show that $|f^{(n+1)}(y)| \leq M$ for all $y \in [a,x]$. An example is

$$|e^x-T_n(x)| \leq \frac{e^x}{(n+1)!} x^{n+1}$$

for $x>0$.

Here you find the following formula:

$$\frac{d^n}{dx^n} e^{x^2} = \left( \sum_{j=0}^{\lfloor n/2 \rfloor} \frac{n!}{j!(n-2j)!}(2x)^{n-2j} \right) e^{x^2}$$

Now taking the derivative at the argument $i x$ gives $$\frac{d^n}{dx^n} e^{-(x)^2} = \frac{d^n}{dx^n} e^{(ix)^2} = i^n\frac{d^n}{dy^n} e^{(y)^2}|_{y= ix} = i^n \left( \sum_{j=0}^{\lfloor n/2 \rfloor} \frac{n!}{j!(n-2j)!}(2ix)^{n-2j} \right) e^{(ix)^2}= (-1)^n\left( \sum_{j=0}^{\lfloor n/2 \rfloor} (-1)^j \frac{n!}{j!(n-2j)!}(2x)^{n-2j} \right) e^{-(x)^2}$$

The next step is to observe $$e^{-x^2} \cos(x) = e^{-x^2}\mathfrak{Re}(e^{ix}) = \mathfrak{Re}(e^{-x^2 + ix}) = \mathfrak{Re}(e^{-(x-i/2)^2 - 1/4}) =e^{ - 1/4}\cdot\mathfrak{Re}(e^{-(x-i/2)^2})$$

So for the nth derivative we have

$$\frac{d^n}{dx^n} (e^{-x^2} \cos(x)) = e^{ - 1/4}\cdot\mathfrak{Re}\frac{d^n}{dx^n}(e^{-(x-i/2)^2}) \\= e^{ - 1/4}\cdot\mathfrak{Re}((-1)^n\left( \sum_{j=0}^{\lfloor n/2 \rfloor} (-1)^j \frac{n!}{j!(n-2j)!}(2x-i)^{n-2j} \right) e^{-(x-i/2)^2}) \\ = \mathfrak{Re}((-1)^n\left( \sum_{j=0}^{\lfloor n/2 \rfloor} (-1)^j \frac{n!}{j!(n-2j)!}(2x-i)^{n-2j} \right) e^{-x^2 + ix}) \\$$

The Taylor expansion about $x=0$ will then use the nth derivative at zero which is

$$\frac{d^n}{dx^n} (e^{-x^2} \cos(x))|_{x=0} \\ = \mathfrak{Re}((-1)^n\left( \sum_{j=0}^{\lfloor n/2 \rfloor} (-1)^j \frac{n!}{j!(n-2j)!}(-i)^{n-2j} \right) ) \\ = \mathfrak{Re}((i)^n\left( \sum_{j=0}^{\lfloor n/2 \rfloor} \frac{n!}{j!(n-2j)!} \right) )$$

an this is zero for odd $n$, and for even $n$ it is $$\frac{d^n}{dx^n} (e^{-x^2} \cos(x))|_{x=0 ; n \; {\rm{ even}}} \\ = (-1)^{n/2} \left( \sum_{j=0}^{ n/2 } \frac{n!}{j!(n-2j)!} \right)$$

So the Taylor series is (writing $2n$ for the even terms) $$T_N(x) = \sum_{n=0}^{\lfloor N/2 \rfloor} \frac{1}{(2n)!} (-1)^{n} \left( \sum_{j=0}^{ n } \frac{(2n)!}{j!(2n-2j)!} \right) x^{2n}\\ = \sum_{n=0}^{\lfloor N/2 \rfloor} (-1)^{n} \left( \sum_{j=0}^{ n } \frac{1}{j!(2n-2j)!} \right) x^{2n}$$

Since the series has terms with alternating signs and, for $n \ge 1$, with decreasing absolute values for $|x|\le 1$, the full sum $f(x)$ lies always between two subsequent partial sums, i.e. the Taylor polynomials are alternately larger and smaller than the function value (cf. the alternating series test). So you have $$T_{N+1}(x) \ge f(x) \ge T_{N}(x)$$ or $$|T_{N+1}(x) - T_{N}(x) |\ge |f(x)- T_{N}(x)|$$ which finally gives for $|x|\le 1$ $$\left( \sum_{j=0}^{ \lfloor (N+1)/2 \rfloor } \frac{1}{j!(2\lfloor (N+1)/2 \rfloor-2j)!} \right) \ge |f(x)- T_{N}(x)|$$