Expectation and variance of iterated dice rolling

256 Views Asked by At

For the rest of the post, we'll assume when I say "die" or "dice" that I mean a standard 6-sided die or some number of standard 6-sided dice. Suppose I roll a die and get a number $n$, and then I roll $n$ dice which sum to $m$. What's the mean and variance of $m$?

It seems clear that mean should be $(\frac{7}{2})^2$: there's a 1 in 6 chance of rolling $k$ dice, and the mean of the total roll from a roll of $k$ dice is $\frac72k$, so summing $\frac{7}{12}k$ over all values of $k$ gives $(\frac{7}{2})^2$. This is confirmed by a simulation I ran on a computer.

The variance is less clear to me. I know that when we roll $k$ dice, the variance of this process is $\frac{35}{12}k$. With $m$ as in the first paragraph, $Var(m)=E(m^2)-E(m)^2$, and we know what $E(m)^2$ is by the above paragraph, so it's enough to figure out what $E(m^2)$ is.

Then it seems like $E(m^2)=\sum_{i=1}^6 \frac{1}{6} E(m^2|n=i) = \sum_{i=1}^6 Var(m^2|n=i) + E(m|n=i)^2$ should hold, but just pluggin in $Var(m^2|n=i)=\frac{35}{12}i$ and $E(m|n=i)=\frac{7}{2}i$ disagrees with my experimental results, so something is probably wrong here. What's the correct way to calculate this variance?

1

There are 1 best solutions below

0
On BEST ANSWER

You might want to use the law of total variance

Alternatively, taking something similar to your approach:

  • with one die, $E[m]=\frac72$ and $E[m^2]=\frac{91}{6}$ so $Var[m]=\frac{35}{12}$,
  • with $n$ dice, $E[m]=\frac{7n}2$ and $Var[m]=\frac{35n}{12}$ so $E[m^2]=\frac{35n}{12} + \frac{49n^2}4$

But you do not know $n$, so

  • $E[m]=\frac16\left(\frac{7}2(1+2+3+4+5+6)\right) = \frac{49}4$
  • $E[m^2]=\frac16\left(\frac{35}{12}(1+2+3+4+5+6) + \frac{49}4(1^2+2^2+3^2+4^2+5^2+6^2)\right)=196$
  • so $Var[m]=196 - \left(\frac{49}{4}\right)^2 = \frac{735}{16} = 45.9375$