Qn :

We roll a six-sided die n times. Each time the die comes up 1, we flip a fair coin. Let X be the number of heads we get. Note that the number of times the coin is flipped is random. Find the mean and variance of X.


Suppose X is the number of heads and F is the number of coin flips to get 1. We have the following formula for the expectation and variance of X:

$$\mathbb E[X] = \mathbb E[\mathbb E[X\mid F]] \tag 1$$ $$\operatorname{var}(X) = \mathbb E[\operatorname{var}(X\mid F)] + \operatorname{var}(\mathbb E[X\mid F]) \tag 2$$

Notice that both var(X|F) and E[X|F] are random variables depending on F. When F takes value 1/6, we have var(X|F) = var(X|F = 1/6) and E[X|F] = E[X|F = 1/6] which are the conditional variance and expectation of X conditioned on F = 1/6. It seems obvious but gives us a way to determine var(X|F) and E[X|F]: supposing F = 1/6, the conditional distribution of X is n = 1/6 and p = 1/2. Therefore the conditional expectation and variance are equal to E[X|F = 1/6] = np = 1/12 and var(X|F = 1/6) = np(1-p) = 1/12 * ½ = 1/24, respectively. We just replace 1/6 with F to get: var(X|F) = 1/24; E[X|F] = 1/12:

Till this am i correct, now how do i replace these in equations 1 and 2?

Is there a better way to solve it? I am confused.Can anyone help with my approach?


1 Answer 1


$\newcommand{\E}{\mathbb E}$ $\newcommand{\var}{\operatorname{var}}$

I'll answer your last question first: There is a better way to solve it. On each trial you have probability $1/12$ of getting a "head", and the trials are independent. So you're looking for the expected value and variance of the number of successes in $n$ independent trials, with probability $1/12$ of success on each trial. The solution of that problem is known independently of the law of total expectation and the law of total variance.

The method you propose will also work. I will look at the details and possibly post more comments on that.

Later edit:

Let's let $F$ be the number of $1$s that appear when time the die is thrown, so $$ F = \begin{cases} 1 & \text{with probability }1/6, \\ 0 & \text{with probability }5/6. \end{cases} $$ Let $X$ be the number of heads that appear, so $$ \E(X\mid F=1) = \frac12\text{ and }\E(X\mid F=0) = 0. $$ Thus we have $$ \E(X\mid F) = \begin{cases} 1/2 & \text{with probability }1/6, \\ 0 & \text{with probability }5/6. \end{cases} $$ Hence $$ \E(X) = \E(\E(X\mid F)) = \frac{1}{12}. $$

Also, $$ \var(X\mid F=1) = \frac14 \text{ and }\var(X\mid F=0)=0. $$ Therefore $$ \E(X\mid F) = \begin{cases} 1/2 & \text{with probability }1/6, \\ 0 & \text{with probability }5/6. \end{cases} $$ From this it follows that $$ \var(\E(X\mid F)) = \left(\frac12\right)^2\cdot\frac16\cdot\frac56= \frac{5}{144}. $$ And $$ \var(X\mid F) = \begin{cases} 1/4 & \text{with probability }1/6, \\ 0 & \text{with probability }5/6. \end{cases} $$ Consequently $$ \E(\var(X\mid F)) = \frac{1}{24}. $$ Then we have $$ \var(X) = \var(\E(X\mid F))+\E(\var(X\mid F)) = \frac{5}{144}+\frac{1}{24} = \frac{11}{144}. $$

All this is for just one trial. For $n$ trials, multiply the expectation by $n$, and since they are independent, you can also multiply the variance by $n$.

In some problems these identities, sometimes called the law of total expectation and the law of total variance, are the most efficient way, and sometimes the only way, to solve problems. But in this case, the method presented first in this answer is much quicker.

  • $\begingroup$ Thanks for the explanation. $\endgroup$
    – manayay
    Sep 23, 2013 at 23:21
  • $\begingroup$ So the mean is n/24 and variance 11n/144 ... Correct me if i am wrong. $\endgroup$
    – manayay
    Sep 25, 2013 at 2:35
  • $\begingroup$ The mean is $n/12$ and the variance is $11n/144$. $\endgroup$ Sep 25, 2013 at 16:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .