How do I solve this probability Anna writes down a random sequence created by the following process. She repeatedly rolls a fair
6-sided die. If the number she rolls is larger than all of the numbers she has previously rolled (if
any), then she writes the new number down and then continues rolling. Otherwise, she does not
write the new number down and the process ends.
Let X be the length of Anna’s sequence, and Y be the last number in her sequence.
For example, if Anna rolled 1 then 4 then 5 then 4, her sequence would be 1,4,5 and the random
variables X, Y would take values X = 3 and Y = 5.
Question
What is $Pr(X=2|Y=3)$

My workings so far
$Pr(X=2|Y=3)=$ $\frac{Pr(X=2 \land Y=3)}{Pr(Y=3)}$
I know that $Pr(Y=3)= \frac{1}{6}(1+\frac{2}{6}+\frac{\binom{2}{2}}{6^2})$
Then, $Pr(Y=3)=\frac{49}{216}$
The problem I'm having trouble figuring out is calculating $Pr(X=2\land Y=3)$
Can anyone help me with this, I'm very confused. Thank you so much in advance.


What is $Pr(X=2|Y=3)$

Use Bayes Theorem.
In order for $Y$ to equal $3$, several things have to have happened:

*

*You rolled zero, one, or two rolls below a $3$.


*Then, you rolled a $3$.


*Then, you rolled a number below a $4$.
$$P(X = 2| Y = 3) = \frac{P(X = 2 \wedge Y = 3)}{P(Y = 3)}.$$
I will repeat some of your analysis in order to clarify how to calculate the numerator as well as the denominator.
$\underline{\text{Case 1:}}$
Roll a 1, then a 3, then a number below a 4. 
$(1/6) \times (1/6) \times (1/2).$
Enumeration is $\frac{1}{72} = \frac{6}{432}$.
$\underline{\text{Case 2:}}$
Roll a 2, then a 3, then a number below a 4. 
$(1/6) \times (1/6) \times (1/2).$
Enumeration is $\frac{1}{72} = \frac{6}{432}$
$\underline{\text{Case 3:}}$
Roll a 1, then a 2, then a 3, then a number below a 4. 
$(1/6) \times (1/6) \times (1/6) \times (1/2).$
Enumeration is $\frac{1}{432}.$
$\underline{\text{Case 4:}}$
Roll a 3, then a number below a 4. 
$(1/6) \times (1/2).$
Enumeration is $\frac{1}{12} = \frac{36}{432}.$
The denominator, which represents $p(Y = 3)$, is the sum of all 4 cases: 
$\frac{49}{432}.$
The numerator, which represents $p(X = 2 \wedge Y = 3)$ is the sum of Case 1 and Case 2. 
$\frac{12}{432}$.
Therefore, the desired probability is
$$\frac{\frac{12}{432}}{\frac{49}{432}} = \frac{12}{49}.$$
