# Probability question rolling dice

I got the following quiz asked at the interview: a fair dice is rolled infinitelly; what is the expectation of the rolling iteration I, at which one gets two sixs in a row?

• General methods to answer questions like this (focusing on coin flips but generalizable in obvious ways to dice and other discrete distributions) are discussed in the thread at stats.stackexchange.com/questions/12174/….
– whuber
Nov 3, 2014 at 16:16

Interpretation: Let $$K$$ denote the iteration at which the second six is obtained. Determine $$E[K]$$.

Answer: Let $$K_0$$ denote the time when we reach the first six. Then $$E[K_0]$$ is $$\frac{1}{1/6}=6$$ since it follows a geometric distribution.

When we arrive at the first six, there is a 1 in six probability that we will arrive at the second in the next roll. If we fail to do so, the game starts over. That is,

$$E[K] = E[K_0] + 1 + \frac{5}{6}E[K]$$

Simplifying gives $$E[K] = 6 E[K_0] + 6 = 42$$.

## Other versions:

### Standard probability theory:

First by the tower-property, $$E[K] = E[E[K\mid K_0]]$$. Computing the inner expectation gives

\begin{align} E[K\mid K_0] &= \sum_{k=K_0 + 1}^\infty k P(K = k) = \sum_{k=K_0 + 1}^\infty k\big( P(K = k\mid K = K_0+1)P(K = K_0 + 1)\\ &+ P(K = k\mid K \neq K_0+1)P(K \neq K_0 + 1)\big) \\ &=\frac{K_0 + 1}{6} + \frac{5}{6}\sum_{k=K_0 + 2}^\infty k P(K = k\mid K \neq K_0+1) \\ &=\frac{K_0 + 1}{6} + \frac{5}{6}E[K]. \end{align} The last equality follows from that we can put $$s=K_0+2$$ to obtain \begin{align} E[K] &= \sum_{s=1}^\infty k P(K = s) = \sum_{s=1}^\infty k P(K = s\mid K \neq s-1) \\&=\sum_{k=K_0 + 2}^\infty k P(K = k\mid K \neq K_0+1), \end{align}

and the one before from $$P(K = K_0 + 1) = \frac{1}{6}$$.

### Markov theory:

This is a Markov chain with three states, $$K$$, $$K_6$$ and the absorbing state $$K^*$$. The states are for the last two dice-throws. Let $$x$$ be any integer $$1\ldots 5$$ and $$y$$ any integer $$1\ldots 6$$. Then the three states represent $$(y,x)$$, and $$(x,6)$$ and $$(6,6)$$ respectively.

There is a theorem which states that the time to absorption is given as the solution to the equation system:

\begin{align} K &= 1 + \frac{1}{6}K_6 + \frac{5}{6}K\\ K_6 &= 1 + \frac{5}{6}K. \end{align}

Solving for $$K$$ gives the solution $$K_6 + 6 = 42$$. That is, once we are in state $$(x, 6)$$ we expect $$36$$ additional rolls. To get the total we have to add six rolls to reach state $$(x, 6)$$.

• +1 This is correct. That the answer differs from $6^2=36$ begs for an explanation, though: can you supply some useful intuition to account for the difference?
– whuber
Nov 3, 2014 at 15:50
• seems correct, but could you explain why do you have 5/6 E(K) as the second summation term? Could you think of a strict prove with probabilities? Nov 3, 2014 at 23:21
• ... but actually I did not. So the definition of $K$ is the iteration on which the second six was obtained. However, is should be completely defined by $K_0$, since we're looking for two sixs in a row. So $E(K|K_0) = K_0+1$ (it is constant given $K_0$), is not it true? Dec 1, 2014 at 2:24