What is 1 + 2 + ⋯ (till n)?
Saturday, June 04, 2022
The answer is:
n × (n + 1) / 2
Let's check with an example, n = 4.
1 + 2 + 3 + 4
= 4 × (4 + 1) / 2
= 4 × 5 / 2
= 10
= 4 × (4 + 1) / 2
= 4 × 5 / 2
= 10
Yep. That's right.
Let's see if we can prove this...
(Continue scrolling to play the animation. Please use a smooth scrolling device like a touchscreen or a trackpad.)
Let's represent
1
to
n
with balls.
The number of yellow balls =
1 + 2 + 3 + ⋯ (till n)
1 + 2 + 3 + ⋯ (till n)
Double the number of balls,
and make a grid.
and make a grid.
The first row has
1
yellow &
n
blue balls.
A total of n + 1 balls.
A total of n + 1 balls.
The second row has
2
yellow &
n-1
blue balls.
Again, a total of n + 1 balls.
Again, a total of n + 1 balls.
Every row has
n + 1
balls!
The grid has a total of n × (n + 1) balls.
The grid has a total of n × (n + 1) balls.
The number of yellow balls
is half that = n × (n + 1) / 2
is half that = n × (n + 1) / 2
Therefore,
1 + 2 + ⋯ (till n) = n × (n + 1) / 2
1 + 2 + ⋯ (till n) = n × (n + 1) / 2
(@-me on twitter @kssreeram for comments and feedback.)