Tuesday, September 29, 2009

Is zero a triangular number?



Neil Sloan's On-Line Encyclopedia of Integer Sequences, which everyone who works seriously (or recreationally) with integer sequences regards as the ultimate authority, lists the triangular numbers as sequence A000217, and unambiguously includes 0 as a triangular number:
0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406, 435, 465, 496, 528, 561, 595, 630, 666, 703, 741, 780, 820, 861, 903, 946, 990, 1035, 1081, 1128, 1176, 1225, 1275, 1326, 1378, 1431,...
It was brought to my attention that all the references on this blog to triangular numbers (and to all other polygonal numbers) have omitted the 0 and started at 1. Please bear this omission in mind when browsing these pages - sometimes you might want to add a zero to the beginning of the sequences (but sometimes maybe not).

I am consoled, only somewhat, by the fact that wikipedia and mathworld (two other august authorities on sequence-related matters) also omit the zero from their triangular number lists.

This reminds me of the age-old question:

Is zero a natural number?

Putting the definition of the natural numbers on the chalkboard is always dangerous - you risk having some student insist that your definition is wrong, wrong, wrong because they were taught that natural numbers included (or excluded) zero, and yours doesn't. It seems that most sources, including Sloan's OLEIS, say that 0 is not natural (see A000027).

I suspect that (most) mathematicians do not care (much) about this - they just redefine the term "natural number" to be what they need it to be at the moment they happen to be using it. If they need a zero, they add a zero, and move on.

Wikipedia suggests that when you encounter a situation where it might matter, one should use $\mathbb{N}_0$ when zero is to be included, and $\mathbb{N}$ when it isn't (or when it doesn't matter).

The comparison between the triangulars and the naturals is not spurious. Wikipedia defines the triangulars as sums of the naturals (I, somewhat strangely, tend to think of naturals as one-dimensional triangular numbers). If this is your chosen definition then you are likely not to include zero, and you might use this formula:
\[t_n = \sum^{n}_{i=1}i.\]
However, if we want to rehabilitate this particular formula for the triangulars + 0, we just need to adjust the index:
\[t_n = \sum^{n}_{i=0}i\]
What about other triangular number formulas? Can they all include zero too? Well, the simplest, $t_n = \frac{n(n+1)}{2}$ works just fine when you let $n=0$.

Sometimes, when we are thinking of how they relate to the binomial coefficients, we might want to use this formula:

\[t_n = \left( \begin{array}{c} n +1 \\2\end{array} \right) \]

This might give you pause, because when $n = 0$ we seem to be "out of bounds." Luckily we have:

\[\left(\begin{array}{c} n \\r \end{array}\right) = 0 \mbox{ for } r > n\]

Which is exactly what we need.

As far as the posts on this blog are concerned, the only way of expressing the triangulars that needs obvious modification in order to work for the triangulars + 0 is the generating function:

\[g(x) = \frac{1}{\left( 1-x \right)^{3}} = 1 +3x + 6x^2 + 10x^3 + ...\]

which gives the triangulars as in the coefficients on the right hand side. To have a generating function for the triangulars + 0 you need to modify this to be:

\[g(x) = \frac{x}{\left( 1-x \right)^{3}} = 0 +x +3x^2 + 6x^3 + 10x^4 + ...\]

Multiplying by $x$ is the generating-function equivalent to shifting indexes, which is what we had to do for our first formula.

Thanks to Alexander Povolotsky for bringing these issues to light.