Monday, January 27, 2014

1+2+3+... = -1/12 ... huh?

Recently a video did its rounds on social media, showing how the sum of the natural numbers was $\frac{-1}{12}$. Naturally there was some skepticism from some of my friends, so I decided to write up a short note to clarify the situation.

You can find the video here, and for the more mathematically inclined, a blog post by Terry Tao.

What I'm going to show is that there is a slightly more rigorous way of interpreting the manipulations performed in the YouTube video, while pointing out the parts which are still not fully kosher.

(Could I start by saying that the sum doesn't work "because of physics"? Thank you.)

Infinite Sums
In case your response upon watching that video was "Wait a minute! That sum is clearly infinity" - you're not wrong. The typical way to define an infinite sum is as the limit of its partial sums i.e. 

$$S = a_1 + a_2 + a_3 + \cdots = \sum _{n=1} ^ \infty a_n $$
is defined to be 
$$ lim _{N \rightarrow \infty} \sum_{n=1} ^N a_n$$
and according to this definition, the sum $1+2+3+\cdots$ is certainly $\infty$.

And it gets worse - there are sums whose partial sums don't even have a limit. Here's an example which is actually from the video; the sum
$$S_1=1-1+1-1+1-1+ \cdots$$
has partial sums alternating between 1 and 0. In the video, he says that since the partial sums alternate in this way, the sum must be the "average" of these two values i.e. 1/2. 

I'm going to show you another way of seeing this. We won't actually use this sum, but it's a good way to start.

Start with the series expansion
$$\frac{1}{1-x} = \sum _{n >= 0} x^n$$
Let's first see why the fraction $\frac{1}{1-x}$ has that series expansion (you've probably seen this before):
$$(1-x) (1+x+x^2+x^3\cdots) = (1+x+x^2+x^3\cdots) - x (1+x+x^2+x^3\cdots)$$
which becomes
$$ = (1+x+x^2+x^3\cdots) - (x+x^2+x^3\cdots) $$
just by multiplying by $x$. Now all the powers of $x$ cancel, leaving only
$$ (1-x) (1+x+x^2+x^3\cdots) = 1$$
and therefore
$$(1+x+x^2+x^3\cdots) = \frac{1}{1-x}$$

Now this is fine as far as algebra goes i.e. symbolic manipulation. But what happens when we want to plug in values for $x$, say $x=500$?

Well, you can't. The problem is that the infinite sum will just stop making sense. The values of $x$ for which the sum does make sense is called its domain of convergence. For the sum $\sum x^n$, the domain of convergence is just the interval $-1<x<1$ (take my word for it - if we get into that level of detail I'll never get done here).

Okay, so 
  1. When $x$ is between -1 and 1, the value of the fraction $\frac{1}{1-x}$ matches with the limit of partial sums i.e. the infinite sum of $\sum x^n$.
  2. When $x=1$, both the fraction and the sum clearly blow up - the fraction gets a zero in the denominator and the sum just becomes $1+1+1+1+\cdots$. 
  3. But what happens at $x=-1$?
Let's compute - I'm going to plug in some values of $x$, starting at $-0.1$ and going down to $-0.9$. You can imagine $x$ moving to the left on the number line as you go down the rows of this table: 


For each row, I've listed the first few terms of the series along with their signs so that it looks like a sum (as if I've plugged values of $x$ into $1+x+x^2+\cdots$). Then in the sixth column I have the infinite sum itself (well, not quite infinite, I did the computation with $1+x+\cdots + x^{1000}$). The final column has the value of the fraction for this value of $x$.

Here's what you're supposed to notice about this table:
  1.  The sum $\sum x^n$ matches the fraction $\frac{1}{1-x}$. Of course if I had shown more digits after the decimal points they would eventually have differed, because the sum only used 1000 terms.
  2. Both of these get closer to $1/2$ as $x$ gets closer to $-1$ (the bottom rows)
  3. The second column is getting closer to -1, the third column to +1, the fourth to -1 and the fifth to +1.
I've attempted to draw a graph which to show (3). The different colors correspond to the rows of the table. Take a look at each block of colored bars.
  1. The first one is $x^0$, which is just 1, no matter what $x$ is
  2. The second one is $x^1$, so you can see the dark blue bar is for $x=-0.5$ and the red one is for $-1$
  3. The third one is for $x^2$, etc...

Every time you move from blue to red in a colored block, it's like going down the rows of the table.

Now what I'm trying to show you here is how the individual terms of the series $1+x+x^2+\cdots$ get closer to $1-1+1-1+\cdots$ as $x \rightarrow -1$. So when you look at the series, this is a way you can picture it changing as $x \rightarrow -1$.

I would have been nice if I had also indicated the sums of these terms, but my graphing skills only go so far... anyway from the table you can see that they approach $1/2$. 

(And of course if you plug $x=-1$ into the fraction $\frac{1}{1-x}$, you get $1/2$, no magic there). 

So what have you just seen? What I just showed you was that $1+x+x^2+\cdots \rightarrow 1/2$ as $x \rightarrow -1$, i.e 
$$ 1-1+1-1+1- \cdots = 1/2$$
To summarize, I'm going to state all this in a very particular way:
  1. There is a function $f(x) = \frac{1}{1-x}$,
  2. with a series expansion $1+x+x^2+x^3\cdots$
  3. and there is also a point $x=-1$ 
  4. which allows us to view the sum $1-1+1-\cdots$ as $f(-1)$.
LET ME REITERATE: The sum $1-1+1-\cdots$ has no meaning according to the definitions of infinite sums. We are specifically interpreting it as the specialization of a series at a point on the boundary of the domain of convergence.

The sum $S_2$

The next sum in the video is 
$$ S_2 = 1 - 2 + 3 - 4 + \cdots $$
which they claim equals $1/4$.

If you believe what I said in the last section, this one is easy. Just differentiate
$$ \frac{1}{1-x} = 1 + x + x^2 + x^3 + \cdots $$
with respect to $x$; you get
$$ \frac{1}{(1-x)^2} = 1 + 2x + 3x^2 + 4x^3 + \cdots$$
and plug in $x=-1$ to get
$$ \frac{1}{4} = 1 - 2 + 3 - 4 + \cdots$$

A different kind of series
We just interpreted $1 - 2 + 3 - 4 + \cdots$ as the specialization of $$1 + 2x + 3x^2 + 4x^3 + \cdots$$ at $x=-1$. Now we're going to look at it differently, as the specialization at $x=-1$ of
$$\frac{1}{1^x} - \frac{1}{2^x} + \frac{1}{3^x} - \frac{1}{4^x} \cdots$$

Here comes the non-kosher part: I'm going to ask you to believe that since
$$1 - 2 + 3 - 4 + \cdots = 1/4$$
using the series
$$1 + 2x + 3x^2 + 4x^3 + \cdots,$$
it continues to be $1/4$ even when we use this new series
$$\frac{1}{1^x} - \frac{1}{2^x} + \frac{1}{3^x} - \frac{1}{4^x} \cdots$$

Accepting this for the moment, the final series we need is
$$ g(x) = \frac{1}{1^x} + \frac{1}{2^x} + \frac{1}{3^x} + \frac{1}{4^x} \cdots$$
Very similar, but now we have a + sign on every term.

Step 1. Make a modification of $g(x)$ which only uses even numbers.

This is easy - we just divide it by $2^x$; watch:
$$\frac{g(x)}{2^x} = \frac{1}{2^x} \left ( \frac{1}{1^x} + \frac{1}{2^x} + \frac{1}{3^x} + \frac{1}{4^x} \cdots \right )$$
$$ = \frac{1}{2^x} + \frac{1}{4^x} + \frac{1}{6^x} + \cdots$$

Cool.

Step 2. Now we subtract it from $g(x)$, first once:
$$ g(x) - \frac{g(x)}{2^x} =  \frac{1}{1^x} +  \frac{1}{3^x} +  \frac{1}{5^x} + \cdots $$
and then again:
$$ g(x) - \frac{g(x)}{2^x}- \frac{g(x)}{2^x} = \frac{1}{1^x} - \frac{1}{2^x} + \frac{1}{3^x} - \frac{1}{4^x} + \frac{1}{5^x}+ \cdots $$
(Looking familiar!) Let's simplify the left-hand side by grouping the $g(x)$'s
$$g(x) (1 - \frac{1}{2^x}- \frac{1}{2^x} ) = \frac{1}{1^x} - \frac{1}{2^x} + \frac{1}{3^x} - \frac{1}{4^x} + \frac{1}{5^x}+ \cdots$$
$$g(x) \left (1 - \frac{2}{2^x} \right ) = \frac{1}{1^x} - \frac{1}{2^x} + \frac{1}{3^x} - \frac{1}{4^x}  +  \frac{1}{5^x}+ \cdots $$
If we plug $x=-1$ into the left-hand side, we get $g(-1) (1-4)$, and if we plug it into the right-hand side we get $1 - 2 + 3 - 4 + \cdots =1/4$. 
Diving by $1-4$ gives us $$g(-1) = -1/12$$

And... what is $g(-1)$? Go ahead, look at the definition, you will get
$$1+2+3+4+\cdots = -1/12$$

The Non-Kosher Step

Why am I uncomfortable with saying that 
$$\frac{1}{1^x} - \frac{1}{2^x} + \frac{1}{3^x} - \frac{1}{4^x} \cdots$$
approaches $1/4$ as $x \rightarrow -1$?

Remember that whole bit above where I drew the graphs of those series and said "well, the series approaches 1/4 as $x$ approaches -1"? I showed you a table and hopefully convinced you that what I was doing wasn't complete nonsense. (Okay, I drew the graphs for $S_1$, but it works for $S_2$ as well. Try it in Excel or something).

We can't do that here.

Not only can we not approach $x = -1$, we can't even cross $x=+1$! The series converges when $x>1$, and blows up at $x=1$, but even if you try to evaluate it at $x=0.99$ it won't work. It just blows up.

So how did I jump from $x=1$, across 0 all the way to $x=-1$?

Well, that's why this is the non-kosher step. And I don't have an explanation which doesn't involve more machinery.

But it's not "because of the physics".