Tuesday, September 1, 2026

Musings on Die rolling problem

I recently came across the problem of Conditional Die Rolls which I thoroughly enjoyed and prompted me make this post. In the interest of keeping things general without losing ourselves in notational complexity, let's consider a unfair 6-sided die with probability $p_k$ for each face.

Let $N$ be the random variable indicating the number of rolls needed to get the first $6$ and $K$ be that of the number of $5$s we get before our first $6$. Then Part-I of the problem in the page above, which asks for the expected number of rolls needed to get a $6$ given we did not see a $5$, is about finding $\mathbb{E}(N|K=0)$.

It is easy to see that $N\sim\text{Geom}(p_6)$ and therefore $\mathbb{E}(N)=1/p_6$.

But we need the conditional expectation to answer the question. Rather than getting into messy calculations, we can reason it as follows: We roll the die until we get a $5$-or-$6$ (which is simply given by the Geometric distribution that counts the number of failures before first success). If the final result is a $5$, we ignore that sequence. Else, we needed that one final roll to complete the process. Thus,

$\displaystyle\mathbb{E}(N|K=0)=\frac{1-p_5-p_6}{p_5+p_6}+1=\frac{1}{p_5+p_6}$

In fact, we get a more general result by noting that by ignoring the neither-$5$-nor-$6$ rolls and normalizing the probability of getting a $5$ and that of $6$, we see that

$\displaystyle K \sim \text{Geom}\left(\frac{p_6}{p_5+p_6}\right)$

where $K$ counts the number of failures (getting a $5$) before the first success (getting a $6$). Then,

$\displaystyle \mathbb{P}(N=n|K=0)=\frac{\mathbb{P}(N=n \land K=0)}{\mathbb{P}(K=0)}=\frac{(1-p_5-p_6)^{n-1}p_6}{p_6/(p_5+p_6)}$

and

$\displaystyle \mathbb{P}(\text{getting the first }5\text{ or }6\text{ in the }n\text{-th roll})=(1-p_5-p_6)^{n-1}(p_5+p_6)$

Therefore, the number of rolls needed to get the first $6$ given that we did not see a $5$ is identical in distribution to the number of rolls needed to get a $5$-or-$6$.

To solve Part-II, which in our notation asks for the expected number of rolls needed to get a $6$ given we saw a $5$ i.e. $\mathbb{E}(N|K\geq1)$, we see that this the same as waiting for the first $5$ before a $6$ and then waiting for a $6$. But by symmetry, waiting for the first $5$ before a $6$ is the same as waiting for the first $6$ before a $5$ which we solved in Part-I. Therfore,

$\displaystyle\mathbb{E}(N|K\geq1)=\frac{1}{p_5+p_6}+\frac{1}{p_6}$

In fact, by a similar argument and taking advantage of the memoryless property of die rolls as before, it is easy to see that

$\displaystyle\mathbb{E}(N|K\geq k)=\frac{k}{p_5+p_6}+\frac{1}{p_6}$ and $\displaystyle\mathbb{E}(N|K=k)=\frac{k}{p_5+p_6}+\frac{1}{p_5+p_6}=\frac{k+1}{p_5+p_6}$

Taking it a step further, it should not hard to see that

$N|K\sim\text{NB}(K+1,p_5+p_6)$


Similarly, we can also quickly see that

$K|N\sim\text{Bin}(N-1,p_5 / (1 - p_6))$

because once we know that we needed $N$th roll resulted in the first $6$, $K$ is just the number of $5$s among $N-1$ non-$6$ rolls which is obviously binomial.

Then it is easy to see that

$\displaystyle \mathbb{E}(K|N=n)=(n-1)\frac{p_5}{1-p_6}$

In fact,

$\displaystyle \mathbb{E}(K|N\geq n)=(n-1)\frac{p_5}{1-p_6}+\frac{p_5}{p_6}$

because the first gives the number of $5$s in the first $N-1$ non-$6$ rolls (as $N\geq n$) and by the memoryless property of die rolls, the number of $5$s from that point on is just $\mathbb{E}(K|N\geq 1)=\mathbb{E}(K)$.

Hope you enjoyed the discussion.


Until then
Yours Aye
Me

No comments:

Post a Comment