# Riemann Series Theorem

July 30th 2013This is probably among the coolest theorems I’ve ever seen; the results are so counterintuitive that it takes a while to wrap your head around the implications. The Riemann Series Theorem, AKA the Riemann Rearrangement Theorem, states that for any conditionally convergent series, its terms can be rearranged to make it sum to *any* value. As a remainder, a series is conditionally convergent if it diverges in absolute value, but converges normally. So,

`$\displaystyle\sum_{n=1}^{\infty}a_n$`

converges but `$\displaystyle\sum_{n=1}^{\infty}|a_n|$`

diverges.

The typical example for this theorem is the Alternating Harmonic Series, `$\displaystyle\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n}$`

, which converges conditionally (in the absolute value, it’s the divergent Harmonic Series `$\displaystyle\sum_{n=1}^{\infty}\frac{1}{n}$`

. As an aside, it took me the longest time to make sense of why the Harmonic Series didn’t converge, but that’s for another day). So, lets look at the Alternating Harmonic Series. Here are the first few terms:

`$1, -\frac{1}{2}, \frac{1}{3}, -\frac{1}{4}, \frac{1}{5}, -\frac{1}{6}, \frac{1}{7},\dots$`

When the terms are summed in this order, the limit of the partial sums (The sum up the `$nth$`

term) is `$ln(2)$`

.

I really like to actually see this sort of thing working, just because it gives me an extra sense of surety about the conclusions, so I fired up a Clojure REPL and calculated some partial sums:

```
(doseq [n (range 1000 11000 1000)]
(println
(str n " : " (reduce + (map #(/ (Math/pow -1.0 (+ 1 %)) %) (range 1 n))))))
```

The results, in the format `$k : \sum_{n=1}^{k}\frac{(-1)^{n+1}}{n}$`

```
1000 : 0.6936474305598223
2000 : 0.6933972430599402
3000 : 0.6933138750043931
4000 : 0.6932721961849508
5000 : 0.6932471905599514
6000 : 0.6932305208377307
7000 : 0.6932186142334228
8000 : 0.6932096844662066
9000 : 0.6932027392019319
10000 : 0.6931971830599583
```

As you can see, these partial sums approach (rather slowly) `$ln(2)$`

, which is approximately `$0.69314718056$`

. Now, here’s where it gets crazy. Let’s use the same terms we just used in the previous sum, but switch up the order like this:

`$1-\frac{1}{2}-\frac{1}{4}+\frac{1}{3}-\frac{1}{6}-\frac{1}{8}+\frac{1}{5}-\frac{1}{10}-\frac{1}{12}+\dots$`

Here, we’re just adding the same terms, but we’re alternating between one term with an odd denominator and two terms with even denominators. Clearly, this will still result in `$1/n$`

being included in the sum exactly once for every $n$, and will include the exact same terms as the number of terms being summed goes to infinity. However, the value of this summation, shockingly, is `$ln(\sqrt{2})$`

instead of just `$ln(2)$`

. To see this, I’m once again going to just test it out. To make it easier to represent, I’ll be making a new series that is a summation of the same terms, but reflecting the new ordering. In this new series, the $nth$ term is defined as:

`$a_n=\frac{1}{2n-1}-\frac{1}{2(2n-1)}-\frac{1}{2(2n)}$`

for `$n=1,2,3,4,\ldots$`

Same as last time, here is the code for generating the partial sums, and the sums themselves:

```
(doseq [n (range 1000 11000 1000)]
(println
(str n " : " (reduce + (map #(- (/ 1.0 (- (* 2 %) 1)) (/ 1 (- (* 4 %) 2)) (/ 1 (* 4 %))) (range 1 n))))))
```

```
1000 : 0.3464484964674379
2000 : 0.3465110668346582
3000 : 0.34653191319432436
4000 : 0.3465423344196212
5000 : 0.3465485865294729
6000 : 0.3465527543421831
7000 : 0.3465557312236676
8000 : 0.34655796381500753
9000 : 0.34655970023359134
10000 : 0.34656108934241103
```

Lo and behold, it converges to `$ln(\sqrt{2})$`

, which is approximately `$0.34657359028$`

and, of course, half of `$ln(2)$`

.

Remember, you can also make this series (or any other conditionally convergent series) converge to any given value, or diverge, just by choosing a different permutation of the terms when summing. The way I think of it, to make it converge to a given positive number, start by adding positive terms until you are just over the target value, then add negatives until you are just below, then positives, then negatives, etc. For negative values, just do the opposite, starting with the negative terms.

So, basically, when the number of terms you’re adding sky-rockets to infinity, all those pesky rules you learned in elementary school fall away. Addition isn’t commutative anymore! This theorem was the first thing that really got me to understand that once infinity became involved, things changed. The first time I saw it, it just blew my mind. I hope that it’s been enlightening to you as well.

For more information and proofs, as always, check out the relevant Wikipedia article.