3

Someone recently asked me: you are offered two games - in A, a coin is tossed 20 times; in B, a dice is rolled 36 times. You win A if there are exactly 10 heads. You win B if at least one of the numbers is rolled exactly 6 times. Which game would you pick and why? And how much more likely are you to win one vs. the other?

A is relatively simple to compute using both analytic methods (Bernoulli trials) and simulation. But I was able to compute B only using a computer simulation because there are just too many possibilities to consider otherwise. Is there a way to compute the probability of winning B analytically? Can someone please enlighten me? Thank you.

gnokem
  • 137

3 Answers3

5

$B$ may be expressed using the Principle of Inclusion and Exclusion.

$${\binom 6 1 \binom {36} {6} \frac {5^{30}}{6^{36}}} \\- {\binom 6 2 \binom {36}{6}\binom {30}6 \frac {4^{24}}{6^{36}}} \\+ {\binom 6 3 \binom {36} 6 \binom{30}6 \binom{24}6 \frac {3^{18}}{6^{36}}} \\- {\binom 6 4 \binom {36} 6 \binom{30}6 \binom{24}6 \binom{18}6 \frac {2^{12}}{6^{36}}} \\+ {\binom 6 6 \binom {36} 6 \binom{30}6 \binom{24}6 \binom{18}6 \binom{12}6 \frac {1}{6^{36}}} $$

Graham Kemp
  • 129,094
1

We consider the complementary event in B: What is the probability that a die is rolled $36$ times and none of the numbers is rolled exactly $6$ times? More generally, consider the exponential generating function for the probability of rolling a die $n$ times with none of the $6$ numbers rolled exactly $6$ times, i.e. the function $f(x)$ defined by $$f(x) = \sum_{n=0}^{\infty} \frac{p_n}{n!} x^n$$ where $p_n$ is the probability in the case of $n$ die rolls. (Readers who would like to know more about generating functions can find many resources in the answers to the question How can I learn about generating functions?.) The generating function is $$f(x) = \left(e^{x/6} - \frac{1}{6!} \cdot \frac{x^6}{6^6} \right)^6$$ In order to find $p_{36}$, we start by applying the Binomial Theorem. $$f(x) = \sum_{i=0}^6 (-1)^i \binom{6}{i} e^{ix/6} \frac{1}{(6!)^{6-i}} \frac{x^{36-6i}}{6^{36-6i}}$$ So $$\begin{align} p_{36} &= 36! \; [x^{36}]f(x) \\ &= 36! \sum_{i=0}^6 (-1)^i \binom{6}{i} \frac{1}{(6!)^{6-i} \cdot 6^{36-6i}} [x^{36}]x^{36-6i} e^{ix/6} \\ &= 36! \sum_{i=0}^6 (-1)^i \binom{6}{i} \frac{1}{(6!)^{6-i} \cdot 6^{36-6i}} [x^{6i}]e^{ix/6} \\ &= 36! \sum_{i=0}^6 (-1)^i \binom{6}{i} \frac{1}{(6!)^{6-i} \cdot 6^{36-6i}} \cdot\frac{1}{(6i)!} \left(\frac{i}{6} \right)^{6i} \\ \end{align}$$ where we have used the notation $[x^n]f(x)$ to denote the coefficient of $x^n$ in $f(x)$. It is necessary to define $0^0=1$ for this formula to work.

awkward
  • 14,736
0

As a compromise between simulation and strictly analytical solutions to B, consider a simple exact computational approach. Represent the number of rolls of each value so far by a tuple $A=(a_1,a_2,a_3,a_4,a_5,a_6)$. We can restrict ourselves to sorted tuples, with $a_1\le a_2\le\ldots\le a_6$, because all values are equivalent for the purposes of the question. Let $A\oplus i$ be the new tuple obtained by adding $1$ to the $i$-th element and then (if necessary) re-sorting. Let $N(A, t)$ to be the number of ways to achieve $A$ after $t$ rolls, starting with $N((0,0,0,0,0,0),0)=1$. Then for each $t$, calculate the counts for $t+1$ by iterating over all the $A$'s at the current $t$ and adding $N(A,t)$ to $N(A\oplus i, t+1)$ for each $i$.

This almost takes longer to explain than to code. Here is a Python implementation:

def Aplus(A, i):
  tmp = list(A)
  tmp[i] += 1
  tmp.sort()
  return tuple(tmp)

def Nmap(t): curr = {(0,0,0,0,0,0): 1} for tt in xrange(t): nxt = {} for (A, N) in curr.items(): for i in xrange(6): nxtA = Aplus(A, i) nxt[nxtA] = nxt.get(nxtA, 0) + N curr = nxt return curr

After which sum([ct for (A, ct) in Nmap(36).items() if 6 in A]) returns 7043010220180463771473308000L, the exact number of ways to roll at least one of the values exactly $6$ times. The probability, then, is $$ \frac{7043010220180463771473308000}{6^{36}} = \frac{24454896597848832539837875}{35813974994758803979763712} \approx 0.682831. $$ That all being said, this is a great deal more likely than there being exactly $10$ heads in $20$ coin flips: $$ p = \frac{{20}\choose{10}}{2^{20}} = \frac{46189}{262144} \approx 0.176197. $$ The ratio is $\approx 3.875$. So if all you cared about were which way to bet, there might well be a clever and more simple comparison that would prove that B is the smart choice.

mjqxxxx
  • 41,358