Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Flip an unweighted coin $N$ times, where we denote $X_i = 1$ if flip $i$ resulted in heads, and $X_i = 0$ if flip $i$ resulted in tails. Now take the average result $\bar X = \frac{\sum_{i=1}^N X_i}{N}$.

Conduct the same experiment again, this time denoting the $N$ flips $Y_i$. What is the expected value of the square of the difference between the two averages? In other words, $$E \left[ (\bar X - \bar Y)^2 \right] = E \left[ \left( \frac{\sum_{i=1}^N X_i - \sum_{i=1}^N Y_i}{N} \right)^2 \right] = ?$$

I'm interested in all of the steps leading up to the answer, which I assume should end up being some function of $N$...

share|cite|improve this question
You ask: "What is the expected value of the difference between the two averages?" but then your formula is for the expected value of the square of the difference between the two averages. – Thomas Andrews Apr 23 '12 at 20:33
@ThomasAndrews Thanks--I clarified it (I want square of differences). – jamaicanworm Apr 23 '12 at 20:56
up vote 3 down vote accepted

first note that $E(\bar X) = E(\bar Y)$ as $\bar X$ and $\bar Y$ have the same distribution, also $E(\bar X^2) = E(\bar Y^2)$. As $\bar X$ and $\bar Y$ are independent, we have $E(\bar X \bar Y) = E(\bar X)E(\bar Y)$. So we have \begin{align*} E\bigl((\bar X - \bar Y)^2\bigr) &= E(\bar X^2 - 2\bar X \bar Y + \bar Y^2)\\\ &= E(\bar X^2) - 2E(\bar X)E(\bar Y) + E(\bar Y^2)\\\ &= 2\bigl(E(\bar X^2) - E(\bar X)^2\bigr)\\\ &= 2V(\bar X). \end{align*} Now as the $X_i$ are independent $V(\bar X) = \frac 1{N^2}\sum_{i=1}^N V(X_i)$. We have $E(X_i^2) = E(X_i) = \frac 12$, so $V(X_i) = \frac 12 - \frac 14 = \frac 14$ and so $V(\bar X) = N \cdot \frac 1{4N^2} = \frac 1{4N}$ and by the calculation above $E[(\bar X - \bar Y)^2] = \frac 1{2N}$.

share|cite|improve this answer
No. The variance is homogeneous of order $2$, i. e. $V(\alpha X) = \alpha^2V(X)$. We can see this e. g. by using $V(X) = E(X^2) - E(X)^2$ and the linearity of expectation. – martini Apr 23 '12 at 21:12
Thanks! I'm still having some trouble, though, since this seems to contradict my experimental results. Maybe you can help find something wrong with this? I start with $x = 0$, then do $x = x + 1$ (with $p = \frac{1}{2}$) or $x = x + 0$ (with $p = \frac{1}{2}$), $N$ times. I take $X = x / N$, then do the same simulation independently to get $Y = y / N$. My result is then $(X - Y)^2$. For some reason, when I average the results of this experiment over $10,000$ trials for $N = 100$, I keep getting the $0.005$, which is $\frac{1}{2N}$, not $\frac{1}{2N^2}$... – jamaicanworm Apr 23 '12 at 21:25
Your experiment is right. I forgot to multiply with $N$ ... we have $V(\bar X) = \frac 1{N^2} \sum_{i=1}^N V(X_i) = \frac 1{N^2} \sum_{i=1}^N \frac 14 = \frac 1{N^2} \cdot N \cdot \frac 14 = \frac 1{4N}$. ... I corrected it above. – martini Apr 23 '12 at 21:32
Hallelujah! I was banging my head against the wall, rereading your answer, and I didn't catch it either. Thanks for your help! – jamaicanworm Apr 23 '12 at 21:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.