Processing math: 100%

Monday, January 15, 2024

Dice Dungeon

Two people are sitting at a table together, each with their own bag of six “DnD dice”: a d4, a d6, a d8, a d10, a d12, and a d20. Both people randomly pick one die from their respective bags and then roll them at the same time. For example, suppose the two dice selected are a d4 and a d12. The players roll them, and let’s further suppose that both rolls come up as 3. What luck!

What’s the probability of something like this happening? That is, what is the probability that both players roll the same number, whether or not they happened to pick the same kind of die?

There are twenty possible outcomes 1,2,,20, however, since for instance, the probability that a d4 die rolls 17 is nil, we have a non-uniform distribution of outcomes. All outcomes less than or equal to 4 are always possible no matter which die is selected, so the probability is pi=16(14+16+18+110+112+120)=93720,i=1,2,3,4.

The conditional probability of getting i \in \{5,6\} given that the d4 die was selected is zero, so we have pi=16(0+16+18+110+112+120)=63720,i=5,6.
Doing similar manipulations for other outcomes gives pi={93720,for i=1,2,3,463720,for i=5,6;43720,for i=7,8;28720,for i=9,10;16720,for i=11,12;6720,for i=13,14,15,16,17,18,19,20.

Let the roll person 1 be X, with probability distribution given by P{X=i}=pi. Similarly let the roll of person 2 be Y, which has the i.i.d. distribution. Then the probability that both rolls are the same, i.e., X=Y, is given by P{X=Y}=20i=1P{X=Y=i}=20i=1P{X=i}P{Y=i}=20i=1p2i=17202(4932+2632+2432+2282+2162+862)=48600518400=332=9.375%.

If we went further and added a third person who has a bag of DnD dice. Again, all three randomly pick one die from their respective bags and roll them at the same time. For example, suppose the three dice selected are a d4, a d20, and a d12. The players roll them, and let’s further suppose that the d4 comes out as 4, the d20 comes out as 13, and the d12 comes out as 4. In this case, there are two distinct numbers (4 and 13) among the three rolls.

On average, how many distinct numbers would you expect to see among the three rolls?

Well the hard part of establishing the distribution is done, so let's assume X, Y and now Z are all i.i.d. with P{X=i}=P{Y=i}=P{Z=i}=pi,i=1,2,,20. Let N be the number of distinct rolls. I'm lazy so I'm going to leave N=3 alone and instead tackle N=1 and N=2. The probability that X=Y=Z and hence N=i is by extension of the previous problem P{N=1}=20i=1p3i=3930360373248000=3275331104001.05302.....%

For N=2, we have a modicum of work. As we saw above if X=Y then this would be represented by p2i, but then in this case of N=2, we must have ZX=Y, which has probability of (1pi). Furthermore, since the order of X,Y,Z doesn't matter, there are 3 possible ways to get two rolls of i and one roll of anything but i. So we have P{N=2}=320i=1p2i(1pi)=93184920373248000=776541311040024.96595....%

The only thing left to do is compute the expectation, E[N]=1P{N=1}+2P{N=2}+3(1P{N=1}P{N=2})=32P{N=1}P{N=2}.

So the expected number of unique numbers among the three rolls is E[N]=323275331104007765413110400=900684731104002.89571984

1 comment:

  1. Arithmetic strikes again! While the first formula for E[N] is correct, the appropriate numerator and final answer are 8489153 and 2.72928015689..., respectively.

    ReplyDelete