2. Suppose you want to program the cosine function $f(x) = \cos x$ on a \"minimalist\" calculator.
A few trigonometric identities can help you narrow the range of inputs: first, the cosine
function is periodic with period $2\pi$. For this reason, you can assume that users will only
enter numbers in the interval $[0, 2\pi]$. Secondly, $\cos x = \cos(2\pi - x)$. This implies that if the
calculator can compute cosine of numbers in the interval $[0, \pi]$, users can infer the cosine of
3
numbers that are in $[\pi, 2\pi]$. Finally, $\cos x = -\cos(\pi - x)$. If the calculator can compute the
cosine of numbers in $[0, \pi/2]$, users can deduce the cosine of numbers in $[\pi/2, \pi]$. Therefore,
you only need to program the cosine function with inputs $x \in [0, \frac{\pi}{2}]$.
(a) Find a general formula for $f^{(n)}(x)$ (the n'th derivative of cosine).
(b) Find the n'th polynomial for $f(x)$.
(c) What degree of Taylor polynomial for $\cos x$ (about 0) is needed to approximate $\cos x$ for
$0 \le x \le \pi/2$ to within the error of $10^{-4} = 0.0001$ ?
(d) What would be the suitable degree if you allowed users to enter any numbers in $[-30, 30]$?