# Toss a fair coin n times, getting $N$ heads. Toss it $N$ more times. What is the variance of the total number of heads?

I've been stuck on this problem for a while; I can get the expected number of heads, but the solution set I saw gives $\frac{11n}{16}$ for the variance, whereas I get $\frac{9n}{16}$:

Each coin flip, $X_i$ for $0,\ldots,n$, can be represented by a Bernoulli random variable with $E(X_i) = p = 0.5$. The total number of heads for the initial round of throws is then a binomial random variable, $N$, with $E(N) = np = \frac{1}{2}n$.

The expected total number of heads for the second set of throws, $N'$ is conditional on $N$, $$E(N') = E(E(N' \vert N)) = E(N)E(X_i) = \frac{1}{4}n$$

To get the expected total number of heads we sum these two expectations, $$E(N + N') = E(N) + E(N') = \frac{1}{4}n$$

So the expected total number of heads is a function of a random variable, $h(N) = N + E(X_i)N$. Using the fact that $Var(Y) = Var[E(Y \vert X)] + E[Var(Y \vert X)]$

$$Var(N + E(X_i)N) = Var[E(N + E(X_i)N \vert N)] + E[Var(N + E(X_i)N \vert N)] \\ = Var\left[E\left(\frac{3}{2}N \mid N \right)\right] + E\left[Var\left(\frac{3}{2}N \mid N \right) \right] \\ = \left(\frac{3}{2}\right)^2Var[E(N \mid N)] + \left( \frac{3}{2}\right)^2E[Var(N\mid N)]$$

Factoring out the $\left(\frac{3}{2}\right)^2$, we're left with an expression that is equivalent to $Var(N) = \frac{n}{4}$ (per the equality above), hence $Var(N + N') = \frac{9n}{16}$.

What am I missing?

For $i\in\{1,\dots,n\}$ define $$H_i=\begin{cases} 0\text{ if tails on the }i^{\text{th}}\text{ toss,}\\ 1\text{ if heads on the }i^{\text{th}}\text{ toss, tails on the corresponding second round toss,}\\ 2\text{ if heads on the }i^{\text{th}}\text{ toss, heads on the corresponding second round toss}. \end{cases}$$

Then $$\operatorname{Var}(H_i)=E(H_i^2)-E(H_i)^2=\frac54-\left(\frac34\right)^2=\frac{11}{16}.$$

The total number of heads is $$H=H_1+\cdots+H_n.$$ Since the variables $H_1,\dots,H_n$ are mutually independent, we have $$\operatorname{Var}(H)=\operatorname{Var}(H_1)+\cdots+\operatorname{Var}(H_n)=\frac{11}{16}+\cdots+\frac{11}{16}=\frac{11n}{16}.$$

• I like this a lot, but how do you compute the expectations of the $H_i$s? – HoHo Sep 6 '17 at 8:45
• $$E(H_i)=0\cdot P(H_i=0)+1\cdot P(H_i=1)+2\cdot P(H_i=2)=0\cdot\frac12+1\cdot\frac14+2\cdot\frac14=\frac34$$ – bof Sep 6 '17 at 21:19
• $$E(H_i^2)=0^2\cdot P(H_i=0)+1^2\cdot P(H_i=1)+2^2\cdot P(H_i=2)=0\cdot\frac12+1\cdot\frac14+4\cdot\frac14=\frac54$$ – bof Sep 6 '17 at 21:22

HINT: Note that $N + \mathbb{E}(X_i)N$ is not equal in distribution to $N + N'$. Apply the law of total variance to $N + N'$ directly.

Alright, I found the problem: I was effectively ignoring the effect of the conditionals.

Since $E(N + N' \vert N = x) = E(x + \sum_{i=0}^{x}X_i) = x + xE(X_i)$, $$E(N + N' \vert N) = N + NE(X_i)$$

Similarly, since $Var(N + N' \vert N = x) = Var(x + \sum_{i=0}^{x}X_i) = xVar(X_i)$ (being independent) $$Var(N + N' \vert N) = NVar(X_i)$$

Putting these two together, \begin{equation*} \begin{split} Var(N + N') &= Var[N + E(X_i)N] + E[N Var(X_i)] \\ &= Var\left(\frac{3}{2}N\right) + E\left(\frac{1}{4}N\right) \\ &= \left(\frac{3}{2}\right)^2\left(\frac{1}{4}\right) + \left(\frac{1}{4}\right)\left(\frac{1}{2}\right) = \frac{11}{16} \end{split} \end{equation*}