Escolar Documentos
Profissional Documentos
Cultura Documentos
There’s a popular story that Gauss, mathematician extraordinaire, had a lazy teacher. The so-called
educator wanted to keep the kids busy so he could take a nap; he asked the class to add the numbers 1 to
100.
Gauss approached with his answer: 5050. So soon? The teacher suspected a cheat, but no. Manual addition
was for suckers, and Gauss found a formula to sidestep the problem:
Sum from 1 to n =
Let’s share a few explanations of this result and really understand it intuitively. For these examples we’ll add
1 to 10, and then see how it applies for 1 to 100 (or 1 to any number).
1 2 3 4 5
10 9 8 7 6
An interesting pattern emerges: the sum of each column is 11. As the top row increases, the bottom row
decreases, so the sum stays the same.
Because 1 is paired with 10 (our n), we can say that each column has (n+1). And how many pairs do we
have? Well, we have 2 equal rows, we must have n/2 pairs.
Let’s add the numbers 1 to 9, but instead of starting from 1, let’s count from 0 instead:
0 1 2 3 4
9 8 7 6 5
By counting from 0, we get an “extra item” (10 in total) so we can have an even number of rows. However,
our formula will look a bit different.
Notice that each column has a sum of n (not n+1, like before), since 0 and 9 are grouped. And instead of
having exactly n items in 2 rows (for n/2 pairs total), we have n + 1 items in 2 rows (for (n + 1)/2 pairs
total). If you plug these numbers in
which is the same formula as before. It always bugged me that the same formula worked for both odd and
even numbers – won’t you get a fraction? Yep, you get the same formula, but for different reasons.
Instead of looping the numbers around, let’s write them in two rows:
1 2 3 4 5 6 7 8 9 10
10 9 8 7 6 5 4 3 2 1
But we only want the sum of one row, not both. So we divide the formula above by 2 and get:
Now this is cool (as cool as rows of numbers can be). It works for an odd or even number of items the
same!
Instead of writing out numbers, pretend we have beans. We want to add 1 bean to 2 beans to 3 beans… all
the way up to 5 beans.
x
x x
x x x
x x x x
x x x x x
Sure, we could go to 10 or 100 beans, but with 5 you get the idea. How do we count the number of beans in
our pyramid?
Well, the sum is clearly 1 + 2 + 3 + 4 + 5. But let’s look at it a different way. Let’s say we mirror our
pyramid (I’ll use “o” for the mirrored beans), and then topple it over:
x o x o o o o o
x x o o x x o o o o
x x x o o o => x x x o o o
x x x x o o o o x x x x o o
x x x x x o o o o o x x x x x o
Cool, huh? In case you’re wondering whether it “really” lines up, it does. Take a look at the bottom row of
the regular pyramid, with 5′x (and 1 o). The next row of the pyramid has 1 less x (4 total) and 1 more o (2
total) to fill the gap. Just like the pairing, one side is increasing, and the other is decreasing.
Now for the explanation: How many beans do we have total? Well, that’s just the area of the rectangle.
We have n rows (we didn’t change the number of rows in the pyramid), and our collection is (n + 1) units
wide, since 1 “o” is paired up with all the “x”s.
Notice that this time, we don’t care about n being odd or even – the total area formula works out just fine. If
n is odd, we’ll have an even number of items (n+1) in each row.
But of course, we don’t want the total area (the number of x’s and o’s), we just want the number of x’s.
Since we doubled the x’s to get the o’s, the x’s by themselves are just half of the total area:
Number of x’s =
And we’re back to our original formula. Again, the number of x’s in the pyramid = 1 + 2 + 3 + 4 + 5, or the
sum from 1 to n.
So let’s figure out the sum. If we have 100 numbers (1…100), then we clearly have 100 items. That was
easy.
To get the average, notice that the numbers are all equally distributed. For every big number, there’s a
small number on the other end. Let’s look at a small set:
1 2 3
The average is 2. 2 is already in the middle, and 1 and 3 “cancel out” so their average is 2.
1 2 3 4
the average is between 2 and 3 – it’s 2.5. Even though we have a fractional average, this is ok — since we
have an even number of items, when we multiply the average by the count that ugly fraction will disappear.
Notice in both cases, 1 is on one side of the average and N is equally far away on the other. So, we can say
the average of the entire set is actually just the average of 1 and n: (1 + n)/2.
1. Adding up numbers quickly can be useful for estimation. Notice that the formula expands to this:
Let’s say you want to add the numbers from 1 to 1000: suppose you get 1 additional visitor to your site
each day – how many total visitors will you have after 1000 days? Since thousand squared = 1 million, we
get
2. This concept of adding numbers 1 to N shows up in other places, like figuring out the probability for the
birthday paradox. Having a firm grasp of this formula will help your understanding in many areas.
3. Most importantly, this example shows there are many ways to understand a formula. Maybe
you like the pairing method, maybe you prefer the rectangle technique, or maybe there’s another
explanation that works for you. Don’t give up when you don’t understand — try to find another explanation
that works. Happy math.
By the way, there are more details about the history of this story and the technique Gauss may have used.
1. Here is a more generic way to think about this that lets you calculate any equally spaced series of
numbers:
1+2+3+4+5 = 15
n = number of digits in the set
a = the first digit in the set
b = the last digit in the set
(n(a+b))/2 = total
(5(1+6))/2 = 15
1 3 5 7 9 = 25
(5(1+9))/2 = 25
The explanation is really the same as the first explanation above. The difference is that we don’t
automatically add 1, we add the first number in the set. Adding the first number to the last number
is how we “pair” each number together. Pairing means to group each number in twos such that all
pairs sum to the same number (which is why this only works on equally spaced digits).
3 5 7 9 11 = 35
(5(3+11))/2 = 35
5 9 13 = 27
(3(5+13))/2 = 27
2. Hi xilplaxim, thanks for the insight! Yep, you can extend the explanations above to almost any
sequence. Here’s something interesting as well that you made me think of — let’s say your pattern
is
1 2 _ 4 5 _ 7 8 _ 10 11 _ 13 14 …
(multiples of 3 are intentionally removed). That seems like a tricky pattern to add up, but you can
realize it’s the same as the full pattern
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
3 6 9 12 15
You can use the formula to find the full pattern (1 to 15 = 15*16/2 = 120) and subtract off the
holes using your formula (3+6+9+12+15) = 5*18/2 = 45). So we do 120 – 45 and get 75, which is
the sum (details here).
Your pattern formula can help subtract away any “gap” you want, which is pretty interesting!
Thanks again for the note.
3. can we use the following method to sum when there are odds?
Instead of 0 can we assume n+1 as our last no i.e.n and afterwards subtract tht no. from the sum.
4. cool
6. @Archana: That’s interesting way of looking at it, you can do that too. Let’s say you’re adding 1-5.
Rather than n=5, have m=6. Then you can do
Sum from 1-6 = m * (m+1)/2 = 6*7/2 = 21. And you subtract m to get
Of course, the formula n(n+1)/2 works no matter if n is even or odd. But that’s a good way to think
about the odd case.
8. So how would I figure out the ammount of odd numbers from 1-100?
9. Hi PJ, good question. To find the odd numbers from 1-100 (1 to 99, really), I’d use technique #2
(Use two rows):
10.
11. 1 3 5 7 ... 97 99
12. 99 97 95 93 ... 3 1
13.
Notice how each row ads to 100 (n). How many rows do we have? 50. [1-4 is 2 odd numbers, 1-6
has 3 odd numbers... 1-n will have n/2 odd numbers). Lastly, we have twice the amount of
numbers we need, so we must divide by 2 again.
So the sum of odd numbers 1 to n [where n is even] would be n * (n/2) * 1/2. In this case, 100 *
50 * 1/2 = 2500.
14. When I was 12 or 13 (about 3 years ago), I found this way to derive the formula, which is quite
similar but not the same as your triangle method.
x
xx
xxx
xxxx
xxxxx
The number of Xs is the sum of 1, 2, 3, 4, and 5. Here’s how I derived the formula (Xs are the
important elements of the triangle, Os are used to show what I don’t count, parentheses are used to
show what I eliminate, and N is the number you want the sum up to).
xxxxx N
xoooo
xxooo
xxxoo N^2
xxxxo
xxxxx
Squaring N, you get the triangle and some extra elements (which need to be eliminated)
xoooo
xxooo
xxxoo N^2-N
xxxxo
(xxxxx)
There are no Os you need to eliminate in the bottom row, so you can remove it and add it back
later.
x(oooo)
xx(ooo)
xxx(oo) (N^2-N)/2
xxxx(o)
(xxxxx)
Half of the elements above the bottom row are Os, so dividing by two gives you the number of Xs.
x(oooo)
xx(ooo)
xxx(oo) (N^2-N)/2+N
xxxx(o)
xxxxx
Add the original bottom row. You now have the triangle.
Time for my favorite part: changing how an equation looks. (N^2-N)/2+N is too sloppy.
That’s how I thought about it at the time, when I was bored one night. Yes, I developed theorems
when I was 13. I still haven’t stopped. I like that way of looking at it, and when I showed that to my
math class, most everyone understood what I was doing. Just goes to show you that there are no
end to the ways that you can derive a formula.
Yep, it goes to show that there are so many ways of looking at a single formula .
16. Hi. What if I wanted to find the sum of all even numbers between 80 to 560?
17. I like your ‘Many explanations will just give the explanation above and leave it at that. I won’t.’
Kudos on your dedication. I have bookmarked your page for future reference.
Leonard Juska
Costa Mesa, CA USA
P.S. If there ever is time, I want to revisit a book I read as a child called
The Trachtenburg Speed System of Basic Mathematics by Ann Cutler and Rudolph McShane of the
work by Jakow Trachtenburg. Bantam Books 553 07020 150 First printing 1960; I have a 1973
copy. Intuitive adventure.
18. @Jenn: Hi Jenn, you could try matching up the numbers like this (using technique #2):
80 82 84 86 …
560 558 556 554 …
@Leonard: Thanks for the comment! Glad you enjoyed it; that looks like an interesting book
20. Thank you so much for that explanation. I had learned this same formula in my Maths class without
knowing how it had been derived. I had to use this formula to find the sum of series in arithmetic
progression, and now, I wonder why I hadn’t seen this site before.
25. For adding the odds (whether the no of numbers is odd or even ) this also works well. Using the
same anology given by you,
1+3+5+…..n= (n+1)^(2)/4
For e.g.
1+2+3+…+100 =100*101/2 = 5050
2+4+6+ +100 = 2*(1+2+…+50)=2*50*51/2= 2550
1+3+5+….+99 = (99+1)^(2)/4=100*100/4 = 2500
for n= ????
Please it urgent
28. amazing site, thanks for all. You give an enormous inreachment for math. Magdi
Magdi Ragheb — June 3, 2009 @ 12:56 am
Maria the best watford grammar pupil ever — June 10, 2009 @ 1:21 pm
32. cheers
34. i have a Q :if i wants to add from any other no. to 100 ??
thx alot
35. @nada: If you want to add 47 to 100, for example, you can do this: Add 1 to 100 (all the numbers:
(100 * 101)/2) and the subtract the sum of 1 to 46 (all the numbers you don’t want (46 * 47)/2).
36. My question is how to add/count every “1″ found between 0 and any end point. End Point could be
10,000. Thanks.
37. I stumbled across your page while looking for an answer to the same question posed in #30, but
was intrigued by all the methods described here. I was trying to figure out a way to map a series of
numbers (say 1 through 15) to a smaller result set of numbers (say 1 through 5) such that:
1 => 1
2,3 => 2
4,5,6 => 3
7,8,9,10 => 4
11,12,13,14,15 => 5
as I was pondering how to write a mathematical function to get a result (instead of doing brute
iteration) I realized that this smacked of Gauss. Not being able to memorize formulas, I sat down
with a piece of paper and tried summing 1 through 100. I cut the set in half, yielding 1 through 50
and 51 through 100. The two ‘half’ sets match such that you can make a pair using one number
from each half-set that adds up to 101 (1 + 100, 2 + 99, 3 + 98, etc). There are exactly 50 such
pairs (100/2), so the sum must be 101*50. Making a formula, this makes (X+1)*(X/2) which is the
same as ((X+1)*X)/2, which brings us back into familiar territory.
Thanks for an interesting article, and for reassurance that the math actually works.
now … how to invert a parabolic function … *heads back to google*
39. Hi- love this page, very helpful, but I’m stuck trying to figure out how to work out a formula that
works out the sum of all the numbers up to that one (can’t explain it properly)…
1..1 (sum=1)
2..3 (sum=3+1=4)
3..5 (sum=5+3+1=10)
4..10 (sum=10+5+3+1=20)
5..15 (sum=35)
6..21 (sum=56)
so when n=6 the answer is 56, how do you work out a formula for when n=12 or 112?
Help please, I’m going stir-crazy!
41. Thank you very much! I will be using this story in an introductory class to programming, and the 4
listed techniques will really help in explaining the solution.
Cheers
42. Thank you thank you thank you! I’ve heard the story you opened with before, but never knew the
answer… I’m soooo glad I stumbled upon your explanation. My life is forever improved!
Mel — February 2, 2010 @ 12:11 am
45. Here’s a formula I came up with to sum a series of evenly spaced values. You do not need to know
the number of values in the set.
If counting by twos…
If counting by threes…
I just found half of x, added .5 to it, and multiplied x with (one half of x + .5)
49. is there a formula to add numbers like 1-100 but starting from lets say 40-100?
sascha — April 28, 2010 @ 12:15 pm
50. @sascha: Great question! Actually one way to do this is to add 1 to 100, and then subtract 1 to 39
. You’ll be left with 40-100. Another way is to start writing the numbers like this:
40 41 42 43…
100 99 98 …
And use the techniques above. Note that 40 to 100 is actually 61 numbers, just like 40 to 41 is 2
numbers. So it’d be 61 * (40 + 100) / 2.
51. I revising for my Grade 5 maths paper and i really didi not understand the concept and your
explanation really helped. Thank you sooo much!!!
53. Great stuff on this page. I trying to find the sum of the even numbers 6 — 100. Any help would be
great.
And to add 3..50, you can just add 1..50 and remember to subtract off the first 2 numbers (1+2).
So 3-50 is [50*51/2 - 3], and multiply the whole thing by 2 to make it 6-100.
55. Hi, I like to know who made this formel first time, and when? thank U.
56. Hey thanks for this article- it’s helped me heaps with my year 7 assignment
57. Is there any method to find n digit numbers which are both perfect and perfect cube
Divya — August 16, 2010 @ 6:28 am
61. actually i have my own formula to add all numbers from 2-100 .. w/c is much easy for me..
Hxh+(Lxh)
H=highest number
L=lowest number
h=half of the numbers u want to add
(in “h”..example u want to add all numbers from
2-10..it means u will add 9 numbers…divide it in 2= 4.5)
example..
formula
Hxh+(Lxh)
= 10×4.5+(2×4.5)
= 45+9
= 54 . . .
^^
Home
All Posts
About
FAQ
Contact
Shared Links
ebook
If you’re like me, the second statement makes your jaw drop. 56 billion is just another large number, but
$3000 per minute is something vivid and “imaginable”. Let’s check out a few ways to convey a sense of
scale.