Taylor Polynomial C17Bfe
1. **Problem statement:** Find the second Taylor polynomial $P_2(x)$ for $f(x) = e^x \cos x$ about $x_0 = 0$. Use $P_2(0.5)$ to approximate $f(0.5)$, find an upper bound for the error $|f(0.5) - P_2(0.5)|$, and compare it to the actual error. Then find a bound for the error $|f(x) - P_2(x)|$ on $[0,1]$.
2. **Taylor polynomial formula:** The second Taylor polynomial about $x_0=0$ is
$$P_2(x) = f(0) + f'(0)x + \frac{f''(0)}{2}x^2$$
3. **Calculate derivatives:**
- $f(x) = e^x \cos x$
- $f'(x) = e^x \cos x - e^x \sin x = e^x(\cos x - \sin x)$
- $f''(x) = \frac{d}{dx}[e^x(\cos x - \sin x)] = e^x(\cos x - \sin x) + e^x(-\sin x - \cos x) = e^x[(\cos x - \sin x) + (-\sin x - \cos x)] = e^x(-2 \sin x)$
4. **Evaluate at $x=0$:**
- $f(0) = e^0 \cos 0 = 1 \cdot 1 = 1$
- $f'(0) = e^0(\cos 0 - \sin 0) = 1(1 - 0) = 1$
- $f''(0) = e^0(-2 \sin 0) = 1 \cdot 0 = 0$
5. **Form $P_2(x)$:**
$$P_2(x) = 1 + 1 \cdot x + \frac{0}{2} x^2 = 1 + x$$
6. **Approximate $f(0.5)$:**
$$P_2(0.5) = 1 + 0.5 = 1.5$$
7. **Error bound formula:** The remainder term for the second degree Taylor polynomial is
$$|R_2(x)| = \left| \frac{f^{(3)}(c)}{3!} x^3 \right|$$
for some $c$ between 0 and $x$.
8. **Find $f^{(3)}(x)$:**
$$f^{(3)}(x) = \frac{d}{dx} f''(x) = \frac{d}{dx} [e^x(-2 \sin x)] = e^x(-2 \sin x) + e^x(-2 \cos x) = e^x(-2 \sin x - 2 \cos x) = -2 e^x (\sin x + \cos x)$$
9. **Bound $|f^{(3)}(c)|$ on $[0,0.5]$:**
- $e^x$ is increasing, max at $x=0.5$ is $e^{0.5} \approx 1.6487$
- $|\sin x + \cos x| \leq \sqrt{2}$ (max value of $\sin x + \cos x$ is $\sqrt{2}$)
- So $|f^{(3)}(c)| \leq 2 \cdot 1.6487 \cdot \sqrt{2} \approx 2 \cdot 1.6487 \cdot 1.4142 = 4.66$
10. **Calculate error bound at $x=0.5$:**
$$|R_2(0.5)| \leq \frac{4.66}{6} (0.5)^3 = \frac{4.66}{6} \cdot 0.125 = 0.0971$$
11. **Actual error:**
- Calculate $f(0.5) = e^{0.5} \cos 0.5 \approx 1.6487 \times 0.8776 = 1.4467$
- Error $= |1.4467 - 1.5| = 0.0533$
12. **Bound for error on $[0,1]$:**
- Max of $|f^{(3)}(x)|$ on $[0,1]$:
- $e^1 = 2.7183$
- $|\sin x + \cos x| \leq \sqrt{2} = 1.4142$
- So max $|f^{(3)}(x)| \leq 2 \times 2.7183 \times 1.4142 = 7.69$
13. **Error bound on $[0,1]$:**
$$|R_2(x)| \leq \frac{7.69}{6} |x|^3 \leq 1.282 |x|^3$$
**Final answers:**
- $P_2(x) = 1 + x$
- Approximation $P_2(0.5) = 1.5$
- Error bound at $0.5$ is approximately $0.0971$
- Actual error at $0.5$ is approximately $0.0533$
- Error bound on $[0,1]$ is $|R_2(x)| \leq 1.282 |x|^3$