# Domino Functions

At Gram and Gramp’s this weekend we played dominos, and the question came up of counting a set of dominos.  In particular, Gramps wanted to know how many dominos there were in a set with double twelves.

After we were done playing, we lined them all up in the “domino triangle” with and Emery and I figured it out.    The domino triangle is simply an arrangement of dominos with double zero in one corner, the zero-one next to it, followed by zero-two (etc.), and with the double one at the end, followed by the double two (etc.).  Here is a partial rendering of the triangle for our double nine set:

+-+   +-+         +-+
|0|   |0|         |0|
+-+   +-+   ...   +-+
|0|   |1|         |9|
+-+   +-+         +-+

+-+         +-+
|1|         |1|
+-+   ...   +-+
|1|         |9|
+-+         +-+

...

+-+
|9|
+-+
|9|
+-+

To start, let $n$ equal the number of the largest double (twelve, if our case).  We’re looking for $f(n)$, which is the number of dominos in a set with largest double $n$.  Simply counting the dominos in the triangle gives us a values for our function, but not the one we want:

  n  | f(n)
-----+-------
0  |   1
6  |  28
9  |  55
12  |  ??

Before dealing with $f(n)$, let $g(n)$ denote the number of doubles in the set.  A quick glance at the triangle will show that the formula for this function is $g(n)=n+1$

because there is one double for each $[0, n] = \{x \in \mathbb{N} \,|\,0 \le x \le n\}$

Now thinking back to the “domino triangle”, it’s easy to see that $g(n)$ is both the width (base) and the height of the triangle.  If you recall from planar geometry, the area of a triangle is half it’s base times height: $\frac{base \times height}{2}$

So a first guess at $f(n)$ would be this: $f(n)=\frac{(g(n))^2}{2}$

But that isn’t correct.  Thinking back to the domino triangle quickly shows why.  If you were to take two copies of the triangle to make a rectangle (the reason the triangle area formula works), you’d see that you’d have to offset them by one domino in one direction, so the rectangle is actually $g(n)$ by $g(n) + 1$.  So the right formula is this: $f(n)=\frac{g(n)\,(g(n) + 1)}{2}$

Simplifying by inlining the formula for $g(n)$ yields: $f(n)=\frac{(n + 1)(n + 2)}{2}$

This turns out to be the correct formula, and yields 91 when its argument is twelve.  Thus a set of double twelve dominos will have 91 dominos.

What was particularly striking as Emery and I worked through the formulas, is that Emery had more trouble with the larger multiplication (which he hasn’t done in school) than following the function notation, doing the step-wise evaluation of the functions, and even the function nesting.