Toolkit 1

Sum of the first n integers

1+2++n=n(n+1)21+2+\cdots+n=\frac{n(n+1)}{2}

Proof

Let

S=1+2++n.S = 1 + 2 + \cdots + n.

Reversing the order of the terms gives

S=n+(n1)++1.S = n + (n-1) + \cdots + 1.

Adding these two equations term by term, we obtain

2S=(n+1)+(n+1)++(n+1).2S = (n+1) + (n+1) + \cdots + (n+1).

Since there are nn identical terms, each equal to n+1n+1,

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

Therefore,

S=n(n+1)2.S = \frac{n(n+1)}{2}.

Hence,

1+2++n=n(n+1)2.1 + 2 + \cdots + n = \frac{n(n+1)}{2}. \quad\square