# Conditional probability of rolling a die and flipping a coin.

We roll a die until we get a six and denote the number of rolls by $X.$ Then we take a fair coin and we repeatedly flip it until we get $X$ heads. We denote the number of coin flips needed by $Y.$

Find the conditional probability mass function $Y$ given $X=x$.

Given $$f_{Y|X}(y|x)= \frac{f_{Y,X}(x,y)}{f_{X}(x)}= \frac{\text{Something}}{(5/6)^{x-1}(1/6)}$$ Obviously I cant figure out the something, I believe it is binomial, but am unsure of the proper parameters.

The probability that $Y=y$ given that $X=x$ is the probability we get $x-1$ heads in the first $y-1$ tosses, and then get a head on the $y$-th toss.

Let $y\ge x\ge 1$. The probability of $x-1$ heads in the first $y-1$ tosses is $\binom{y-1}{x-1}(1/2)^{x-1}(1/2)^{y-x}$. Multiply by $1/2$ for the head on the $y$-th toss. Our probability simplifies to $$\binom{y-1}{x-1}\left(\frac{1}{2}\right)^y.$$ We have used the negative binomial distribution.

Remark: The solution assumed that the coin is fair. Minor modification solves the problem for a coin that has probability $p\gt 0$ of head. The conditional probability is then $\binom{y-1}{x-1}p^x(1-p)^{y-x}$.