Why does this converge to $\pi/4$?

The infinite series...

$\pi/4 = 1 - 1/3 + 1/5 - 1/7 ...$

...is very intriguing to me and seems like a crazy coincidence (its relationship to $\pi$). Is it actually crazy or does it have an easy to explain, logical reasoning behind it that would make it seem not so magical?


The standard proof is that this follows from the Taylor series

$$\arctan x = x - \frac{x^3}{3} + \frac{x^5}{5} \mp ...$$

for the arctangent. This Taylor series is closely related to the Taylor series of the logarithm

$$\log (1 + x) = x - \frac{x^2}{2} + \frac{x^3}{3} \mp ...$$

and this is because the tangent function can be written in terms of complex exponentials, so the arctangent function can be written in terms of complex logarithms. So the appearance of $\pi$ in this formula is morally due to Euler's formula.

But there is also the following beautiful proof, which I learned from Gabor Toth's Glimpses of Algebra and Geometry. Consider the number $N(r)$ of integer lattice points inside the circle of radius $r$ centered at the origin, or in other words the number of pairs of integers $x, y$ satisfying $x^2 + y^2 \le r^2$. It is not hard to see that $N(r) \sim \pi r^2$ for large $r$; in fact, it is not hard to see that $N(r) = \pi r^2 + O(r)$.

Let $r_2(n)$ denote the number of pairs of integers $(x, y)$ such that $x^2 + y^2 = n$. Then $N(r) = 1 + r_2(1) + ... + r_2(r^2)$ (if $r$ is an integer). On the other hand, a classic result of number theory implies that

$$r_2(n) = 4(d_1(n) - d_3(n))$$

where $d_k(n)$ is the number of divisors of $n$ congruent to $k \bmod 4$. It follows that we can evaluate $N(r)$ by counting how many numbers between $1$ and $r^2$ are divisible by each number congruent to $1, 3 \bmod 4$ with the appropriate sign. This gives

$$\frac{N(r) - 1}{4} = r^2 - \left\lfloor \frac{r^2}{3} \right\rfloor + \left\lfloor \frac{r^2}{5} \right\rfloor \mp ...$$

and the result follows by taking the limit as $r \to \infty$.


For a historical perspective (i.e. if you want to see how geniuses struggled through things that would be natural today, mostly because of things they later discovered), the nice article The Discovery of the Series Formula for π by Leibniz, Gregory and Nilakantha1 by Ranjan Roy (1990) describes how the formula was discovered independently thrice:

The series (2) was obtained independently by Gottfried Wilhelm Leibniz (1646-1716), James Gregory (1638-1675) and an Indian mathematician of the fourteenth century or probably the fifteenth cen­tury whose identity is not definitely known. Usually ascribed to Nilakantha, the Indian proof of (2) ap­pears to date from the mid-fifteenth century and was a consequence of an effort to rectify the circle. […] Leibniz's work, in fact, was primarily concerned with quadrature; the π/4 series resulted (in 1673) when he applied his method to the circle. Gregory, by comparison, was interested in finding an infinite series representation of any given func­tion and discovered the relationship between this and the successive derivatives of the given function. Gre­gory's discovery, made in 1671, is none other than the Taylor series; note that Taylor was not born un­til 1685. […]

Finally, although the proofs of (2) by Leibniz, Gregory and Nilakantha are very different in approach and motivation, they all bear a relation to the modem proof given above.

Perhaps I'll come back and edit this post for a summary of their methods if I actually read the article. :-)


1: Ranjan Roy, Mathematics Magazine, Vol. 63 (1990), pp. 291-306. I found this while flipping through the book Sherlock Holmes in Babylon: and other tales of mathematical history.


This is a follow-up to the comment about Abel's theorem below Willie Wong's post.

You don't need Abel's theorem if you proceed as follows (taken from "What is Mathematics?" by Courant and Robbins):

$$\sum_{k=0}^{n} (-1)^k x^{2k} = \frac{1+(-1)^nx^{2n+2}}{1+x^2} = \frac{1}{1+x^2} + \frac{(-1)^nx^{2n+2}}{1+x^2}$$

and you integrate each side from $x=0$ to $x=1$ and then take a limit, bounding the rightmost term in the right integral by discarding the $x^2$ term in the denominator. This is nice as it allows a rigorous presentation of this to (a suitably motivated) audience of first year calculus students.


The infinite series $$\pi/4 = 1-1/3+1/5-1/7+ \ ...$$ can be established by finding the expression of Taylor series \begin{equation} f(x) = \sum_{k=0}^\infty \frac{1}{k!} f^{(k)}(a) (x-a)^k \end{equation} for $\arctan(x)$ for $x \in [-1,1]$ at $a = 0$ and applying the result for $x = 1$. The finite geometric sum formula \begin{equation} \sum_{k=0}^n q^k = \frac{1-q^{n+1}}{1-q}, \ \ q \in \mathbb{C}, \ q \neq 1 \end{equation} is applied to find a Taylor-form series. The uniqueness of Taylor polynomial establishes the uniqueness of Taylor series. Note that we don't hence need to calculate all derivatives of $\arctan(x)$. We calculate \begin{eqnarray} \arctan(t) & = & \arctan(t) - \arctan(0) = \bigg\vert_0^t \arctan(x) = \int_0^t \frac{1}{1+x^2} dx \\ & = & \int_0^t \Big(\frac{1-(-x^2)^{n+1}}{1-(-x^2)} + \frac{(-x^2)^{n+1}}{1-(-x^2)} \Big) dx \\ & = & \int_0^t \frac{1-(-x^2)^{n+1}}{1-(-x^2)} dx + \int_0^t \frac{(-x^2)^{n+1}}{1-(-x^2)} dx \\ & = & \int_0^t \sum_{k=0}^n (-x^2)^k dx + \int_0^t \frac{(-x^2)^{n+1}}{1+x^2} dx \\ & = & \sum_{k=0}^n \int_0^t (-x^2)^k dx + \int_0^t \frac{(-x^2)^{n+1}}{1+x^2} dx \\ & = & \sum_{k=0}^n \int_0^t ((-1)x^2)^k dx + \int_0^t \frac{((-1)x^2)^{n+1}}{1+x^2} dx \\ & = & \sum_{k=0}^n \int_0^t (-1)^k (x^2)^k dx + \int_0^t \frac{(-1)^{n+1}(x^2)^{n+1}}{1+x^2} dx \\ & = & \sum_{k=0}^n \int_0^t (-1)^k x^{2k} dx + \int_0^t \frac{(-1)^{n+1}x^{2(n+1)}}{1+x^2} dx \\ & = & \sum_{k=0}^n (-1)^k \int_0^t x^{2k} dx + \int_0^t \frac{(-1)^{n+1}x^{2n+2}}{1+x^2} dx \\ & = & \sum_{k=0}^n (-1)^k \bigg\vert_0^t \frac{x^{2k+1}}{2k+1} + \int_0^1 \frac{(-1)^{n+1}(tx)^{2n+2}}{1+(tx)^2} t dx \\ & = & \sum_{k=0}^n (-1)^k \frac{t^{2k+1}}{2k+1} + \int_0^1 \frac{(-1)^{n+1} t^{2n+2} x^{2n+2}}{1+(tx)^2} t dx \\ & = & \sum_{k=0}^n \frac{(-1)^k}{2k+1} t^{2k+1} + \int_0^1 \frac{(-1)^{n+1} t^{2n+3} x^{2n+2}}{1+(tx)^2} dx , \end{eqnarray} where $t \in \mathbb{R}$ and $n \in \mathbb{N}$. Note that $-x^2 \neq 1$ for every $x \in \mathbb{R}$. Hence we can apply the finite geometric sum formula for every $x \in \mathbb{R}$, that allows us to calculate the Taylor polynomial for every $t \in \mathbb{R}$. Assume now $t \in [-1,1]$. To obtain the limit function we calculate \begin{eqnarray} \Bigg| \arctan(t) & - & \sum_{k=0}^n \frac{(-1)^k}{2k+1} t^{2k+1} \Bigg| = \Bigg| \int_0^1 \frac{(-1)^{n+1}t^{2n+3}x^{2n+2}}{1+(tx)^2} dx \Bigg| \\ & \leq & \int_0^1 \Bigg| \frac{(-1)^{n+1}t^{2n+3}x^{2n+2}}{1+(tx)^2} \Bigg| dx \\ & \leq & \int_0^1 \frac{|-1|^{n+1}|t|^{2n+3}|x|^{2n+2}}{|1+(tx)^2|} dx \\ & = & \int_0^1 \frac{1^{n+1} |t|^{2n+3} x^{2n+2}}{1+(tx)^2} dx \leq \int_0^1 \frac{|t|^{2n+3} x^{2n+2}}{1} dx \\ & = & \int_0^1 |t|^{2n+3} x^{2n+2} dx = |t|^{2n+3} \int_0^1 x^{2n+2} dx \\ & = & |t|^{2n+3} \bigg\vert_0^1 \frac{1}{2n+3} x^{2n+3} = \frac{|t|^{2n+3}}{2n+3} \leq \frac{1^{2n+3}}{2n+3} \\ & = & \frac{1}{2n+3} \rightarrow 0, \end{eqnarray} as $n \rightarrow \infty$. Hence \begin{eqnarray} \arctan(x) & = & \lim_{n \rightarrow \infty} \sum_{k=0}^n \frac{(-1)^k}{2k+1} x^{2k+1} = \sum_{k=0}^\infty \frac{(-1)^k}{2k+1} x^{2k+1} \end{eqnarray} for $x \in [-1,1]$. Now inserting $x = 1$ into the series expression of $\arctan(x)$ we obtain \begin{eqnarray} \pi/4 & = & \arctan(1) = \sum_{k=0}^\infty \frac{(-1)^k}{2k+1} 1^{2k+1} = \sum_{k=0}^\infty \frac{(-1)^k}{2k+1} \\ & = & 1 - 1/3 + 1/5 - 1/7 + \ ... \ , \end{eqnarray} that is the desired result. I hope that this was what you were searching for.