# Calculating conditional probability: if the first 6 occurred on the third roll, what is the expected number of rolls until the first 1?

Needing a little help here, the question is as below:

While rolling a balanced die successively, the first 6 occurred on the third roll. What is the expected number of rolls until the first 1?

Sol: $$p(x,y)=\begin{cases}(\tfrac{4}{6})^{x-1}(\tfrac{5}{6})^{y-x-1}(\tfrac{1}{6})^2\quad y>x\\\\ (\tfrac{4}{6})^{x-1}(\tfrac{5}{6})^{y-x-1}(\tfrac{1}{6})^2\quad y<x\end{cases}$$

$$p_{X|Y\;}(x\mid y)=\frac{p(x,y)}{p_Y(y)}$$

$$E(X\mid Y=3)=\sum_{x=0}^2xp_{X|Y\;}(x\mid3)+\sum_{x=4}^\infty xp_{X|Y\;}(x\mid 3)$$

How to calculate the conditional probability $p_{X|Y} = \frac{p(x,y)}{p_{Y}(y)}$ ?

Thanks for looking at my question.

-

Conditioning on the first 6 happening on the third roll is equivalent to using a five-sided die (with no 6) for the first two rolls, a one-sided die (with only a 6) for the third roll, and a normal die from the fourth roll on. Hence the first 1 is the first success in a Bernoulli sequence with probability of success $1-t_n$ at roll $n$, where $t_1=t_2=a$, $t_3=1$ and $t_n=b$ for every $n\geqslant 4$, with $a=4/5$ and $b=5/6$.

Calling $X$ the roll where the first 1 happens, one gets $\mathrm P(X=n\mid X\geqslant n)=1-t_n$ for every $n\geqslant1$ and $\mathrm P(X\geqslant1)=1$. Hence, for every $n\geqslant1$, $$\mathrm P(X\geqslant n)=\prod\limits_{k=1}^{n-1}t_k,\qquad \mathrm P(X=n)=(1-t_n)\,\prod\limits_{k=1}^{n-1}t_k.$$ In particular, $$\mathrm E(X)=\sum\limits_{n\geqslant1}\mathrm P(X\geqslant n)=1+a+a^2+a^2+a^2b+a^2b^2+a^2b^3+\cdots,$$ that is $$\mathrm E(X)=1+a+a^2+(1-b)^{-1}a^2=1+4/5+16/25+6\times16/25=157/25=6.28.$$

-

I assume the $Y$ in your post is the number of rolls to obtain the first 6 and that $X$ is the number of rolls to obtain the first 1. For your problem, to find $p_{X|Y}$, you need to calculate probabilities of the the form $P[X=i|Y=3]$. You could use the formula stated in your post: find the probability that [the first 6 occurred on the third roll and the first 1 occurred on the $i$th roll], then divide by the probability that the first 6 occurred on the third roll.

But here is a simpler way of solving your problem:

Given that the first 6 occurred on the third roll:

let $X$ be the number of rolls to the first 1.

Let $A$ be the event that the first roll was 1.

Let $B$ be the event that the first roll was not 1 and the second roll was 1.

Let $C$ be the event that the first 1 occurred after the third roll.

You can use $$\Bbb E(X)= \Bbb E(X|A)P(A)+ \Bbb E(X|B)P(B) +\Bbb E(X|C)P(C)$$

We have:

$P(A)={1\over5}$ and $\Bbb E(X|A)=1$.

$P(B)={4\over5}\cdot{1\over5}$ and $\Bbb E(X|B)=2$.

As for the event $C$:

$P(C)={4\over5}\cdot{4\over5}$.

To find $\Bbb E(X|C)$, note:

If the first two rolls were not 1 (and remember, we are given that first 6 occurred on the third roll), what is the expected number of rolls to obtain the first 1? Well, it would be 3 plus the expected number of additional rolls (past the third) to get a 1. But, in this situation, the expected number of additional rolls to get a 1 is the same as the expected number of rolls to obtain a 1 with no conditions, which is 6. So, if the first two rolls were not 1, the expected number of rolls to obtain the first 1 would be 3+6=9.

So, the expected number of rolls to the first 1, given that the the first 6 occurred on the third roll, is: $$1\cdot{1\over5}+2\cdot{4\over5}\cdot{1\over5} + 9\cdot{4\over5}\cdot{4\over5}.$$

-