We toss $n$ coins, and each one shows heads with probability $p$, independently of each of the others. Each coin which shows heads is tossed again. What is the mass function of the number of heads resulting from the second round of tosses?
MY ATTEMPT
Let $X$ has binomial distribution with parameters $n$ and $p$. Thus the probability that $0\leq k \leq n$ tosses show heads in the first round is given by
\begin{align*} \textbf{P}(X = k) = {n\choose k}p^{k}(1-p)^{n-k} \end{align*}
Let $Y$ denotes the number of heads resulting from the second round of tosses. Such process can be formulated as follow \begin{align*} \textbf{P}(Y = m\mid X = k) & = \frac{\textbf{P}(\{Y = m\}\cap\{X = k\})}{\textbf{P}(X = k)} = \frac{\displaystyle{k\choose m}p^{m}(1-p)^{k-m}}{\displaystyle{n\choose k}p^{k}(1-p)^{n-k}} \end{align*}
where $0\leq m\leq k\leq n$.
Can someone double-check my reasoning? Thanks in advance.
It appears that you have decided the probability mass function of $X$ is $P(X = k) = \binom nk p^k(1-p)^{n-k}.$ That is a correct result; good!
Your working for the probability $P(\{Y = m\}\cap\{X = k\})$, however, appears to be incorrect. Think about what has to happen for the event $\{Y = m\}\cap\{X = k\}$ to occur: first you must toss $n$ coins and $k$ of them must come up heads. (You already found the probability of that; it is $\binom nk p^k(1-p)^{n-k}.$) Then you must toss $k$ coins and have $m$ of them come up heads; the probability of that (assuming you do toss $k$ coins) is $\binom km p^m(1-p)^{k-m},$ which you have duly written in the numerator of your result. But what happened to the step where you tossed the $n$ coins and got $k$ heads? Did you just assume it already happened and its probability can be treated as $1$?
The expression in the numerator of your result is not $P(\{Y = m\}\cap\{X = k\})$; it is, in fact, $P(Y = m\mid X = k),$ the probability of getting $m$ heads (on the second round) given that you toss $k$ coins (on the second round), that is, given that you got $k$ heads on the first round so that you toss $k$ heads on the second round.
But we're not done yet, because I do not believe this problem is asking you to compute $P(Y = m\mid X = k).$ Does it say "given" anywhere after the phrase "the mass function of the number of heads resulting from the second round of tosses"?
I believe you were asked to find $P(Y = m).$
Now you can solve that problem the hard way, which is to take your values of $P(Y = m\mid X = k)$ for each $k = 0, \ldots, n$ (or just $k = m, \ldots n$ since the probability is zero when $k < m$) and your values of $P(X=k)$ for each $k,$ write a big sum using the law of total probability, and add it up.
Or you can solve it the easy way, which is to ask this: for each of the $n$ coins, how likely is it that this coin will contribute a head to the count of heads in the second round? That is, for coin number $i,$ where $i = 1, \ldots, n,$ let $Y_i = 1$ if the coin was tossed in the second round and came up heads, $Y_i = 0$ otherwise. Then the number of heads in the second round is $Y = \sum_{i=1}^n Y_i.$
In order for $Y_i=1$ to occur, coin $i$ must come up heads twice in a row: on the first toss and on the second toss. The probability of that is $p^2.$ To have $Y_i=0$ we just need the coin to come up tails on the first toss or heads and then tails. The probability of that is $1 - p^2.$
So $Y_i$ is a Bernoulli variable with success probability $p^2,$ and $Y$ is a binomial variable with parameters $n$ (number of trials) and $p^2$ (probability of success in each trial). Hence $Y$ has the probability mass function determined by the formula
$$ P(Y = m) = \binom nm (p^2)^m(1-p^2)^{n-m}. $$