# Piece of Pi

A while back, we deemed that it is utterly impractical to calculate the value of $\pi$ using the partial sum of Leibniz’s series due to its slow convergence (see “Pumpkin Pi“)

Fig. 1

As illustrated in Fig. 1, in order to determine each additional correct digit of $\pi$, the number of terms in the summation must increase by a factor of 10.

What we need is a fast converging series whose partial sum yields given number of correct digits with far fewer terms.

Looking back, we see that the origin of Leibniz’s series is the definite integral

$\frac{\pi}{4} = \int\limits_{0}^{1}\frac{1}{1+x^2} dx\quad\quad\quad(1)$

To find the needed new series, we consider a variation of (1), namely,

$\frac{\pi}{6} = \int\limits_{0}^{\frac{1}{\sqrt{3}}}\frac{1}{1+x^2} dx\quad\quad\quad(2)$

Given the fact (see “Pumpkin Pi“) that

$\frac{1}{1+x^2} = \sum\limits_{k=1}^{n}(-1)^{k+1}x^{2k-2}+\frac{(-1)^n x^{2n}}{1+x^2}\quad\quad\quad(3)$

We proceed to integrate (3) with respect to $x$ from $0$ to $\frac{1}{\sqrt{3}}$,

$\int\limits_{0}^{\frac{1}{\sqrt{3}}}\frac{1}{1+x^2} dx=\int\limits_{0}^{\frac{1}{\sqrt{3}}}\sum\limits_{k=1}^{n}(-1)^{k+1}x^{2k-2} dx + \int\limits_{0}^{\frac{1}{\sqrt{3}}}\frac{(-1)^n x^{2n}}{1+x^2}dx$

$= \sum\limits_{k=1}^{n}(-1)^{k+1}\int\limits_{0}^{\frac{1}{\sqrt{3}}}x^{2k-2} dx + (-1)^n\int\limits_{0}^{\frac{1}{\sqrt{3}}}\frac{x^{2n}}{1+x^2}dx$

$= \sum\limits_{k=1}^{n}(-1)^{k+1}\frac{x^{2k-1}}{2k-1}\bigg|_{0}^{\frac{1}{\sqrt{3}}}+ (-1)^n\int\limits_{0}^{\frac{1}{\sqrt{3}}}\frac{x^{2n}}{1+x^2}dx$

As result, (2) becomes

$\frac{\pi}{6}=\sum\limits_{k=1}^{n}(-1)^{k+1}\frac{(\frac{1}{\sqrt{3}})^{2k-1}}{2k-1}+(-1)^n\int\limits_{0}^{\frac{1}{\sqrt{3}}}\frac{x^{2n}}{1+x^2}dx$

$= \sum\limits_{k=1}^{n}(-1)^{k+1}\frac{{(\frac{1}{3}})^k}{(2k-1)\frac{1}{\sqrt{3}}} + (-1)^n\int\limits_{0}^{\frac{1}{\sqrt{3}}}\frac{x^{2n}}{1+x^2}dx$

$= \sqrt{3}\sum\limits_{k=1}^{n}\frac{(-1)^{k+1}}{3^k(2k-1)} + (-1)^n\int\limits_{0}^{\frac{1}{\sqrt{3}}}\frac{x^{2n}}{1+x^2}dx$

i.e.,

$\frac{\pi}{6} - \sqrt{3}\sum\limits_{k=1}^{n}\frac{(-1)^{k+1}}{3^k(2k-1)} = (-1)^n\int\limits_{0}^{\frac{1}{\sqrt{3}}}\frac{x^{2n}}{1+x^2}dx\quad\quad\quad(4)$

By (4),

$|\frac{\pi}{6} - \sqrt{3}\sum\limits_{k=1}^{n}\frac{(-1)^{k+1}}{3^k(2k-1)}| = |(-1)^n\int\limits_{0}^{\frac{1}{\sqrt{3}}}\frac{x^{2n}}{1+x^2}dx|=\int\limits_{0}^{\frac{1}{\sqrt{3}}}\frac{x^{2n}}{1+x^2}dx<\int\limits_{0}^{\frac{1}{\sqrt{3}}}x^{2n}dx$

$=\frac{x^{2n+1}}{2n+1}\bigg|_0^{\frac{1}{\sqrt{3}}}$

$=\frac{1}{3^n \sqrt{3} (2n+1)}$

which gives

$|\sqrt{3}\sum\limits_{k=1}^{n}\frac{(-1)^{k+1}}{3^k(2k-1)} - \frac{\pi}{6}| < \frac{1}{3^n \sqrt{3} (2n+1)}$.

And so

$-\frac{1}{3^n \sqrt{3} (2n+1)}<\sqrt{3}\sum\limits_{k=1}^{n}\frac{(-1)^{k+1}}{3^k(2k-1)}-\frac{\pi}{6}<\frac{1}{3^n \sqrt{3} (2n+1)}\quad\quad\quad(5)$

Since $\lim\limits_{n\rightarrow \infty}\frac{1}{3^n \sqrt{3} (2n+1)}=0$, (5) implies

$\lim\limits_{n\rightarrow \infty} \sqrt{3}\sum\limits_{k=1}^{n}\frac{(-1)^{k+1}}{3^k(2k-1)}-\frac{\pi}{6}= 0$.

Hence,

$\lim\limits_{n\rightarrow \infty} \sqrt{3}\sum\limits_{k=1}^{n}\frac{(-1)^{k+1}}{3^k(2k-1)}=\frac{\pi}{6}$.

It follows that the value of $\pi$ can be approximated by the partial sum of a new series

$6\sqrt{3}\sum\limits_{k=1}^{\infty}\frac{(-1)^{k+1}}{3^k(2k-1)}$

Let’s compute it with Omega CAS Explorer (see Fig. 2, 3)

Fig. 2

Fig. 2 shows the series converges quickly. The sum of the first 10 terms yields the first 6 digits!

Fig. 3

Totaling the first 100 terms of the series gives the first 49 digits of $\pi$ (see Fig. 3)

Exercise 1. Show that $\lim\limits_{n\rightarrow \infty}\frac{1}{3^n \sqrt{3} (2n+1)}=0$.

Exercise 2. Can we use $\frac{\pi}{3} = \int\limits_{0}^{\sqrt{3}}\frac{1}{1+x^2}dx$ to compute the value of $\pi$ in a similar fashion? Explain.