Calculus – Compute cos(5°) to 5 Decimal Places with Maclaurin’s Series

calculus

I'm working on a problem:

Compute cos(5°) to 5 decimal places with Maclaurin's Series

I know that that function cos(x) has a Mclaurin representation of:

$ \sum_{n=0}^\infty \frac{(-1)^n (x)^{2n}}{(2n)!} $

The only part I am unsure of is how to find out many terms n to choose.

I'm not sure if I am supposed to use the alternating series estimation or taylor series estimation or what.

Best Answer

As you've stated

$$ \cos(x) = \sum_{n=0}^\infty \frac{(-1)^n (x)^{2n}}{(2n)!} $$

If you want to express this as an order $N$ polynomial plus a remainder, you split the summation as follows:

$$ \cos(x) = \sum_{n=0}^N \frac{(-1)^n (x)^{2n}}{(2n)!} + \sum_{n=N+1}^\infty \frac{(-1)^n (x)^{2n}}{(2n)!} $$ $$ = \sum_{n=0}^N \frac{(-1)^n (x)^{2n}}{(2n)!} + R_N(x) $$

If the remainder is convergent, then it is bounded by it's first term because it is an alternating series. For an alternating series to be convergent, it is sufficient for the magnitude of the sequence of terms to approach zero, which our remainder clearly does for any finite value of $x$ (the factorial grows like $n^n$, which is faster than any exponential growth $x^n$ for a fixed $x$). So the alternating series bound applies: $$ |R_N(x)|\leq \frac{x^{2(N+1)}}{(2(N+1))!} $$

So for your $x=5^\circ$ (make sure you convert to radians before you use it) and precision of five decimal places (say you want $|R_N|\leq10^{-6}$), you can solve for $N$ that gives you that. That's how you pick how many terms to keep.

Edit

In general it is hard to "invert" a factorial, so perhaps I was a bit misleading about "solving" that equation for $N$. You can however guess and check values until you get to the threshold you picked.