There is a story about when the famous mathematician
Carl Friedrich Gauss was a child and was behaving badly in school, his teacher tried 'punishing' him
and tasked him to add up all the numbers from 1 to 1000. Assuming that this would keep Gauss busyfor a while, the
teacher was rather surprised when a few minutes later Gauss asked for attention and told the teacher that the answer was
500,500.
How had Gauss figured this out? We do not know for sure, but he must have realized that for any summation of the
whole numbers 1 to N there must be a pattern and then figured out what that pattern was.
Let us try this. Let us try the numbers 1 to 10:
Number (N)
Sum to N
1
1
2
3
3
6
4
10
5
15
6
21
7
28
8
36
9
45
10
55
What is the pattern? Several options to choose from:
The sum equals the number (N) times (the number + 1) and then divide the result by 2:
SumN = N(N + 1) / 2 —>
The sum equals the square of the number plus the number, and that divided by 2.
SumN = (N2 + N) / 2
The sum is always the number divided by 2 plus 1/2, and that times the number:
SumN = ((N / 2) + 1/2) * N —>
So what is the sum of all whole numbers from 1 to 1000 (Sum1000)?
(1000 × 1001) / 2 = 500,500
(1000 × 1000 + 1000) / 2 = 500,500
(1000 / 2 + 1 / 2) × 1000 = 500,500
You decide which of these formulas you like best.
If you are curious to see how that sum from 1 to N behaves as N gets larger, play with it below: