## Saturday, February 27, 2016

### Triangular numbers

A triangular number $T(n)$ is defined as $n(n+1)/2$.  It is equal to the binomial coefficient $\left(\begin{array}{c}n+1\\2\end{array}\right)$ and is also equal to  $0+1+2+\cdots+n$. When is an integer $m\geq 0$ equal to a triangular number $T(n)$ for some integer $n\geq 0$?  We have $n(n+1) = 2m$. Using the quadratic formula to solve the quadratic equation $n^2+n-2m = 0$ for $n$, we obtain one solution for $n$:
$$n = \frac{\sqrt{8m+1}-1}{2}$$
The other solution for $n$ is negative (or complex) so we will not use that.
If $8m+1$ is not the square of an integer, then $n$ is not an integer.  If $8m+1$ is the square of an integer, then $8m+1$ is odd and thus $\sqrt{8m+1}$ is odd as well. This means that $n = \frac{\sqrt{8m+1}-1}{2}$ is an integer. Thus $m$ is a triangular number if and only if $8m+1$ is the square of an integer.