Video: How to Sum the Numbers Up To 100 Quicker than Your Teacher

Tim Burnham

In this video we learn about the brilliant mathematician Carl Friedrich Gauss, and how he surprised his mathematics teacher by adding up all the numbers from 1 to 100 in super-quick time.

13:38

Video Transcript

We’re gonna look at a way to add up all the counting numbers from one to 100, or 1000, or even more really quickly. But first, we’re gonna find out about a brilliant German mathematician called Johann Carl Friedrich Gauss, who managed to devise this method on the spur of the moment when he was about eight years old, much to the annoyance of his teacher! If it hadn’t been for his reluctance to show his working out in full, Gauss would probably have been my favourite mathematician ever. He was born in Germany in 1777 and showed an incredible aptitude for mathematics from a very early age.

For example, it’s said that his mother, who couldn’t read or write, never wrote down his date of birth, but remembered that he’d been born on a Wednesday and that it was eight days before the Feast of Ascension that year. In the Christian tradition, the Feast of Ascension is celebrated on the 40th day of Easter, which moves each year based on the phases of the moon. Gauss quickly used this information to work out that he must have been born on the 30th of April. But he didn’t just do that, he came up with a clever way of working out the date of Easter in any past and future years.

I particularly love this approach of not just answering the narrowest possible interpretation of the question that was asked, but instead coming up with a general approach that can be used to answer similar questions in the future. Mathematics can be used to describe and understand the structure and nature of the world around us so that we can make predictions about it in the future. I also admire Gauss’s enthusiasm and tenacity.

Lots of people would just be annoyed with their mother if she set them a complicated puzzle in answer to the question “When’s my birthday?” But he cheerfully solved the problem and then came up with a general solution to lots of similar problems. When my eight-year old son asked me how old I was, I said “Well, in seven years’ time, I will be less than three times as old as you for the first time.” But he couldn’t be bothered to work it out and said “Alright, I’ll just ask mum.”

One of Gauss’s great early achievements was showing how regular polygons can be constructed using compasses and a straight edge if their number of sides is the product of distinct Fermat primes and a power of two. He also made lots of other great mathematical contributions including proving the quadratic reciprocity law, which enables us to see whether quadratic equations are solvable in modular arithmetic. He completed important work on the prime number theorem to help us to see how prime numbers are distributed among the whole numbers. He couldn’t have known how useful this sort of work was going to become in the Internet age, as we use prime numbers to help us encrypt secure messages in Internet transactions, and understanding them better becomes a matter of security.

He worked on various types of geometry, magnetism, geodetic surveys, making astronomical calculations a lot easier and more efficient to do, least squares regression analysis. And the statistical normal distribution was named the Gaussian distribution after him. In short, we all benefit from his work in all sorts of ways every day, from the statistical methods used to assess new drugs to the regression analysis used by machine learning algorithms that help us to improve the effectiveness and efficiency of our decision making.

But what I want to look at in this video is the story of how, when he was only eight years old, Gauss used his brilliant mathematical intelligence to solve a problem that was apparently set by his mathematics teacher as a punishment. As with most old mathematical anecdotes, it’s impossible to know exactly what happened. And depending on where you do your research, you’ll find slightly different variations on this story and his age at the time. But this is my favourite version.

It’s often said that Gauss was a child prodigy. And his school teachers found him quite difficult to deal with because he was quite restless in class, knew so much, and thought so quickly! One tale tells of a time when his teacher told him to sit down and add up all the numbers from one to 100, just to try to get him to sit quietly for a while. They thought that working out “one plus two is three,” “three plus three is six,” “six plus four is 10,” “10 plus five is 15,” “15 plus six is 21,” and so on, all the way up to 100, would take him ages. But he very quickly came back with the right answer, 5050.

Rather than doing all the individual calculations, Gauss realised that if he wrote out all the numbers from 1 to 100, he could organise them into pairs of numbers that summed to 101. So one plus 100 is 101, two plus 99 is 101, three plus 98 is 101, and so on up to 50 plus 51 equals 101. So he had 50 pairs summing to 101 each. And the total sum, then, is 50 lots of 101 or 50 times 101. And then five times 101 is 505 and 10 times 505 is 5050. Job done!

Now, that’s a neat method, but let’s try to do the generalising thing — can we describe the method or write it out as a formula, so that it works for all similar problems? Well, in this example, we were summing up 100 consecutive numbers. And we could group them into half that number — that’s 50 pairs of numbers that each summed to 101, which is the sum of the first number, one, plus the last number, 100, making a total of 101. So if we generalise and say we’ve got 𝑛 numbers, rather than specifically 100 numbers, then we can write out our method mathematically.

In words, we’ve got the sum of the numbers from one to 𝑛 is equal to half the number of numbers — so that’s the number of pairs — times the sum of the first and the last number. Let’s call that sum 𝑠 and the number of numbers is 𝑛. So half the number of numbers is 𝑛 over two. And we multiply that by the sum of the first and the last number. That’s one, the first number, plus 𝑛, the last number, whatever that happens to be. Then, the general formula is that the sum, 𝑠, is equal to 𝑛 over two times one plus 𝑛.

Now, we put together that formula by representing the calculations that we did, step by step. But it does leave us with, maybe, a little concern. It worked fine when we had an even number of items in the list to add up, but would it still work if we had an odd number of items? Then the pairing of numbers would leave us with another number left over in the middle, which we’d need to take account of.

Let’s illustrate that with a smaller list to make things easier. For example, if we added up all the whole numbers from one to five, we’d have one plus five is equal to six, two plus four is equal to six. But then, we’d have this number left over in the middle. So if this had been our starting point for the problem, we’d have said that for five numbers, we can manage to get four of them to pair up to create two pairs and then we’d have this one number left over in the middle. And that three is the mean of the first number and the last number in the sequence. So one plus five, add them together, divide by two because there are two numbers there. And you get six over two, which is three.

And if we were trying to produce our general formula from this line of thinking, we’d say that the sum of the numbers is equal to the sum of the pairs plus the middle number. Now, what’s the sum of the pairs of the numbers? Well, we have five numbers and we’ve managed to use four of them to pair up to make two pairs. So however many numbers we’ve got, 𝑛, if we reduce that by one, that tells us how many numbers we’re going to be able to pair up. And the number of pairs because each pair consists of two numbers is gonna be half of that number. And the sum of each pair is still the first number plus the last number.

So we’re gonna multiply that number of pairs by the sum of each pair, one plus 𝑛. And we said that the middle number was just the mean of the first and the last number. So that’s one plus 𝑛 the last number all divided by two. Now, I’ve got a common factor of a half, which I can factorise out. So I’ve got a half times 𝑛 minus one times one plus 𝑛 plus one plus 𝑛. Well, now I’ve got a common factor of one plus 𝑛. So I’m going to factorise that out. And that’s gonna leave me with just 𝑛 minus one as the first term in the brackets there and one as the next term in the brackets because it’s just one lot of one plus 𝑛. So I’ve adjusted the formula to a half of one plus 𝑛 times 𝑛 minus one plus one.

Well, because we’re just adding and subtracting here, I can actually remove these brackets to leave me with 𝑛 minus one plus one. And of course, if I subtract one and then add one, that’s nothing. So inside that bracket, that just simplifies down to 𝑛. And of course, if I’ve just got 𝑛 in the brackets there, I actually don’t even need the brackets. So my sum — we’ve called 𝑠 — is equal to a half of one plus 𝑛 times 𝑛. Well, again, I can rearrange that. And we get the same formula we had last time.

So whether we’ve got an even number of terms or an odd number of terms, we can still use the same formula to add up all those numbers. Now, it doesn’t matter whether I add up the numbers one, two, three, up to 100 or if I do that backwards, from 100, 99, 98, down to one. So I’ve written both methods out here. And if I add those two rows together, I’ve got 𝑠 plus 𝑠 gives me two 𝑠. So I’ve got two times the sum of the numbers from one to 100 is 101 plus 101 plus 101, and so on, and so on 100 times. And that means that double the sum is going to be 100 times 101. In other words, two times the sum I’m looking for is 10100. So if I divide both those sides by two, I find that the sum of those numbers is 5050, which is the answer that I got before.

But the important thing is if I generalise this formula, I won’t have any worries about odd or even numbers of terms because I’m using every single term in the sequence. So writing out the sum of the numbers from one to 𝑛 forwards and backwards and then adding those two rows together, firstly, we get 𝑠 plus 𝑠 is equal to two 𝑠. Then, one plus 𝑛 is equal to one plus 𝑛. Two plus 𝑛 minus one, well, two minus one is one. So that’s just one plus 𝑛 again. Three plus 𝑛 minus two, well, three take away two is one. So we’ve got one plus 𝑛 again and so on. And then, we get 𝑛 minus two plus three. Well, negative two plus three is one. So again, we’ve got 𝑛 plus one or one plus 𝑛 and so on. So we end up with two times the sum is equal to 𝑛 lots of one plus 𝑛 or 𝑛 times one plus 𝑛.

And then, if I divide both sides of that by two, that’s the same formula we got before, but using a different method. So using that different method has helped us to verify that the formula is correct. The useful difference with this method though was that it didn’t seem to cause any confusion whether we had an even or an odd number of terms in the sequence.

But, finally, let’s try to visualise the problem in yet another different way, by drawing out dots in a pattern. Let’s just say we want to sum the numbers from one to five. We can represent those numbers using rows of one then two then three then four then five dots: one, two, three, four, five. So we’ve got a triangle of dots five rows high and 5 columns wide. How can we easily count how many dots that it’s got? Well, one way is to repeat the pattern. Then, we can rotate that second triangle of dots by 180 degrees and then slide it along over here.

Now, we’ve got a rectangle of dots with five columns and five plus one rows. We’ve got twice as many dots as we need. But more importantly, they make a nice rectangular pattern, which makes them easy to count. In this configuration, we just need to do five times six to give us 30 dots. But the number of dots that we’re looking for is half that number. And a half times 30 is 15. So there were 15 blue dots or in other words, summing the numbers from one to five gives us 15.

Now, let’s generalise that to 𝑛 rows in our triangle. I know it looks like there are five rows. But imagine there are loads more, and we don’t know how many there are. There are 𝑛 columns and 𝑛 plus one rows where we take that copy of our triangle of dots and make them into a rectangular pattern. So summing up double the number of dots that we want, that’s two times the sum, we’re going to do 𝑛 times 𝑛 plus one. As we said, that’s twice the number of dots we were looking for. So halving that gives us the sum is equal to 𝑛 over two times 𝑛 plus one. And now, we’ve got a third method of coming up with the same formula and of course checking our work.

Now, when we visualise the problem in that way and we think about when 𝑛 is one, or two, or three, and so on, we get a series of patterns. And the sums that we get when 𝑛 is one, and two, and three, and so on are called the triangular numbers. And Gauss also went on to work on the mathematics of these. Now, having arrived at the same formula three different ways, and I might say that there are lots of different ways of expressing that algebraically, we can apply it to any sequence of numbers from one to some number.

So when 𝑛 is 100, as we saw, the sum is 5050. When 𝑛 is 1000, the sum is 500500. When 𝑛 is 1000000, the sum is 500000500000. And even when we start off with a slightly less friendly number like 3643, the calculation isn’t trivial if you haven’t got a calculator, but it’s still a lot easier than adding up 3643 different numbers.