1

Problem. Let $p_{n}(x)$ be the Taylor Polynomial of degree $n$ of $f(x)=\cos(x)$ about $a=0$. How large should $n$ be so that $\vert f(x) - p_{n}(x)\vert<10^{-5}$ for $-\frac{\pi}{4}\le x \le \frac{\pi}{4}$?


Solution. We know

$$ \frac{d^{n}}{dx^{n}} \cos x= \cos\left(x+n\frac{\pi}{2}\right),$$ and $$\vert R_{n}\vert \le \frac{\vert(x-a)\vert^{n+1}}{(n+1)!}\max_{a<c<x} |f^{(n+1)}(c)|,$$ so $$\vert R_{n}\vert \le \frac{|x|^{n+1}}{(n+1)!}<\frac{1}{(n+1)!}<10^{-5},$$ for which WA spits out $n\ge7.$ Would this be right?

Robert Z
  • 147,345
Alex D
  • 1,252

2 Answers2

1

Yes, it is correct, but since $\pi/4<1$, you could get a smaller $n$ if you consider the inequality $$ \frac{|x|^{n+1}}{(n+1)!}<10^{-5}$$ with $x=\pi/4$.

Robert Z
  • 147,345
0

Making the problem more general, you want to find $n$ such that $$\frac{\left(\frac \pi 4\right)^{n+1}}{(n+1)!} \leq 10^{-k}\implies (n+1)! \, \geq \,\left(\frac \pi 4\right)^{n+1}\,10^k$$

If you look at this question, you will find a magnificent approximation proposed by @robjohn, an eminent MSE user.

Making $m=n+1$ and $a=\frac \pi 4$, this would give $$\color{blue}{n=\frac{e \pi }{4}\exp\left(W\left(\frac{4 k \log (10)-4 \log (\pi )+\log (4)}{e \pi }\right)\right)-\frac 32}$$ where appears Lambert function. So, use $\lceil n \rceil$.

Using $k=5$, this would give (as a real) $n=6.56$ and then the result given by Wolfram Alpha.

Pushing to $k=10$, this would give $n=11.05$. Checking $$\frac{\left(\frac \pi 4\right)^{12}}{12!}\approx 1.15 \times 10^{-10}\qquad \text{and}\qquad \frac{\left(\frac \pi 4\right)^{13}}{13!}\approx 6.95 \times 10^{-12}$$