Determine the number of terms needed to ensure an approximation of π to within $10^{-3}$

1.2k Views Asked by At

I'm having troubles solving this problem:

Using this:

$$\frac{\pi}{4} = 4\arctan\left(\frac{1}{5}\right) - \arctan\left(\frac{1}{239}\right)$$

And The Maclaurin series for the arctangent function:

$$\arctan(x)=\lim_{n\to\infty}\sum_{i=1}^n\frac{(-1)^{i+1}x^{2i-1}}{2i-1}$$

Determine the number of terms that must be summed to ensure an approximation to $\pi$ to within $10^{-3}$.

I got this: $$\frac{4}{2n+1} \left(\frac{4}{5^{2n+1}}-\frac{1}{239^{2n+1}}\right)<10^{-3}$$ However, I do not know what to do next.

Please help.

EDIT: I'm looking for an analytic approach.

2

There are 2 best solutions below

5
On

In an alternating decreasing series, the error is smaller than the first term dropped. You can evaluate the two arc tangent series by equally sharing out the error.

Then

$$\begin{align}\frac45&=0.8\\ \frac4{3\cdot5^3}&=0.0106667\cdots\\ \frac4{5\cdot5^5}&=0.000256\end{align}$$

and

$$\begin{align} \frac1{239}=0.00418410041841\cdots.\\ \end{align}$$

Clearly the next term is well below $0.0005$, and we can do with

$$\frac45-\frac4{375}-\frac1{239}=0.7851\cdots$$

to be compared to the true value $0.78539816\cdots$.

Update: I used a tolerance $10^{-3}$ on $\frac\pi4$ instead of on $\pi$, so the discussion must be rewritten with $0.00025$. By luck, the given estimate is still valid, as explained below.


From the above, we can even conclude that the error is smaller than $0.000256$. But for this to hold, we need to keep an extra digit and write $0.78515\cdots$ (true error $0.000249$).

One might argue that $0.000256>0.00025$ and there is a risk of the estimate being wrong, but we remain on the safe side because the error on the second series is certainly much smaller than $0.00025$ and an imbalanced sharing can be used.


For a fully analytical solution, you can express the truncation criterion of the series for $p\arctan(1/q)$ as

$$\frac p{(2n-1)q^{2n-1}}<\epsilon.$$

This is satisfied (a little pessimistically for small $n$) with

$$n=\left\lceil\frac{\log_q\frac p\epsilon+1}2\right\rceil.$$

This estimate tells us to truncate from the fourth and second terms onward, respectively.

0
On

First we must establish that we are actually dealing with a proper alternating series so that the alternating series error remainder estimate may be used. This may be done trivially by: \begin{align} \frac{\pi}{4} &= 4\arctan \tfrac{1}{5} - \arctan \tfrac{1}{239}\\ &= 4 \sum_{i=1}^{\infty} \frac{(-1)^{i+1} (1/5)^{2i-1}}{2i-1} - \sum_{i=1}^{\infty}\frac{(-1)^{i+1} (1/239)^{2i-1}}{2i-1}\\ &= \sum_{i=1}^{\infty} \frac{(-1)^{i+1}}{2i-1} \underbrace{\left[ 4\left(\tfrac{1}{5}\right)^{2i-1} - \left(\tfrac{1}{239}\right)^{2i-1}\right]}_{> 0} \end{align} Hence this is an alternating series, with terms that decrease monotonically in $i$ (in an absolute sense). So,

\begin{align} \left|\pi - 4\sum_{i=1}^{n} (-1)^{i+1} \frac{ 4\left(\tfrac{1}{5}\right)^{2i-1} - \left(\tfrac{1}{239}\right)^{2i-1}}{2i-1}\right| &\leq 4\frac{4\left(\tfrac{1}{5}\right)^{2n+1}-\left(\tfrac{1}{239}\right)^{2n+1}}{2n+1}\\ &\leq \frac{16}{(2n+1) 5^{2n+1}} \leq \frac{16}{5^{2n+2}} = 0.64\cdot\frac{1}{5^{2n}} \end{align} So $n\geq 3$ suffices. Obviously $n=1$ fails, but for $n=2$ we obtain

$$\pi - \frac{ 5359397032}{1706489875} \approx 0.000995624 < 10^{-3}$$

So at $2$ terms or more are sufficient.