## Computing pi with tools from Calculus

## Computing $\pi$

This note was originally written in the context of my fall Math 100 class at Brown University. It is also available as a pdf note.

While investigating Taylor series, we proved that

\begin{equation}\label{eq:base}

\frac{\pi}{4} = 1 – \frac{1}{3} + \frac{1}{5} – \frac{1}{7} + \frac{1}{9} + \cdots

\end{equation}

Let’s remind ourselves how. Begin with the geometric series

\begin{equation}

\frac{1}{1 + x^2} = 1 – x^2 + x^4 – x^6 + x^8 + \cdots = \sum_{n = 0}^\infty (-1)^n x^{2n}. \notag

\end{equation}

(We showed that this has interval of convergence $\lvert x \rvert < 1$). Integrating this geometric series yields

\begin{equation}

\int_0^x \frac{1}{1 + t^2} dt = x – \frac{x^3}{3} + \frac{x^5}{5} – \frac{x^7}{7} + \cdots = \sum_{n = 0}^\infty (-1)^n \frac{x^{2n+1}}{2n+1}. \notag

\end{equation}

Note that this has interval of convergence $-1 < x \leq 1$.

We also recognize this integral as

\begin{equation}

\int_0^x \frac{1}{1 + t^2} dt = \text{arctan}(x), \notag

\end{equation}

one of the common integrals arising from trigonometric substitution. Putting these together, we find that

\begin{equation}

\text{arctan}(x) = x – \frac{x^3}{3} + \frac{x^5}{5} – \frac{x^7}{7} + \cdots = \sum_{n = 0}^\infty (-1)^n \frac{x^{2n+1}}{2n+1}. \notag

\end{equation}

As $x = 1$ is within the interval of convergence, we can substitute $x = 1$ into the series to find the representation

\begin{equation}

\text{arctan}(1) = 1 – \frac{1}{3} + \frac{1}{5} – \frac{1}{7} + \cdots = \sum_{n = 0}^\infty (-1)^n \frac{1}{2n+1}. \notag

\end{equation}

Since $\text{arctan}(1) = \frac{\pi}{4}$, this gives the representation for $\pi/4$ given in \eqref{eq:base}.

However, since $x=1$ was at the very edge of the interval of convergence, this series converges very, very slowly. For instance, using the first $50$ terms gives the approximation

\begin{equation}

\pi \approx 3.121594652591011. \notag

\end{equation}

The expansion of $\pi$ is actually

\begin{equation}

\pi = 3.141592653589793238462\ldots \notag

\end{equation}

So the first $50$ terms of \eqref{eq:base} gives two digits of accuracy. That’s not very good.

I think it is very natural to ask: can we do better? This series converges slowly — can we find one that converges more quickly?