# Expectation of a die roll summed

I know this problem involves conditional probability, but I'm confused as to how to tackle it.

Assume a die is rolled over and over, where the total is summed. If the die's roll is $\geq 3$ the game stops and the summed total is read out. What is the expectation of the total? What is the expected number of times the die was rolled?

• what's the odds of a roll < 3 ? – user451844 Aug 6 '17 at 22:33
• @RoddyMacPhee It is the classical case of "rpg player comes to the MathSE for calculating dice rolls" :-) They use level distributed, mechanical, true random generators on the integers between 1 and {4, 6, 8, 10, 12, 20}. If he doesn't say otherwise, then 6 is the default upper limit. – peterh Aug 6 '17 at 22:40
• Yeah sorry :) A standard die :) – Andy Aug 7 '17 at 0:31

## 4 Answers

The total number of rolls follows a geometric law of parameter $p=\dfrac{4}{6}=\dfrac{2}{3}$. Therefore the expected number of rolls is $1/p=\color{red}{1.5}$.

Therefore the expected total is $(1/p-1)\cdot 1.5 + 4.5=\color{red}{5.25}$, because $1.5$ is the mean of a roll between $1$ and $2$ (and you have an average of $1/p -1$ rolls between $1$ and $2$) and $4.5$ is the mean of the last roll (between $3$ and $6$).

By the way you can easily verify your results for this kind of problem with a simple python code:

import random as random

nb_trials = 10000
tot = 0

for i in range(nb_trials):
sum_value = 0
b = True
while b:
a = random.randint(1,6)
if a >=3:
b = False
sum_value += a
tot += sum_value

average = tot * 1.0 / nb_trials
print(average)


Try it online!

• I feel you should mention Wald's lemma, here. It's non-trivial that you can just multiply the expected number of dice rolls by the expected value of a roll. – David Richerby Aug 7 '17 at 9:39
• You'd need Wald's lemma if the justification was "$1.5\times 3.5=5.25$", but that's not what fonfonx has done. – Especially Lime Aug 7 '17 at 10:55
• @EspeciallyLime Wald's lemma is needed for $(1/p-1) \times 1.5$, the expected number of rolls before the last roll times the expected value of such a roll. That is nontrivial and wasn't justified in another way. – JiK Aug 7 '17 at 11:43
• Sanity check: 1,5 rolls times average of a six-sided die, 3,5, equals 3,5 + 1,75 = 5,25. – JollyJoker Aug 7 '17 at 11:45
• @JiK we clearly disagree about what is trivial. The number of rolls made which are $1$ or $2$ is independent of whether each one is a $1$ or a $2$. So this is just a random sum of random variables where the number of terms is independent of the terms themselves. The reason Wald's lemma is non-trivial is that it applies even without independence. Quoting Wald would allow you to go straight from $1.5$ rolls on average to the answer, without using fonfonx's clever trick to get rid of the dependence. – Especially Lime Aug 7 '17 at 12:04

The game will stop after $1$ roll with a probability $2/3$. It will stop after $2$ rolls with a probability $1/3 \times 2/3$. ... It will stop after $n$ rolls with a probability $(1/3)^{n-1} \times 2/3$. So the expected number of rolls is given by the sum \begin{eqnarray*} \sum_{n=1}^{\infty} n \frac{2}{3} \left( \frac{1}{3} \right)^{n-1} = \frac{2}{3} \sum_{n=1}^{\infty} n \left( \frac{1}{3} \right)^{n-1} \end{eqnarray*} Now use the well known formula $\sum_{n=1}^{\infty} n x^{n-1}= \frac{1}{(1-x)^2}$ and we have $3/2$. So you would expect the games to last for one and a half rolls.

You have $p=1/3$ to roll a die and get only $1$ or $2$. So you have $P(n)=p^n q=p^n (1-p)$ to roll the die $n$ times getting less than $3$, and then more or equal $3$ at the $n+1$-th roll.
We include $n=0$, meaning that you get $\ge 3$ at the first roll.

The sum P(n) over $0 \le n < \infty$ correctly gives $1$.

Now, the expected number of less than $3$ rolls will be \eqalign{ & E(n) = \sum\limits_{0\; \le \,n\,} {n\,P(n)} = (1 - p)\sum\limits_{0\; \le \,n\,} {n\,p^{\,n} } = \cr & = (1 - p)p{d \over {dp}}{1 \over {1 - p}} = {p \over {1 - p}} = {1 \over 2} \cr} while the expected number of total rolls, of course is $$E(n + 1) = {3 \over 2}$$

At each less than $3$ roll you can get, with same probability, a 1 or a 2, thus in average $3/2$.
So espected sum of the rolls before stopping is $3/2E(n)=3/4$.

Another way of looking at it:

If you roll a 3,4,5, or 6 on the first roll (1/6 chance each), then the expected total will be that number (3, 4, 5, or 6).

If you roll a 1 or a 2, (also 1/6 chance each), then the expected roll is 1 or 2, PLUS the total expected roll.

So the total expected roll $T$ should be:

\begin{aligned} T &= \frac{1+T}{6} + \frac{2+T}{6} + \frac{3}{6} + \frac{4}{6} + \frac{5}{6} + \frac{6}{6} \\ T &= \frac{1+2+3+4+5+6}{6} + \frac{2T}{6} \\ T &= \frac{7}{2} + \frac{T}{3} & \text{(multiply by 3)} \\ 3T &= \frac{21}{2} + T & \text{(subtract $T$)}\\ 2T &= \frac{21}{2} & \text{(divide by 2)}\\ T &= \frac{21}{4} = 5.25 \end{aligned}

• I worked it the same way as AMADANON, but i think this is more readable: $T = \frac{2}{6} (\frac{1+2}{2}+T) + \frac{4}{6} (\frac{3+4+5+6}{4})$ = $\frac{1}{2} + \frac{1}{3}T + 3$ ⇒ $\frac{2}{3}T = \frac{7}{2}$ ⇒ $T=\frac{21}{4}$. – Anton Sherwood Aug 7 '17 at 6:26