Conditional expectation of a geometric die roll We roll a die until we see the third six. Let X denote the number of rolls needed for
the first six and Y the number of rolls needed for the third six. Find the conditional
probability mass function of X given Y = y and compute E(X|Y).
In order to find the pmf, I should take f(x,y)/f(y). However, I could use some help finding these distributions.
For the expectation, that will follow simply from the pmf.

For example, if $Y=9$ there are $5$ ways for $X=3$:
$$
\hphantom{12}6\overbrace{\color{#888888}{6}\color{#888888}{6}\color{#888888}{6}\color{#888888}{6}\color{#888888}{6}}^{\text{5 ways}}6\\
123456789
$$
Thus, when $Y=y$ there are $y-x-1$ ways for $X=x$.

The number of ways for $Y=y$ is $\binom{y-1}{2}$, the number of ways to place the first two $6$s. Let's check using the formula:
$$
\begin{align}
\sum_{x=1}^{y-2}y-x-1
&=(y-1)(y-2)-\sum_{x=1}^{y-2}x\\
&=(y-1)(y-2)-\frac{(y-1)(y-2)}{2}\\
&=\frac{(y-1)(y-2)}{2}\\
&=\binom{y-1}{2}
\end{align}
$$

Compute the expected value:
$$
\begin{align}
\mathrm{E}(X|Y)=
&\frac1{\binom{y-1}{2}}\sum_{x=1}^{y-2}(y-x-1)x\\
&=\frac1{\binom{y-1}{2}}\sum_{x=1}^{y-2}\left(y\binom{x}{1}-2\binom{x+1}{2}\right)\\
&=\frac1{\binom{y-1}{2}}\left(y\binom{y-1}{2}-2\binom{y}{3}\right)\\
&=y-2\frac{\frac y3\binom{y-1}{2}}{\binom{y-1}{2}}\\
&=\frac y3
\end{align}
$$
