Suppose we have an experiment of tossing a fair dice until the number $6$ results.
If $Y$ denotes the random variable of the number of throws until we get $6$, and $X$ denotes the random variable that counts the number of tosses which resulted in an even number, I need to calculate:
a. The conditional distribution of $X$ given $Y$.
b. The distribution of $X$.
my attempt:
a. If $Y=n$ then $X$ is a binomial distribution, $X \sim bin(n-1, 0.5)$
hence $P(X=k | Y=n) = \binom{n-1}{k-1} \frac{1}{2}^{k-1} \frac{1}{2}^{n-k}$.
b. $P(X=k) = \sum_{n=1}^{\infty}P(X=k | Y=n)P(Y=n)$
where $P(Y=n) = (\frac{5}{6}^{n-1})(\frac{1}{6})$
corrections please?
The conditional distribution of $X-1$ given $Y=n$ is $\text{Binomial}(n-1, 0.4)$
This is because the last throw is even ($6$), and the even outcomes in the rest of the throws are only $2$ and $4$ out of $1,2,3,4,5$ (as $6$ does not appear in these throws).
So $$P(X-1=m|Y=n)={n-1\choose m}0.4^m\cdot 0.6^{n-1-m}\text{ for }m=0,1,\ldots n-1$$ and by letting $k=m+1$: $$P(X=k|Y=n)={n-1\choose k-1}0.4^{k-1}\cdot 0.6^{n-k}\text{ for }k=1,2\ldots n$$
Now $Y\sim\text{Geometric}(1/6)$, so $P(Y=n)=\left(\frac{5}{6}\right)^{n-1}\frac{1}{6}$.
Also, in order to obtain $k$ even numbers you need at least $k$ throws ($Y\ge k)$. So after some algebraic manipulations:
$$P(X=k)=\sum_{n=k}^\infty P(X=k|Y=n)P(Y=n)=\left(\frac{2}{3}\right)^{k-1}\frac{1}{3}$$
So $X$ is a Geometric random variable with parameter $\frac{1}{3}$
Which makes sense, since the distribution of $X$ can be recast as coming from rolling a "virtual" die with only three faces ($2,3$ and $6$), until face $6$ appears (the throws which do not result in an even number being discarded).
With this observation, the distribution of $X$ can be calculated in a simpler way, without conditioning.