Roll a fair die to obtain a random number $1 ≤ n ≤ 6$, then flip a fair coin $n$ times. Let $X$ be the random variable that expresses the number of heads in the coin flips. Find the mean and variance of $X$.

Since the coin flips are Bernoulli trials, the expected number for heads ($H$) and tails ($T$) are $\mathbb{E}[H]=\mathbb{E}[T]=n/2$.

Furthermore, $H$ (and $T$) is distributed as per the binomial distribution, which has mean $n/2$ and variance $n/4$, ($n\in\{1,2,3,4,5,6\}$).

I don't know how to combine this with the outcome of the die roll. I have very elementary knowledge with probability and statistics, but I know, at least, that the coin tosses are independent of any other event.

(This is a problem I found in a Facebook group - not homework or anything).

Thank you!


1 Answer 1


We have $N \sim Unif\{1,6\}$, $X|N \sim Bin(N, \frac12)$

By law of total expectation:

$$E[X]=E[E[X|N]]=E\left[ \frac{N}2\right]=\frac12 E[N]=\frac12 \cdot \frac{1+6}{2}=\frac74$$

Also, by the law of total variance, we have

\begin{align}Var(X) &= E[Var(X|N)]+Var(E[X|N]) \\ &=\frac14E\left[N\right]+\frac14Var(N)\\ &=\frac14 \cdot \frac72 + \frac14 \cdot \frac{6^2-1}{12}\end{align}

  • $\begingroup$ Thank you very much; I would appreciate though a few more details, because, like I said, I only have very elementary knowledge of probabilities / statistics. I am quite good at combinatorics (because they are easy to understand and visualize) but statistics is not my strong point! $\endgroup$ Jan 10, 2022 at 10:07
  • $\begingroup$ Hi, which steps is confusing? $\endgroup$ Jan 10, 2022 at 10:35
  • $\begingroup$ I understand that $N$ follows uniform distribution in $\{1,6\}$ and that $X|N \sim Bin(N, \frac12)$, but I don't understand the rest, about $E[X]$ and variance, that is, how we are going to do the calculations. Thank you!! $\endgroup$ Jan 10, 2022 at 10:43
  • $\begingroup$ I used the law of total expectation and the law of total variance. Perhaps read those posts first? $\endgroup$ Jan 10, 2022 at 10:50
  • $\begingroup$ Maybe you should add $\mathsf P(X=0\mid N=1)$ for all values of $X$ and $N$? $\endgroup$ Jan 10, 2022 at 11:04

You must log in to answer this question.

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