Let $X$ be the number of tosses of a fair coin required to get the first head. If $Y | X = n$ is distributed as Binomial$(n, \frac{1}{2} )$, then what is $P(Y = 1)$?
Before attempting this I have a question in my mind?
$f(Y|X=x)$ is function of $x$, so I can write its pmf as ${{n} \choose {x}}(\frac{1}{2})^{x}(\frac{1}{2})^{n-x} $ or is it ${{n} \choose {y}}(\frac{1}{2})^{y}(\frac{1}{2})^{n-y} ?$
Clear this doubt for me please.
Now from question $X$ follows geometric distributions.
$P(X=x)=(\frac{1}{2})^{x-1}(\frac{1}{2})$
$f(Y|X)=\dfrac{f(x,y)}{f_X(x)} \implies f(Y|X)\cdot {f_X(x)}=f(x,y)$
Then I have to find marginal of $Y$ and $P(Y=1)$ but I am stuck initially
From the question, that $X=x,\:Y|X=x\sim B(x,0.5)$. For a binomial distribution $B(n,p)$, the pmf is given by $$p(k)=\binom{n}{k}p^k(1-p)^{n-k}$$ In this case we have $n=x,\:p=0.5$. So the pmf is $$\mathbb P(Y=y|X=x)=\binom{x}{y}(0.5)^y(1-0.5)^{x-y}=\binom{x}{y}(0.5)^x$$ Using the law of total expectation, $$\mathbb P(Y=1)=\mathbb E(\mathbb P(Y=1|X))=\mathbb E\left(\binom{X}{1}(0.5)^X\right)\\ =\sum_{k=1}^\infty\binom{k}{1}(0.5)^k\cdot (0.5)^{k-1}(0.5)=\sum_{k=1}^\infty k(0.5)^{2k}=\frac{4}{9}$$