I saw this question from Alexander Bogomolny today through a tweet from Nassim Taleb:
It reminded me a bit of a fun question I saw from Christopher Long a few years ago:
A great introductory probability and stats problem I saw from Christopher Long
The first solution that came to mind for the dice question involved generating functions. Here’s the code I wrote in Mathematica:
The general idea was to look at powers of the polynomial and keep track of the coefficients for powers greater than
. The one tiny bit of difficulty is that you also have to strip off the powers of
greater than
after each stage (since you only want to count the first roll giving you a sum greater than 12). Here’s that polynomial cubed, for example:
The coefficients for through
tell us the number of different ways to get a 13 through an 18 with three rolls.
The results of counting the polynomial coefficients are given below (columns give the number of ways to roll 13 through 18, and the rows are the dice rolls 3 through 13):
These counts don’t have the right weights, though, since 21 ways of getting a 13 on the 3rd roll have a much higher chance of happening than the 1 way of getting an 18 on the 13th roll. In fact each row has a weight 6x greater than the row immediately below it. Weighting the rows properly we get the following counts:
Now we just have to add up the columns and divide by to get the probabilities of ending on 13 through 18 (and do a weighted sum to get the expected final number) -> the probability of ending on a 13 is about 27.9% and the expected value of the final number is roughly 14.69:
This is a nice problem to show how generating functions can help you find exact answers to problems that seem to require simulations. It was fun to think through this one.