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)$
where we are using Formulation-2 of the Negative Binomial distribution.
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)$.
All of the above applies even if we sample with replacement. To make things clear, let's work on the problem of finding the expected number of cards required to get an Ace given we get some Kings from a standard 52-card deck. Let $N$ be the random variable indicating the number of cards to get an Ace and $K$ be the number of Kings we get during the process.
The following results vastly simplifies the foregoing discussion. If we sample without replacement from a population of $P$ samples of which $S$ are marked as 'success', we have,
$\displaystyle\mathbb{E}(\text{failures before first success})=\frac{P-S}{S+1}$ and $\displaystyle\mathbb{E}(\text{draws to get first success})=1+\frac{P-S}{S+1}=\frac{P+1}{S+1}$
For example, we have four Aces from a standard deck of cards. Therefore,
$\displaystyle\mathbb{E}(N)=\frac{52+1}{4+1}=\frac{53}{5}$
What about the number of cards needed to get first Ace given we did not get any Aces during the process? Like before, we draw cards till we get an Ace/King. If we get a King next, we restart discarding everything. Else, we needed one more card i.e. the Ace that ended the process. Therefore,
$\displaystyle \mathbb{E}(N|K=0)=\mathbb{E}(\text{draws before Ace or King})+1=\frac{52-8}{8+1}+1=\frac{53}{9}$
We can continue the same for finding the number of cards to get an Ace given we got atleast one King in the process. Because we have four Aces and four Kings in the deck, it is easy to see that either of them comes first between them is $1/2$. Then, using the law of total expecation, we have,
$\mathbb{E}(N)=\mathbb{P}(K=0)\mathbb{E}(N|K=0)+\mathbb{P}(K\geq 1)\mathbb{E}(N|K\geq 1)$
As $\mathbb{P}(K=0)=\mathbb{P}(K\geq 1)=1/2$, we can solve the above easily for $\mathbb{E}(N|K\geq 1)$. But we can proceed in more story-proof like fashion.
From the above and by symmetry, We know that we need $53/9$ cards to get a King before an Ace. We now have $52-53/9=415/9$ cards of which four Aces and we are waiting for the first Ace. It should be easy see that,
$\displaystyle\mathbb{E}(N|K\geq 1)=\frac{53}{9}+\frac{415/9+1}{4+1}=\frac{689}{45}$
Now, Given we needed $n$ cards to get the first Ace, we want to find the expected number of Kings we drew in the process. This can be computed relatively simple as follows:
$\begin{align}\displaystyle\mathbb{E}(K|N\geq n)&=\mathbb{E}(\text{Kings in first }n-1\text{ non-Ace cards})+\mathbb{E}(\text{Kings in remaining cards until first Ace})\\ \end{align}$
Now, it is easy to see that,
$\displaystyle\mathbb{E}(\text{Kings in first }n-1\text{ non-Ace cards})=(n-1)\frac{4}{48}=\frac{n-1}{12}$
Now we know that $4-(n-1)/12$ Kings and four Aces remaining in the deck. Because we are concerned only about the number of Kings and Aces, we can discard the remaining cards. Now we are counting the number of Kings (failures) until the first Ace (Success).
$\displaystyle\mathbb{E}(\text{Kings in remaining cards until first Ace})=\frac{4-(n-1)/12}{4+1}$
Therefore,
$\displaystyle\mathbb{E}(K|N\geq n)=\frac{n-1}{12}+\frac{4-(n-1)/12}{4+1}=\frac{n+11}{15}$
It should be easy by now to see that the Binomial/Neg.Binomial becomes HyperGeometric/Neg.HyperGeometric in the without replacement case. While we have used a handwavy method to solve these problems, seeing how symmetry brings everything together made me thoroughly enjoy the time spent in this problem.
Hope you enjoyed the discussion.
Until then
Yours Aye
Me
.png)

.png)
.png)
.png)




