2

Let X be the random variable which is the number of rolls required to see all 6 faces of a die. What's P(X is odd)?

I found a very indirect way to get an analytic answer, a fraction, to this question. Let $E_2$ be average times a pair of 6-sided dice must be rolled until all sides appear at least once. Let $E_1$ be be average times one 6-sided die must be rolled until all sides appear at least once. Then, $2E_2 = E_1 + P(\text{X is odd})$, where $E_2$ can be obtained by Markov chain, which is quite messy but doable.

I'm wondering if there is an elementary way to get this fraction. I think, which could be wrong, $$ P(X=n) = \frac{6*5^{n-6}{n-6 \choose 5} *5!}{6^n} $$.

So, in other words, I'm asking how you simplify the infinite sum of this expression over all odd n. In fact, if there is an easy way to solve this question. I should be able to find $E_2$ without markov chain.

JZ2020
  • 23

3 Answers3

3

Here is an approach using exponential generating functions. Readers unfamiliar with generating functions can find many resources in the answers to the question How can I learn about generating functions?

To simplify the discussion, let's assume the final roll is a $6$. Then the rolls up to that point must include at least one of each of $1$ through $5$ and no $6$. The exponential probability generating function for $n$ rolls with at least one of $1$ through $5$ and no $6$ is $(e^{x/6}-1)^5$. If we want the number of rolls to be even, then the EGF is $$f(x) = \frac{1}{2} [(e^{x/6}-1)^5 + (e^{-x/6}-1)^5] $$ I.e., $$f(x) = \sum_{n=0}^{\infty} p_n \frac{1}{n!} x^n$$ where $p_n$ is the probability of rolling a die $n$ times with a result of at least one each of $1$ through $5$ and no $6$, with $n$ even. Then $(1/6) f(x)$ is the EGF for the probability that we get a complete set of $1$ through $6$ with the final $6$ occurring on roll $n+1$, with $n+1$ odd. So the total probability of ending with a $6$ on an odd number of rolls is $$\begin{align} \frac{1}{6}\sum_{n=0}^{\infty} p_n &= \frac{1}{6} \int_0^{\infty} e^{-x} \; f(x) \; dx \tag{*} \\ &= \frac{1}{12} \int_0^{\infty} e^{-x} \cdot [(e^{x/6}-1)^5 + (e^{-x/6}-1)^5] \; dx \\ &= \frac{461}{5544} \end{align}$$ But of course the final roll may be any number from $1$ to $6$, not just $6$, so the answer to the problem is $$6\cdot \frac{461}{5544} = \boxed{\frac{461}{924}}$$ At $(*)$ we have taken advantage of the identity $$n! = \int_0^{\infty} x^n e^{-x} \; dx$$

awkward
  • 14,736
  • This feels like it should generalize nicely to $k$-sided dice, with the probability being $1/2 - f(k)$ where $f(k)$ has a relatively simple form. Here $f(6) = 1/924$. – Michael Lugo Apr 28 '21 at 15:14
  • Without doubt the best answer (+1). – user Apr 28 '21 at 15:46
1

$X$ is the sum of six independent geometric random variables $X_k$, the number of rolls needed to see the next distinct value when $k$ distinct values have been rolled. It is easy to work out that $Q_k=\Pr(2\nmid X_k)=\frac6{6+k}$; since $X_0$ is always $1$ and always odd, $$\Pr(2\nmid X)=\prod_{k=1}^5(1-Q_k)+\sum_{s\in[5],|s|=2}\prod_{k\in s}Q_k\prod_{k\not\in s}(1-Q_k)+\sum_{s\in[5],|s|=4}\prod_{k\in s}Q_k\prod_{k\not\in s}(1-Q_k)$$ which still takes some effort, but should be less work than the Markov chain approach.

Parcly Taxel
  • 103,344
1

To do it with a Markov chain, I used states of the form $(n,k)$ where $0\leq n\leq6$ and $0\leq k\leq1$. $n$ indicates that we have seen $n$ numbers so far, $k=0$ means we have made an even number of rolls, and $k=1$ means we have made an odd number of rolls. The chain starts in state $(0,0).$

For writing a computer program, I encoded $(n,k)$ as state $2n+k$. To get exact answers, I used sympy. Initially, I encoded the transition probabilities as $6$ times the actual value, and then divided the matrix by $6$. I used the formulas and notation from the Wikipedia page on absorbing Markov chains.

from sympy import zeros, eye

P = zeros(14)
for n in range(6): for k in range(2): this = 2n + k that = 2n + (1-k) other = 2*(n+1)+(1-k) P[this,that] = n P[this,other] = 6-n P[12,12] = 6 P[13,13] = 6 P = P/6

Q = P[:12,:12] R = P[:12,12:] N=(eye(12)-Q).inv() B = N@R

The matrix $B$ is

Matrix([
[463/924, 461/924],
[461/924, 463/924],
[461/924, 463/924],
[463/924, 461/924],
[331/660, 329/660],
[329/660, 331/660],
[ 82/165,  83/165],
[ 83/165,  82/165],
[  28/55,   27/55],
[  27/55,   28/55],
[   5/11,    6/11],
[   6/11,    5/11]]) 

We want the probability absorption in state $13$ if the chain starts in state $0$. This is given by the second element of the first row of $B$.

saulspatz
  • 53,131