:

## Solving the dice problem with the combinatorics

Let's continue on with the dice example; determining the probability of all faces showing when n dice are thrown.   We estimated this by running a simulation in maple; and comparing the frequency of successes to the total number of experiments.

There is a way to determine the probability without running trials. The problem can be solved combinatorially.

One way to determine the probability of all faces shown; is to determine the the probability that all faces are NOT shown (call this probability B). Then the probability that all faces are shown = 1 - B.

What is the probability of B? It is the number of outcomes where 1 or more faces are missing divided by all possible outcomes.

Part 1. Determine number of possible outcomes.

6^n (n dice thrown, each can be value 1..6)

Part 2. Determine ways that at least 1 face can be missing. How many ways can 1 face be missing?

(6-Choose-1)*5^n -- choose a missing face, leaves 5 faces and n positions. ...

How man ways can k faces be missing (1 <= k <= 5)?

(6-Choose-k)*(6-k)^n -- choose k missing faces, leaving 6-k remaining faces and n positions

So, by the principle of inclusion-exclusion, the number of ways that AT LEAST 1 face is missing is ...

(6-choose-1)*5^n - (6-choose-2)*4^n + (6-choose-3)*3^n - (6-choose-2)*2^n + (6-choose-1)*1^n

Part 3. Put part 1 and 2 together.

Probability of B = (sum k=1..5 of (-1^(k+1)*(6-choose-k)*(6-k)^n)) / 6^n

Part 4. Put it into Maple.

Define P(n) = 1-B

P := n -> 1 - ((add((-1)^(k+1)*binomial(6,k)*(6-k)^n,k=1..5))/(6^n));

Determine probabilities for various values of n, vary n from 6 to 25.

for n from 6 to 25 do; printf("n = %d, P(E) = %f\n", n, P(n)); end do:

Output:

n = 6, P(E) = 0.015432

n = 7, P(E) = 0.054012

n = 8, P(E) = 0.114026

n = 9, P(E) = 0.189043

n = 10, P(E) = 0.271812

n = 11, P(E) = 0.356206

n = 12, P(E) = 0.437816

n = 13, P(E) = 0.513858

n = 14, P(E) = 0.582845

n = 15, P(E) = 0.644213

n = 16, P(E) = 0.698004

n = 17, P(E) = 0.744632

n = 18, P(E) = 0.784707

n = 19, P(E) = 0.818923

n = 20, P(E) = 0.847988

n = 21, P(E) = 0.872577

n = 22, P(E) = 0.893317

n = 23, P(E) = 0.910765

n = 24, P(E) = 0.925415

n = 25, P(E) = 0.937698

Note: less than 2% chance of all faces showing when rolling 6 dice.

That explains why a straight in Yahtzee is rare on a single roll.

I am surprised at the relatively low probabily of all faces showing when n = 20; about 85%.

I would have expected closer to 99%.

All for now.

-Jay

﻿