Gauss’ Trick – A Staff Seminar

The Ministry is migrating nzmaths content to Tāhurangi.           
Relevant and up-to-date teaching resources are being moved to Tāhūrangi (tahurangi.education.govt.nz). 
When all identified resources have been successfully moved, this website will close. We expect this to be in June 2024. 
e-ako maths, e-ako Pāngarau, and e-ako PLD 360 will continue to be available. 

For more information visit https://tahurangi.education.govt.nz/updates-to-nzmaths

Getting started

Can you add up the first 10 numbers in your head? What about the first 100 or the first thousand? In your head!

Now Carl Friedrich Gauss was a special mathematician. The story goes that, in school, at the age of 8, he was able to add up the first 100 numbers extremely quickly. I like to think of the teacher as having used this trick many times to keep the class busy for long periods while he took a snooze. He knew that he was in for a long quiet period as the class slaved away. Even if one of them got an answer, the teacher could ask them to check it to take up more time. But he hadn’t bargained on this precocious 8 year old.

In a flash Gauss came out with 5050. But not only could he calculate the sum of the first 100 numbers that quickly, he could also justify the correctness of his answer. And so will you before you give this staff seminar.

You might like to read about Carl Friedrich on one of many web sites.  It would be worth jotting down a thing or two about Gauss. For instance, where did he live, when did he live, what domestic problems did he have, and the like. It would be worth getting out a map of modern Germany and showing where Brunswick (Braunschweig) is. From memory it’s not far from Hanover and the old East-West German border.

So what’s the trick and how can you impress your friends and colleagues with it?

 Example 1

What I’ll do first is to add up the whole numbers from 1 to 10 quite laboriously so that you can see how things work. Suppose that the sum of the first 10 numbers is S. Then

 S = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10.

 The interesting thing is that if we add the numbers up in the other direction we get the same answer. Well obviously! But let’s do it anyway.

S = 10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1.

So what? Well, I’ll make the ‘so what’ easier to see by putting these two ways of writing S under each other.

 S =   1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10.

S = 10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 +   1.

Now just add S to S. I know that we seem to be going further away from the S value that we are so keen to get but bear with me. What do you see? What patterns start to emerge?

 Fortunately for Gauss, and us,

 1 + 10 = 2 + 9 = 3 + 8 = 4 + 7 = 5 + 6 = 6 + 5 = 7 + 4 = 8 + 3 = 9 + 2 = 10 + 1 = 11.

 All of these pairs of numbers add up to 11! This means that

 2S = 11 + 11 + 11 + 11 + 11 + 11 + 11 + 11 + 11 + 11.

 There have to be ten 11s here so

 2S = 10 × 11 = 110.

 So S = 5 × 11 = 55.

 But this trick can’t be worked again and again and again. So we’ll milk it for all it is worth.

 Example 2

Let’s go for adding up Gauss’ numbers, all the whole numbers from 1 to 100. Again let S be this sum. So  S = 1 + 2 + 3 + 4 + 5 + … + 98 + 99 + 100.

Now you see that I have been rather lazy and omitted all the numbers from 6 to 97. But you and I know that they are really there. The ellipsis (…) tells us just that.

About turn!

S = 100 + 99 + 98 + … + 5 + 4 + 3 + 2 + 1.

Now let’s put those two things together and see what happens.

S =     1 +   2 +   3 + 4 + 5 +       …       + 98 + 99 + 100.

S = 100 + 99 + 98 +       …       + 5 + 4 +   3 +   2 +     1.

Here the magic sum is 101. Every pair of numbers, the one above the other, adds to 101. So 2S = 101 + 101 + 101 + … + 101 + 101 + 101.

The only problem that we have now is to work out how many 101s there are. But that shouldn’t really be a problem. After all we started off with 100 numbers so we must have 100 sums that add to 101. So 2S = 100 × 101.

 This means that S = 50 × 101 = 5050.

 And Gauss got there just a century or two ahead of us.

 Can you now see a quick way to add up the first 1000 whole numbers? How about the first 10,000 or the first 100, 000, or the first million?

 Example 3

I’ll do one more final example before we do what every good mathematician does and that is to try to generalise what we have been doing. In other words we’ll try to look for a pattern. But in the meantime, let’s add up the first the first 67 whole numbers.

S =   1 +   2 +   3 + … + 65 + 66 + 67.

S = 67 + 66 + 65 + … +   3 +   2 +   1.

This time the key is 68. After all, 1 + 67 = 68 = 2 + 66 = 3 + 65 = …

So 2S = 68 + 68 + 68 + … + 68 + 68 + 68. 

Then we are again faced with trying to work out how many of these sums there are. But we started off with sixty-seven numbers so we have to have sixty-seven 68s. So 2S = 67 × 68, or S = 67 × 34 = 2278.

Any guesses for the general pattern here?

Generalisation

I guess that we should have enough info to be able to find the sum of the first n whole numbers, where n is any value that we like. Let’s look at what we’ve got to see if we can make a conjecture, a guess, as to what is really going on.

 We started with                  n = 10 and got S = 10 × 11 ÷ 2;

then                                    n = 100 gave us S = 100 × 101 ÷ 2;

then                                    n = 67 gave us S = 67 × 68 ÷ 2.

 It looks as if we need to take the number we’re interested in summing up to, multiply by that number plus 1 and then divide by 2. So we have

 Conjecture 1: The sum, S, of the first n numbers is S = (n x (n +1)) / 2. 

 Can we justify, prove, this?

 Well let S be the sum of the numbers from 1 up to n, whatever n is.

 If your algebra is a little rusty, then change n below to ‘any number’, change n – 1 to ‘any number minus one’, change n + 1 to ‘any number plus one’, and so on.

 Using the tried and true method, we get 

 S = 1 +      2     +     3     + … + (n – 2) + (n – 1) + n.

S = n + (n – 1) + (n – 2) + … +     3      +     2     + 1.

 So doing what now comes naturally, we get

 2S = (n + 1) + (n + 1) + (n + 1) + … + (n + 1) + (n + 1) + (n + 1).

As there were n numbers to start with, there must now be n lots of (n + 1). So

2S = n × (n + 1).

So S = (n  x (n+1))/ 2. 

Looks like we nailed the conjecture. You might like to think about the following questions before you go on.

 (i)      Does this formula give the right answer if n = 15?

(ii)     Surely S has to be a whole number as we are adding up the first n whole numbers. But we are dividing by 2 on the Right Hand Side of the equation. Might n × (n + 1) sometimes be odd and so mess things up?

(iii)    What does this formula say in words?

 Pushing it a bit further

But you don’t have to stick to adding just the first so many numbers. Suppose that we wanted to add up all the numbers from 8 to 93. How could we do that?

It seems to me that we could do it at least three ways but I won’t bother with the one where you add the numbers together one at a time.

Method 1: We could write out the numbers from 8 to 93 in the normal order and then write them backwards as we’ve been doing in the other examples. I’ll leave you to do that to see what you get.

Method 2: On the other hand, we could first add 1 to 7 and then 1 to 93 using our formula. Then we could subtract the smaller from the larger. Like this:

In 1 + 2 + … + 6 + 7, ‘any number’, n is 7, so the sum of these numbers is  (7 x 8) /2 = 28.  

In 1 + 2 + … + 92 + 93, ‘any number’, n is 93, so the sum of these numbers is (93 x 94)/2 = 4371. 

So the sum that we want is 4371 – 28 = 4343.

 You might like to think about the following questions before you go on.

(iv)    Is there a formula for the sum of the numbers from any number you choose (like 8) up to any other number you choose (like 93)? In other words, can you generalise conjecture?

(v)     Can you see how we are slowly building up into more complicated situations? This is the way that mathematics always tries to go to increase what we know about the world.

(vi)    In the light of the thought in (v), where should we head next? What is the next way to extend what we are doing? We’ve tried going from 1 to something and then something to something else, but the steps up from number to number have always been one. Can we make any progress if the steps are bigger than one?

(vii)   At the end of the day is there just one formula for a range of additions that are not simply adding the first so many numbers? What might this formula be in words?

The seminar

Once again you’ll have to think of a way to present this material that is best for your staff but how about the following?

 Set them up by asking them the question that Gauss’ teacher asked him. Let them work on it for a moment. Then let them know that an 8 year old can do this in his head. That should lead to a hunt to find some patterns in the numbers 1 to 100 that might make it easier to do the summation quickly. For instance, some groups see that 1 + 100 = 2 + 99, and so on. They generally won’t think about adding two lots of S sums together. But you can add the numbers from 1 to 100 together quickly this other way too.

 Then try them with other examples. If you arm yourself with a calculator you might challenge them to add the numbers from 1 to anything they choose quicker than you can.

 They should then be thinking what is it that you know that they don’t? Get them to do a few examples and ask them to conjecture what the pattern is.

 Depending how well things are going you might press on to some Arithmetic Progressions where the common difference is not 1 (see section 8). With an interested group you could even do the proof.

 But you should say something about Gauss and his importance on the mathematical scene. You should also find some interesting stories about him in the link I gave above. A bit of history never goes astray.

Some questions answered

In this section we complete the work that we did in Sections 2 to 6. Of course, how far you go with this problem will depend on the algebraic confidence of your staff, though you can bypass algebra completely if you think that it will go over like a lead balloon. Anyway, try to push them a little out of their comfort zone but throw them a lifeline when they are drowning. We leave that decision to you but there ought to be enough material here for your seminar.

 What I am going to try to do now is to find a formula for the sum of a string of numbers where the step up from one number to the next is always the same. I’ll do two examples and then solve the problem in general.

 First example: Sum the numbers 2 + 4 + 6 + … + 64 + 66 + 68.

 We can do this in several ways. Straight adding is one, as is dividing all of the numbers in the sum by 2 and using the formula that we know. However, I’m going back to the tried and true ‘first forward then backwards’ method. So let S be the sum we’re after. So, forwards then backwards we have

 S =   2 +   4 +   6 + … + 64 + 66 + 68.

S = 68 + 66 + 64 + … +   6 +   4 +   2.

 That means that 2S = 70 + 70 + 70 + … + 70 + 70 + 70.

 The only problem now is how many terms are there? Well if we had divided all of the original numbers by 2 we would have had 1 + 2 + 3 + … + 32 + 33 + 34. Since there are 34 terms here, there have to be 34 terms in S. So 2S = 34 × 70 and S = (34 x 70) /2 = 1190.

You might like to check this by one of the other methods but it does look a bit like the formula that we found in section 5.

Second example: Sum the numbers 9 + 12 + 15 + … + 54 + 57 + 60.

We can do this in several ways. Straight adding is one, as is dividing all of the numbers in the sum by 3 and using the formula that we know. However, I’m going back to the tried and true ‘first forward then backwards’ method. So let S be the sum we’re after. So, forwards then backwards we have

S =   9 + 12 + 15 + … + 54 + 57 + 60.

S = 60 + 57 + 54 + … + 15 + 12 +   9.

That means that 2S = 69 + 69 + 69 + … + 69 + 69 + 69.

 The only problem now is how many terms are there? Well if we had divided all of the original numbers by 3 we would have had 3 + 4 + 5 + … + 18 + 19 + 20. Since there are 20 – 2 = 18 terms here, there have to be 18 terms in S. So 2S = 18 × 69 and S = (18 x 69) / 2 = 621.

 You might like to check this by one of the other methods. Is there a pattern here? Do those words sound familiar?

 General example: First of all can we guess what we hope to find? We’d like to find a formula for the sum of a set of numbers that start somewhere and got to somewhere else but where the step between numbers is always the same. From the information that we have, can we guess what the formula might be before we wade through the mess of algebra that we are going to come across to get the answer? In each case, what are the two numbers that we are multiplying together to get the S?

 Well we know that when we added from 1 to n the numbers were n and n + 1. When we added from 2 to 68 they were 34 and 70; when we added from 9 to 60, they were 18 and 69.

 Clearly in each case the bigger number is the common sum that we get by adding the high numbers with the low numbers. These bigger numbers are just the sum of the smallest and the largest numbers.

 What about the 34 and the 18? And how do they relate to the n we got when adding up the first n numbers. What do they all have in common? Aren’t they just the number of numbers that we are adding? Does that mean that the formula we should get is given in the next conjecture?

 Conjecture 2: If S is the sum of any of these strings where there is a common difference, S = ( (number of terms)(sum of first and last numbers) )/2

 Check the formula out for some other sets of numbers that start somewhere and go up by a constant amount. In other word, sets of numbers where there is a common difference between consecutive numbers.

 At this stage we have a conjecture as to what the answer might be. It’s a pretty strong conjecture because it works for lots of examples. But can we prove that it works for every set of numbers with the common difference property? Well, of course we can. And we’ll show it by a word method first and then see how much easier it is to express the same thing using algebra.

 Suppose that the set of numbers is some number, the first number; some number plus a common difference, the second number; some number plus a common difference plus a common difference, the third number; up to the biggest number, the last number.

 Then the sum S can be written in the usual two ways:

 S = first number +    second number     + … + second last number + last number

S = last number  + second last number + … +    second  number    + first number.

 Now first number + last number = second number + second last number. That’s because we go up by the common difference going from the first number to the second number, and down by the common difference going from the last number to the second last number. So, as usual, all the separate sums are the same. So

 2S = (first number + last number) + (first number + last number) + … + (first number + last number) + (first number + last number).

 But there is one of the sums in brackets for each of the terms of the original sum. So  2S = (number of terms)(first number + last number), and so S = (number of terms)(first number + last number) ÷ 2.

 This is what we conjectured up above. And now we have proved the conjecture and it’s true for any set of numbers that goes up in steps that are the same. These sets are called Arithmetic Progressions.

 Incidentally mathematicians worked much the way that we have done above until the invention of algebra. Even in Newton ’s work you’ll find equations with words in. It’s not too bad here but it can get very cumbersome. The arrival of algebra made a great improvement to mathematical life.

 If you want the full algebraic version, here it is. Let the first term be a, the common difference be d, and the number of terms n. Then

 S =  a + (a + d) + (a + 2d) + … + [a + (n – 3)d] + [a + (n – 2)d] + [a + (n – 1)d]

S = [a + (n – 1)d] + [a + (n – 1)d] + [a + (n – 1)d] + …+ (a + 2d) + (a + d) +  a

 So 2S = [2a + (n – 1)d] + [2a + (n – 1)d] + [2a + (n – 1)d] + … + [2a + (n – 1)d] + [2a + (n – 1)d] + [2a + (n – 1)d]

 or S = n[2a + (n – 1)d] ÷ 2.

 One advantage of this method is that it’s easier to see that the sum of each pair of corresponding terms is the same. Another is that it writes the answer in terms of the first term, the number of terms and the common difference. The only drawback seems to be that it hides the fact that the formula includes ‘the first number plus the last number’ by writing that expression as [2a + (n – 1)d]. And the form that we wrote it in Conjecture 2 is easier to remember.