# 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?

-
Do you know what Taylor series are? – Mike Spivey Dec 18 '10 at 23:08
I learned about them in Calc II in college but have since forgotten their significance. – FogleBird Dec 18 '10 at 23:12
The answer to your question is that the right-hand side of your expression is the Taylor series of $\arctan x$ evaluated at $x = 1$. The left-hand side is $\arctan 1 = \pi/4$. (This is exactly what Willie Wong's answer says.) – Mike Spivey Dec 18 '10 at 23:14
– lhf May 31 '13 at 20:33
There is a geometric proof in the book 'Strength in Numbers' by Sherman Stein. – Akiva Weinberger Aug 31 '14 at 19:54

## 7 Answers

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$.

-
Dear Qiaochu, In case you don't know, the second evaluation you describe is a special case of (the proof of) Dirichlet's evaluation of $L(\chi,1)$ when $\chi$ is a quadratic character attached to an imaginary quadratic field (i.e. for which $\chi(-1) = -1$). (You are considering the case when $\chi$ is the non-trivial character of conductor $4$.) – Matt E Dec 19 '10 at 6:57

The function $\sec(x)=\frac{1}{\cos(x)}$ also has a series expansion that will give you this result, but it is not its Taylor series. Namely, its partial fraction expansion is $$\sec(x)=\sum_{n=1}^\infty \frac{(-1)^n(2n-1)\pi }{x^2-\left (n-\frac{1}{2}\right )^2\pi^2},$$ as derived in Example 1 at this link to Markushevich and Silverman, for example. The series converges to $\sec(x)$ everywhere the latter is defined (and uniformly on compact subsets of the domain). Plugging in $x=0$ and multiplying both sides by $\frac{\pi}{4}$ yields $$\frac{\pi}{4}=1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\cdots.$$

-

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.

-
The above link to Ranjay Roy's article is broken; this one works for now. – ShreevatsaR Feb 26 '14 at 2:18

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 $$f(x) = \sum_{k=0}^\infty \frac{1}{k!} f^{(k)}(a) (x-a)^k$$ for $\arctan(x)$ for $x \in [-1,1]$ at $a = 0$ and applying the result for $x = 1$. The finite geometric sum formula $$\sum_{k=0}^n q^k = \frac{1-q^{n+1}}{1-q}, \ \ q \in \mathbb{C}, \ q \neq 1$$ 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.

-
why did $t^{2n+2}$ turn into $t^{2n+3}$? – Aaron Maroja Aug 31 '14 at 21:08
Because $t^{2n+2} \cdot tdx = t^{2n+3} dx$. In the latter calculation $t^{2n+2}$ was integrated. – Juha-Matti Vihtanen Jan 23 '15 at 21:06
Correction: In the latter calculation $x^{2n+2}$ was integrated. – Juha-Matti Vihtanen Jan 24 '15 at 16:34

It comes from evaluating the arctan of 1.

-
Well, it is more than that. The hardest part of the proof is Abel's theorem, ensuring that convergence of the series gives us that it converges to the right value. – Andrés Caicedo Dec 18 '10 at 23:19

I think this is relevant, and an explanation of QY's proof.

$$1+i\,\tan\,\theta=\sec\,\theta(\cos\,\theta+i\,\sin\,\theta)$$
$$1+i\,\tan\,\theta=\sec\,\theta\cdot e^{i\theta}$$

Taking logs,

$$\ln(1+i\,\tan\,\theta) = \ln(\sec\,\theta\cdot e^{i\theta})$$
$$\ln(1+i\,\tan\,\theta) = i\theta + \ln(\sec\,\theta)$$

The rest follows easily.

There are other interesting identities which stem from this, and are easily proved. $$\arctan(1/2)+\arctan(1/3) = \pi/4$$ $$4\arctan(1/5)-\arctan(1/239) = \pi/4$$ $$4\arctan(1/5)-\arctan(1/70)+\arctan(1/99) = \pi/4$$

These final equations make it progressively easier to evaluate $\pi$, and that is what they are used for.

-
Those "other interesting identities" are often referred to as Machin (or Machin-like) formulae. – J. M. Dec 19 '10 at 9:06
Am I the only one who doesn't make the connection between your manipulations in the first half and QY's answer? Where are you going with all that? You say "the rest follows easily", but you didn't say what your goal was (evidently a bit more general than just $\arctan 1=\pi/4$). – Mario Carneiro Jun 1 '13 at 0:15