Suppose you were to toss 2 coins each with different probabilities of landing on heads 2 times each, one at a time. So coin 1 tossed twice. Then coin 2 tossed twice. Let N be the total number of heads. To calculate E[N], would you find E[number of heads on coin 1's tosses] and E[number of heads on coin 2's tosses] and sum them together? And to find the var[N] would it be the same concept?


2 Answers 2


For expectation - yes due to linearity of expectation. As for variance, you can do the same since the each toss (or each event) are independent. Note that it does not matter whether you toss each coin 'one at a time' or the order you do it in due to independence, of course.

Formally, if you let $X_1$ and $X_2$ be the indicator variables for each toss of the first coin ($1$ for heads, $0$ for tails) and the same with $Y_1$ and $Y_2$ for the tosses of the second coin, we have:





due to linearity of expectation.

Also, as $X_1,X_2,Y_1,Y_2$ are independent events, we have



The general rules being used here are:

$$E(aX+bY)=aE(X)+bE(Y)\tag{linearity of expectation}$$

and if $X$ and $Y$ are independent,


  • $\begingroup$ I just have a general question. I had a practice problem like this but with given probabilities for each coin. Let's assume N=X+Y. X is number of heads on coin 1, and Y is the number of heads on coin 2. I tried calculating the variance by doing E[(X+Y)^2] - E^2[(X+Y)] but received a negative number. But when I calculated the variances of each coin individually and then summing it, I received a positive number. Why does this happen? Basically I'm asking, why doesn't E[(X+Y)^2] - E^2[(X+Y)] =var(X)+var(Y)? $\endgroup$ Aug 10, 2017 at 21:18
  • $\begingroup$ Could you give the probabilities in particular or edit your question to include your calculation? $\endgroup$
    – Shuri2060
    Aug 10, 2017 at 21:23
  • $\begingroup$ Never mind, I see what I did wrong. When squaring E[(X+Y)^2], I did not calculate it correctly. $\endgroup$ Aug 10, 2017 at 21:35
  • $\begingroup$ Letting the probabilities be $p_1$ and $p_2$, we have $E[(X+Y)^2] - (E[X+Y])^2=(0\times(1-p_1)^2(1-p_2)^2+1\times(1-p_1)^2p_2(1-p_2)+4\times(1-p_1)^2p_2^2+1\times p_1(1-p_1)(1-p^2)^2+4\times p_1(1-p_1)p_2(1-p_2)+9\times p_1(1-p_1)p_2^2+4\times p_1^2(1-p_2)^2+9\times p_1^2p_2(1-p_2)+16\times p_1^2p_2^2)-4(p_1+p_2)^2$ $\endgroup$
    – Shuri2060
    Aug 10, 2017 at 21:35

Short answer: yes.

Medium answer: yes, you can sum two variables'expectations like that, and when the variables are independent you can sum the variances like that too.

Long answer: It sounds like the two coins in your example do not affect each other in any way. In other words, it sounds like the number of heads on one is independent of how many heads happen for the other. For any two random variables, whether independent or not, we do indeed have that $E[X+Y]=E[X]+E[Y]$. Furthermore, when the variables are independent, we also have that $E[XY]=E[X]E[Y]$. This allows us to reason as follows. \begin{align} Var[X+Y] &= E[((X+Y)-E(X+Y))^2]\\ &=E[(X-E[X]+Y-E[Y])^2]\\ &=E[(X-E[X])^2] +2E[(X-E[X])(Y-E[Y])] + E[(Y-E[Y])^2]\\ &=Var[X] + Var[Y] + 2 E[XY -XE[Y] -YE[X] + E[X]E[Y]]\\ &= Var[X] + Var[Y] + 2(E[XY] -E[X]E[Y] - E[X]E[Y] + E[X]E[Y])\\ &= Var[X] + Var[Y] + 2(E[X]E[Y] -E[X]E[Y] - E[X]E[Y] + E[X]E[Y])\\ &= Var[X] + Var[Y] +2 \cdot 0\\ &= Var[X] + Var[Y] \end{align} So the variance of the sum of independent random variables is the sum of their variance.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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