# Triangular Number as Alternating Sum and Difference of Squares

## Theorem

 $\displaystyle \forall n \in \N: \ \$ $\displaystyle \frac {n \paren {n + 1} } 2$ $=$ $\displaystyle \sum_{j \mathop = 0}^{n - 1} \paren {-1}^j \paren {n - j}^2$ $\displaystyle$ $=$ $\displaystyle n^2 - \paren {n - 1}^2 + \paren {n - 2}^2 - \cdots + \paren {-1}^{n - 1}$

Thus the $n$th triangular number can be expressed as the alternating sum and difference of squares:

So:

 $\displaystyle 1$ $=$ $\displaystyle 1^2$ $\displaystyle 3$ $=$ $\displaystyle 2^2 - 1^2$ $\displaystyle 6$ $=$ $\displaystyle 3^2 - 2^2 + 1^2$ $\displaystyle 10$ $=$ $\displaystyle 4^2 - 3^2 + 2^2 - 1^2$

and so on.

## Proof

The proof proceeds by induction.

For all $n \in \N_{> 0}$, let $\map P n$ be the proposition:

$\displaystyle \frac {n \paren {n + 1} } 2 = \sum_{j \mathop = 0}^{n - 1} \paren {-1}^j \paren {n - j}^2$

### Basis for the Induction

$\map P 1$ is the case:

 $\displaystyle \frac {n \paren {n + 1} } 2$ $=$ $\displaystyle 1$ $\displaystyle$ $=$ $\displaystyle 1^2$

which is seen to hold.

This is the basis for the induction.

### Induction Hypothesis

Now it needs to be shown that, if $\map P k$ is true, where $k \ge 1$, then it logically follows that $\map P {k + 1}$ is true.

So this is the induction hypothesis:

$\displaystyle \frac {k \paren {k + 1} } 2 = \sum_{j \mathop = 0}^{k - 1} \paren {-1}^j \paren {n - j}^2$

from which it is to be shown that:

$\displaystyle \frac {\paren {k + 1} \paren {k + 2} } 2 = \sum_{j \mathop = 0}^k \paren {-1}^j \paren {k - j + 1}^2$

### Induction Step

This is the induction step:

 $\displaystyle \sum_{j \mathop = 0}^k \paren {-1}^j \paren {k - j + 1}^2$ $=$ $\displaystyle \paren {k + 1}^2 - \paren {\sum_{j \mathop = 0}^{k - 1} \paren {-1}^j \paren {n - j}^2}$ $\displaystyle$ $=$ $\displaystyle \paren {k + 1}^2 - \frac {k \paren {k + 1} } 2$ Induction Hypothesis $\displaystyle$ $=$ $\displaystyle \frac {2 k^2 + 4 k + 2 - k^2 - k} 2$ multiplying everything out $\displaystyle$ $=$ $\displaystyle \frac {k^2 + 3 k + 2} 2$ simplifying $\displaystyle$ $=$ $\displaystyle \frac {\paren {k + 1} \paren {k + 2} } 2$ factoring

So $\map P k \implies \map P {k + 1}$ and the result follows by the Principle of Mathematical Induction.

$\blacksquare$