Question: Assume we toss a coin in two trials. In the first trial we toss it n times. In the second trial we toss it as many as the number of tails observed in the first trial.
Calculate the expectation of total number of tails in both trails:
Solution: This is what I have tried but can't find any closed form for the answer when n is not given. I am not sure if I have taken the right approach:
$T_1$ = Number of tails in the 1st trial
$T_2$ = Number of tails in the 2nd trial
T1 ~ Binomial(n,p)
T2 ~ Binomial(T1,p)
$E(T1 + T2) = E(T1) + E(T2) = \\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ n p+\sum_{i=0}^{n} E\left(T_{2} \mid T_{1}=i\right) P\left(T_{1}=i\right) =\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ n p+\sum_{i=0}^{n} i p \times\left(\begin{array}{l}n \\ i\end{array}\right) p^{i}(1-p)^{n-i}$
I couldn't find any closed form for the answer. Any advice on how to approach this?
To calculate $E(T_2)$, consider using the law of total expectation.
$$E(X) = E\left[E(X|Y) \right]$$
Which in your case would give
\begin{align*} E[T_2] &= E\left[E(T_2|T_1) \right] \\ &=E\left[p \cdot T_1 \right] = p E\left[T_1 \right] \\ &= np^2 \end{align*}