# How many times to roll a die before getting two consecutive sixes?

Basically, on average, how many times do you have to roll a fair six-sided die before getting two consecutive sixes?

-

Instead of calculating probabilities, and then the expectation, we can work directly with expectations. That is often a useful strategy.

Let $a$ be the expected (additional) waiting time if we have not just tossed a $6$. At the beginning, we certainly have not just tossed a $6$, so $a$ is the reqired expectation. Let $b$ be the additional waiting time if we have just tossed a $6$. It is clear that $b\lt a$.

If we have not just tossed a $6$, then with probability $\frac{5}{6}$ we toss a non-$6$ (cost: $1$ toss) and our expected additional waiting time is still $a$. With probability $\frac{1}{6}$ we toss a $6$ (cost: $1$ toss) and our expected additional waiting time is $b$. Thus $$a=1+\frac{5}{6}a+\frac{1}{6}b.$$ If we have just tossed a $6$, then with probability $\frac{5}{6}$ we toss a non-$6$, and our expected additional time is $a$. (With probability $\frac{1}{6}$ the game is over.) Thus $$b=1+\frac{5}{6}a.$$ We have two linear equations in two unknowns. Solve for $a$. We get $a=42$.

-

The formula is proved in the link given by Byron. I'll just try to give you my intuition regarding the formula.

The chance of rolling 6 on two dice is $1/36$. So if you think of rolling two dice at once as one trial, it would take an average of $36$ trials.

However, in this case you are rolling 1 die at a time, and you look at two consecutive rolls. The average number of trials to see the first 6 is $6$ times. Suppose we roll one more times to see if the two 6's are consecutive. Record the sequence of all rolls as

$$???????6?$$

where $?$ stands for any number that is not 6. The length of this sequence is random, but the average length of this sequence is $7$.

Now, the question is how many sequences of this type we will see before we get a sequence that ends in $66$. Since we are only interested in the last number of the sequence, there is a $1/6$ chance that the sequence will end in $66$. The same argument says that the average number of sequences we will need is $6$. Multiply this with the average length of the sequence to get $7 \cdot 6 = 42$ as the answer.

This argument generalizes to more than $2$ consecutive 6's by induction. For example, if you want $3$ consecutive 6's, you consider sequences that look like this:

$$???????66?$$

The average length of a sequence of this type is $42 + 1 = 43$. Therefore, the answer is $43 \cdot 6 = 258$.

It's not hard to generalize this situation. The general form is $L_{n+1} = \frac{1}{p}(L_n + 1)$ where $p$ is the probability of the desired symbol appearing and $L_n$ is the average number of trials until the first occurrence of $n$ consecutive desired symbols. (By definition, $L_0 = 0$.) This recurrence can be solved pretty easily, giving the same formula as in Byron's link. (The proof is essentially the same too, but my version is informal.)

-
Thanks for this explanation @Tunococ –  Michael Chernick Sep 7 '12 at 4:23

Here is a generating function approach to this question. Consider the following atomic rolls:

$\mathbf{a}$. $1$-$5$ ($5/6$ chance, $1$ roll) represented by $\frac56x$

$\mathbf{b}$. $6$ followed by a $1$-$5$ ($5/36$ chance, $2$ rolls) represented by $\frac5{36}x^2$

$\mathbf{c}$. $6$ followed by a $6$ ($1/36$ chance, $2$ rolls) represented by $\frac1{36}x^2$

Each possible scenario ending in a double $6$ is captured exactly once by a certain number of $\mathbf{a}$ or $\mathbf{b}$ atoms followed by a $\mathbf{c}$ atom. The monomial representations have a coefficient equal to the probability of that atomic roll and an exponent of $x$ equal to the number of rolls.

Note that the coefficient of $x^n$ in $\left(\frac56x+\frac5{36}x^2\right)^k\frac1{36}x^2$ is the probability of ending in $n$ rolls having rolled $k$ $\mathbf{a}$ or $\mathbf{b}$ atoms followed by $1$ $\mathbf{c}$ atom. Summing these up for all $k$ yields a formal power series in which the coefficient of $x^n$ is the probability of ending in exactly $n$ rolls.

That is, the generating function for the probability of ending in exactly $n$ rolls is $$f(x)=\frac{\frac1{36}x^2}{1-\frac56x-\frac5{36}x^2}\tag{1}$$ As a check, notice that $f(1)=1$, so the sum of the probabilities is $1$.

Now to find $\mathrm{E}(n)$, the expected value of $n$, we take a derivative, multiply by $x$, and evaluate at $1$: $$xf'(x)=\frac{\frac1{36}x^2\left(2-\frac56x\right)}{\left(1-\frac56x-\frac5{36}x^2\right)^2}\tag{2}$$ Evaluating $(2)$ at $x=1$ yields $\mathrm{E}(n)=42$.

Next, to find $\mathrm{E}(n^2)$, we take another derivative, multiply by $x$, and evaluate at $1$: $$xf'(x)+x^2f''(x)=\frac{\frac1{36}x^2\left(4-\frac52x+\frac54x^2-\frac{25}{216}x^3\right)}{\left(1-\frac56x-\frac5{36}x^2\right)^3}\tag{3}$$ Evaluating $(3)$ at $x=1$ yields $\mathrm{E}(n^2)=3414$. Thus, the variance of the number of rolls is $\mathrm{E}(n^2)-\mathrm{E}(n)^2=3414-42^2=1650$.

Therefore, the expected number of rolls is $42$ with a standard deviation of $\sqrt{1650}\approx40.62$.

Distribution: Here is a plot of the probabilities of getting a double $6$ on a particular roll. I was surprised that the probability for both $3$ and $4$ rolls was $\frac5{216}$.

$\hspace{2cm}$

Extension: I have added a generating function answer to the more general question that Byron references in his answer.

-

Plugging $n=2$ and $p=1/6$ into my answer here, we see that the answer is $6^2+6=42$.

-
@MichaelChernick: Please take a moment and rethink (each of) your comments carefully. –  cardinal Sep 7 '12 at 3:04
First of all, $(p^{-1} - 1)/(1 - p)$ is not a negative number. –  Tunococ Sep 7 '12 at 3:07
@MichaelChernick: There is only a sequence of Bernoulli trials here...clearly Byron's analysis applies. –  cardinal Sep 7 '12 at 3:08
@MichaelChernick: I'm sorry; I do not mean to sound harsh; but, you've posted five comments to this answer in twenty minutes. None of them are correct. Please stop and take a moment, think, and reevaluate. Cheers. :-) –  cardinal Sep 7 '12 at 3:10
@MichaelChernick: I will repeat my suggestion: Stop, take a moment, and think. Consider whether $1/p$ is less than or greater than 1. Then, consider whether $1-p$ is positive or negative. That should get you started. –  cardinal Sep 7 '12 at 3:15