Problems involving the second Taylor Polynomial of $e^x\cos x$

numerical methods

I'm working on what seem to be very easy problems, but my answers aren't matching my textbook's.

1) Find the second Taylor polynomial of $f(x) = e^x\cos x$ about $x_0 = 0$.

$P_2(x) = 1+x$. (correct)

2) Use $P_2(.5)$ to approximate $f(.5)$. Find an upper bound for the error $|f(.5)-P_2(.5)|$ and compare it to the actual answer.

The error can be no greater than $R_2(.5) = \frac{e^.5(\sin(.5)+\cos(.5))}{24}=.0932$, the actual error is $.0531$. (correct)

Here is where my trouble starts:

3) Find a bound for the error $|f(x)-P_2(x)|$ in using $P_2(x)$ to approximate $f(x)$ on the interval $[0,1]$.

I've tried integrating the error function, which for this problem is $R_2(x) = \dfrac{-2e^\xi(\sin(\xi)+\cos(\xi)x^3}{6}$, from $0$ to $1$. I used the fact that the maximum value of $\sin(\xi)+\cos(\xi)=\sqrt{2}$, with $\xi = \pi/4$, but this gave me an incorrect answer.

Any help appreciated.

Best Answer

hint

$$f(x)=P_2(x)+\frac{x^3}{6}f'''(\xi)$$

with

$$f'''(\xi)=-2(\cos(\xi)+\sin(\xi))e^{\xi}$$

$$=-2\sqrt{2}\cos(\xi-\frac{\pi}{4})e^\xi$$ thus

$$|f(x)-P_2(x)|\le \frac{\sqrt{2}}{3}e$$