We've all been there. Someone having innocently suggested that a nice board game was a traditional way to endure the hours while your relatives visit, and despite your kind offer to teach them all to play your favourite RPG, the Monopoly box has been ceremonially dug out from your brother's closet and wrested open (or rather apart) only to reveal a complete absence of random-number generating equipment. Since everyone has at one time or another seen your hoard of little plastic polyhedra scattered among sheets of graph paper and illegible notes on the dining table, it is you who are immediately charged with rectifying the omission. But alas, all you can dig up that has not been lost, stolen, confiscated or eaten is a d4, a d9 and some figure paints.

Now being the geek that you are, of course you know that once you have any source of entropy whatsoever, all you need to do is read off as many bits as required and deduce the die roll by reverse arithmetic compression. However, the reality of the situation is that even if your annoying six-year-old cousin groks this system, your great-aunt Pamela certainly won't; so it looks like you have to provide a collection of dice such that all your family have to do is to roll them and add the numbers on the topmost faces.

So you could just bring down the dice you have and hope for the best. For Monopoly, this might be good enough. Trouble is, tonight after a couple of whiskies, Pamela will be bored with Monopoly and will be trying to engage all comers at craps. Now normally you can make about a 1% profit on this part of the evening, but craps is a very finely balanced game, and if you've brought dice with the wrong probabilities, you can say good-bye to your Christmas bonus right there. Fortunately, you've read this writeup and so you're able to repaint the two dice you have so that the probability distribution of the sum of their faces is exactly the same as for two normal dice.


Warning! Mathematics starts here!
Mathematics-haters should skip to the conclusions at the end of the writeup.


So how did you do it? The secret, as with so many things in life, is that you paid attention in your generatingfunctionology class. We'll define the generating function for a die D to be the sum fD(x) = Σixn(i), where n(i) denotes the number shown on the ith face.

The marvellous thing about this definition is that if you have two dice D, E then the generating function for the random number generated by rolling both and summing the results is just the product fDfE of the generating functions for the two dice. (Note: it would be more logical to divide through by the number of sides of the die so that fD(1) = 1, but we won't do that because it clutters up the page and because it only comes back to bite us when we try to convert our results back into real dice.)

So in these terms, we're trying to solve the identity A(x)B(x) S(x)2, where S(x) is the generating function for an ordinary six-sided die, and A and B are generating functions which we must find, for a four-sided and a nine-sided die respectively. These conditions can be expressed as:

Since our generating functions today are polynomials in one variable, they form a unique factorization domain, which means that to find solutions to an equation “A times B equals something known” like the one we have, all we have to do is to write down the factorization into irreducibles of the right-hand side:

A(x)B(x) = x2(1+x)2(1+x+x2)2(1-x+x2)2

Then the different solutions correspond to the different ways of distributing the factors between A and B. But evaluating the factors at x = 1 gives respectively 1, 2, 3, 1, and so to satisfy the second bullet point above we must give both factors (1+x) to A and both factors (1+x+x2) to B. Also, notice that multiplying a generating function by x just corresponds to adding 1 to all the faces of the die—clearly, adding 1 to one die and subtracting 1 from the other die will make no difference to the total—so we may as well just assume that the lowest number on each die is 1, that is, that each of A and B contains one factor x. So we're left with three possibilities, depending on whether the remaining factors (1-x+x2) contribute both to A, both to B, or one to each:

  • Both to A: A = x(1+x)2(1-x+x2)2 = x+2x4+x7 and B = x(1+x+x2)2 = x+2x2+3x3+2x4+x5
    and so the dice are numbered (1, 4, 4, 7) and (1, 2, 2, 3, 3, 3, 4, 4, 5)
  • One to each: A = x(1+x)2(1-x+x2) = x+x2+x4+x5 and B = x(1+x+x2)2(1-x+x2) = x+x2+2x3+x4+2x5+x6+x7
    and so the dice are numbered (1, 2, 4, 5) and (1, 2, 3, 3, 4, 5, 5, 6, 7)
  • Both to B: A = x(1+x)2 = x+2x2+x3 and B = x(1+x+x2)2(1-x+x2)2 = x+2x3+3x5+2x7+x9
    and so the dice are numbered (1, 2, 2, 3) and (1, 3, 3, 5, 5, 5, 7, 7, 9)

Conclusions


So you found the three ways to number the dice so as to keep everyone happy—including, interestingly, one in which the four-sided die has more “weight” than the nine-sider, because you're in luck if that 7 comes up; but perhaps you picked the second solution, which seems the most exciting because fewer numbers are repeated between faces, so each individual die roll has more possible results and hence higher entropy.

But this has got you wondering. If you had different shaped dice, what other combinations would also give you a result equivalent to 2d6? Well, there's at least one other interesting one, which is the unique alternative way to number two cubical dice and get the same distribution for their sum. Label the faces on one of them 1, 3, 4, 5, 6, 8 and on the other 1, 2, 2, 3, 3, 4. Then the sum is distributed as follows:

Total |  2   3   4   5   6   7   8   9  10  11  12  |
------+---------------------------------------------+
Rolls | 1+1 1+2 1+3 1+4 3+3 3+4 4+4 5+4 6+4 8+3 8+4 |
      |     1+2 1+3 3+2 3+3 4+3 5+3 6+3 8+2 8+3     |
      |         3+1 3+2 4+2 4+3 5+3 6+3 8+2         |
      |             4+1 4+2 5+2 6+2 8+1             |
      |                 5+1 5+2 6+2                 |
      |                     6+1                     |
Chance+---------------------------------------------+
 /36  |  1   2   3   4   5   6   5   4   3   2   1  |
------+---------------------------------------------+

Of course, the method generalizes to finding a set of dice with any desired distribution, provided you're capable of doing (or capable of programming Maple to do) the necessary factorization. In some cases you may have to throw out solutions where the polynomials have negative coefficients: for example, if you try finding ways to renumber more than two six-sided dice, that constraint means that you don't get any new solutions, only combinations of the pair described above and ordinary dice. Happy renumbering!