Pumpkin Pi

Fig. 1

Among many images of carved pumpkin, I like the one above (see Fig. 1) the most. It shows Leibniz’s formula for calculating the value of $\pi$. Namely,

$\pi=4\sum\limits_{k=1}^{\infty}\frac{(-1)^{k+1}}{2k-1}$.

To derive this formula, we begin with finding the derivative of $\arctan{x}$:

Let $y = \arctan{x}$, we have $x=tan(y)$, and

$\frac{d}{dx}x=\frac{d}{dx}\tan{y}=\frac{d}{dy}\tan{y}\frac{dy}{dx}=\sec^{2}{y}\frac{dy}{dx} = (1+tan^{2}{y})\frac{dy}{dx}$

$= (1+x^{2})\frac{dy}{dx}$.

Since $\frac{d}{dx}x=1$,

$\frac{d}{dx}\arctan{x}=\frac{1}{1+x^2}\quad\quad\quad(1)$

It follows that by (1) and the Fundamental Theorem of Calculus,

$\int\limits_{0}^{1}\frac{1}{1+x^2}dx = \arctan{x}\bigg|_{0}^{1}=\frac{\pi}{4}$

i.e.,

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

From carrying out polynomial long division, we observe

$\frac{1}{1+x^2} = 1 + \frac{-x^2}{1+x^2}$,

$\frac{1}{1+x^2} = 1 - x^2 + \frac{x^4}{1+x^2}$,

$\frac{1}{1+x^2} = 1 - x^2 + x^4 + \frac{-x^6}{1+x^2}$,

$\frac{1}{1+x^2} = 1 - x^2 + x^4 - x^6 + \frac{x^8}{1+x^2}$.

It seems 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\quad\quad\quad(3)$

Assuming (3) is true, we integrate it with respect to $x$ from 0 to 1,

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

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

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

As a result of integration,  (2) becomes

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

or,

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

Therefore,

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

$=\frac{x^{2n+1}}{2n+1}\bigg|_{0}^{1}= \frac{1}{2n+1}$.

Moreover, $\forall \epsilon > 0$, we obtain $n > \frac{1}{2}(\frac{1}{\epsilon}-1)$ through solving $\frac{1}{2n+1} < \epsilon$. It means that $\forall \epsilon > 0, \exists n^*=\frac{1}{2}(\frac{1}{\epsilon}-1)$ such that  for all $n > n^*, |\frac{\pi}{4} - \sum\limits_{k=1}^{n}\frac{(-1)^{k+1}}{2k-1}|<\epsilon$, i.e.,

$\lim\limits_{n\to\infty}{ \sum\limits_{k=1}^{n}\frac{(-1)^{k+1}}{2k-1}}=\frac{\pi}{4}$.

Thus

$\pi = 4 \sum\limits_{k=1}^{\infty}\frac{(-1)^{k+1}}{2k-1}\quad\quad\quad(4)$

The numerical value of $\pi$ is therefore approximated according to (4) by the partial sum

$4 \sum\limits_{k=1}^{n}\frac{(-1)^{k+1}}{2k-1}=4(1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\dots+(-1)^{n+1}\frac{1}{2n-1})\quad\quad\quad\quad(5)$

Its value converges to $\pi$ as $n$ increases.

However, (5) is by no means a practical way of finding the value of $\pi$, since its convergence is so slow that many terms must be summed up before a reasonably accurate result emerges (see Fig. 2)

Fig. 2

I doubt Leibniz has ever used his own formula to obtain the value of $\pi$ !

Let me leave you with an exercise: Prove (3)