Writing is thinking. To write well is to think clearly. That's why it's so hard.

~ David McCullough

# Gauss's Trick

2017年07月09日

There is a story that every math student should learn. It's about a mathematician named Gauss. One day, his school teacher wanted to keep the class busy for a long time so he could relax. So he gave the class an impossibly difficult task:

Add up all the numbers from 1 to 100.

The class got busy calculating. But not Gauss. After a few minutes, while most students were just beginning to struggle with the teens, Gauss was just finishing with writing down his final answer.

When he brought it to submit it, his teacher was furious with him for not taking the assignment seriously (and for interrupting his nap behind the desk).

We'll look to see how Gauss got his answer so quickly.

# Sums of Consecutive Integers

There's an interesting trick for summing consecutive numbers together. It's easy enough that you can teach it to children in elementary school. We'll show a special case, then generalize it.

Suppose we want to add $1 + 2 + 3 + 4 + 5$. This is small enough that we could do it by hand. Or maybe we even recognize it's how many billiard balls we rack at the start of a game of pool. But rather than answer it directly, we're going to make use of our trick:

$\begin{array}{rl} &1 + 2 + 3 + 4 + 5 \\ +&5 + 4 + 3 + 2 + 1 \end{array}$

We've listed the sum twice, once forwards and once backwards. So we won't get the answer, but instead we'll get twice the answer.

$\begin{array}{rl} &1 + 2 + 3 + 4 + 5 \\ +&5 + 4 + 3 + 2 + 1 \\ &\overline{6 + 6 + 6 + 6 + 6} \end{array}$
And that is just $5 \times 6 = 30$. But wait. Since we've listed the sum twice, our answer, $30$, is actually twice what it needs to be. So to get the value of the original sum, we just cut it in half: $15$.
Now it's your turn. If you want to add up $1$ to $100$, you add it like this:
$\begin{array}{rrrrrrr} &1 + &2 + &3 + &\cdots + &99 + & 100 \\ +&100 + &99 + &98 + &\cdots + &2 + &1 \\ \end{array}$