37

Basically, on average, how many times one should roll to expect two consecutive sixes?

smriti
  • 3
Joe
  • 387

7 Answers7

56

Instead of finding the probability distribution, 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 required expectation. Let $b$ be the expected additional waiting time if we have just tossed a $6$.

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 then our expected additional waiting 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$.

André Nicolas
  • 507,029
  • 5
    Where did the 1 come from in the first equation? – Cody Smith Sep 17 '16 at 21:07
  • @CodySmith: Sorry, still recovering, will not be able to respond for a few days. – André Nicolas Sep 23 '16 at 23:34
  • 2
    Very elegant solution. – Lokesh Oct 03 '16 at 19:13
  • 2
    @CodySmith The first equation relates expected value of waiting time (LHS) with expected value of waiting time after the result of first toss is deteremined (RHS). That's why there's 1. – Lokesh Oct 03 '16 at 19:18
  • Elegant solution. – MathMan Jan 11 '22 at 18:45
  • 1
    Usually, when calculating an expected value of a random variable $X$ you have something like $\mathbb{E}(X)=\sum\limits_{k=1}^{\infty}p_k\cdot {X=k}$. How does this answer match with the official definition of the expected value? Intuitively it makes sense but I am not able to find the connection between the two equations in the answer and the official definition of expected value. Maybe someone can explain it to me? – Philipp Feb 03 '23 at 01:55
19

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.)

Michael R. Chernick
  • 4,639
  • 2
  • 19
  • 24
Tunococ
  • 10,303
12

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}$enter image description here

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

robjohn
  • 345,667
8

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

  • Even that way if you substitute n=2 and p=1/6 in it you get the following: (1/36-1)/(1/6-1)= 35/36 (6/5)=35/5 =7 – Michael R. Chernick Sep 07 '12 at 02:57
  • My first comment should have used the formula (p$^-$$^2$-1)/(p-1). – Michael R. Chernick Sep 07 '12 at 03:01
  • 2
    @MichaelChernick: Please take a moment and rethink (each of) your comments carefully. – cardinal Sep 07 '12 at 03:04
  • The other question I have is how do you justify the formula that was done for a binary variable (bit equals 0 or 1) with arbitrary p, applying to a multinomial variable (6 values)? Does the result generalize? If so why does p=1/6 apply. – Michael R. Chernick Sep 07 '12 at 03:06
  • 4
    First of all, $(p^{-1} - 1)/(1 - p)$ is not a negative number. – Tunococ Sep 07 '12 at 03:07
  • I made an arithmetic mistake (1/36-1)/(1/6-1)=35/36 (6/5)=7/6. – Michael R. Chernick Sep 07 '12 at 03:07
  • 3
    @MichaelChernick: There is only a sequence of Bernoulli trials here...clearly Byron's analysis applies. – cardinal Sep 07 '12 at 03:08
  • 2
    @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 07 '12 at 03:10
  • @Cardinal Go to the link and see the formula. It has (1-p) in the denominator instead of (p-1). So the result has the wrong sign. I am not disagreeing with the derivation just the minor error in the denominator. But if you do what Byron said and apply the correct version of that formula using n=2 and p=1/6 the result is 7/6 and not 42. 7/6 is not correct. 42 makes more sense. – Michael R. Chernick Sep 07 '12 at 03:13
  • 3
    @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 07 '12 at 03:15
  • $1 - p$ is also non-negative. – Tunococ Sep 07 '12 at 03:15
  • @Cardinal I am having a bad night. I got it wrong. Applying the formula gives (36-1)/(5/6)=35(6)/5=42. Sorry! – Michael R. Chernick Sep 07 '12 at 03:19
  • @MichaelChernick: It happens to all of us at times. :-) – cardinal Sep 07 '12 at 03:21
  • I still think that it is not obvious that the formula extends to this case and even though the probability of a 6 is 1/6 why does that apply to the p in the formula? – Michael R. Chernick Sep 07 '12 at 03:22
  • 1
    $p$ is the chance of "success". In this case, rolling 6 is a success. – Tunococ Sep 07 '12 at 03:22
  • @Cardinal It is 11:30 PM where I live . What time is it where you are? – Michael R. Chernick Sep 07 '12 at 03:23
  • 1
    @Tunococ I am sorry for being dense tonight. I think I get it. It is turned into a binary problem by making 6 a success and anything else a failure. – Michael R. Chernick Sep 07 '12 at 03:26
5

Adding up to Andre's answer. The framework proposed in the solution can be generalized to obtain a formula of expected time as of $t = 0$ for $n$ consecutive throws of any number in the dice as follows. Let $a_1$ = expected additional waiting time if we have not just tossed the number of interest (say, six), $a_{n}$ = expected additional waiting time given we have tossed $n-1$ sixes at $t = n-1$. Then based on Andre's framework, we can solve the following system of equations recursively to obtain a formula of the expected time to obtain $n$ consecutive throws of any number in the dice:

$$a_1 = 1 + \frac{5}{6}a_1 + \frac{1}{6}a_2$$ $$a_2 = 1 + \frac{5}{6}a_1 + \frac{1}{6}a_3$$ $$...$$ $$a_{n-1} = 1 + \frac{5}{6}a_1 + \frac{1}{6}a_n$$ $$a_{n} = 1 + \frac{5}{6}a_1$$

Solving recursively, we can obtain an function for the expected waiting time in terms of the number of consecutive throws we would like to observe:

$$a_1 = \sum^{n-1}_{i=0} (\frac{1}{6})^i +\frac{5}{6}a_1 \sum^{n-1}_{i=0} (\frac{1}{6})^i + (\frac{1}{6})^na_n$$

Using the properties of geometric series and substituting $a_n$, we obtain the following expression for $a_1$

$$a_1 = (6^{n+1} - 6)\frac{6}{5} + 6$$

The result indicated by Andre is obtained when we set $n = 1$, i.e. the expected waiting time for one consecutive throw. Additionally, we see that for zero consecutive throws, we are expected to throw 6 times to obtain a six, which is in line with what we know about fair dices.

4

Another method is to approach this with Linear Algebra and the use of Absorbing Markov Chains and Stochastic Matrices.

We describe the scenario as a markov chain with the states $A_2,A_1,A_0$ corresponding to two, one, or zero sixes most recently seen. We have the following transition matrix:

$$\begin{bmatrix}1& \frac{1}{6}&0 \\0 &0&\frac{1}{6} \\0& \frac{5}{6}& \frac{5}{6}\end{bmatrix}$$

This is in the standard format of $\left[\begin{array}{c|c}I&S\\\hline 0&R\end{array}\right]$

The fundamental matrix, $(I-R)^{-1}$ contains a great deal of useful information, including in this case, the expected number of turns it will take to reach an absorbing state (which in this case corresponds to getting two sixes in a row).

$(I-R)^{-1}=\left(\begin{bmatrix}1&0\\0&1\end{bmatrix}-\begin{bmatrix}0&\frac{1}{6}\\\frac{5}{6}&\frac{5}{6}\end{bmatrix}\right)^{-1}=\begin{bmatrix}1&-\frac{1}{6}\\-\frac{5}{6}&\frac{1}{6}\end{bmatrix}^{-1}$

$$=\begin{bmatrix}6&6\\30&36\end{bmatrix}$$

As when we begin the markov process, we start in state $A_0$ with no currently seen sixes, we look to the corresponding column in our fundamental matrix, the way I've written it will be the second column. Adding the entries of said column will tell us the expected time until we reach an absorbing state. That is to say, the expected number of throws of the die until you get two sixes in a row is:

$$6+36=42$$

JMoravitz
  • 79,518
  • @ajfbiw.s if you have a new question, feel free to create a new question to ask about it. The response to your question would be too long to include as a comment. – JMoravitz Nov 15 '16 at 06:26
  • @ajfbiw.s perhaps part of your confusion is that the wikipedia article writes their matrices as row-stochastic matrices while I write mine as column-stochastic matrices, so the roles of $i$ and $j$ are reversed. As for why the summation of probabilities is the expected number of times it is in that state, defining a random variable for number of times it is in that state you can do so by having it be the sum of $0$-$1$ random variables... the expectation of each is simply its respective probability, so total expectation is sum of expectations is sum of probabilities. – JMoravitz Nov 15 '16 at 07:08
  • @ajfbiw.s again, all of this as well as the answer to your recent additional comment is described in the link I shared with you in the comments of your question and in much greater detail than I can do here. – JMoravitz Nov 15 '16 at 07:09
  • Very nice solution, it's great to see so many different approaches to this problem. – jeremy radcliff Jan 24 '17 at 04:37
  • @ jMoravitz: How did you calculate those probabilities? I posted a similar question, can you please take a look at it? https://math.stackexchange.com/questions/4469788/understanding-a-dice-roll-problem Thank you so much! – stats_noob Jun 10 '22 at 18:34
  • @stats_noob what step specifically? I should think it obvious where the 1/6's came from for instance... that is just the probability of rolling a six. – JMoravitz Jun 10 '22 at 19:47
  • @ jMoravitz: I wrote a simulation for your answer! https://stats.stackexchange.com/questions/578397/expected-number-of-transitions-for-a-markov-chain-to-reach-a-certain-state – stats_noob Jun 10 '22 at 19:50
  • I don't understand (I - R)^-1 relates to the expected number of turns to reach the desired state, and why the sum of the diagonal elements equals to the number of turns required?
  • – stats_noob Jun 10 '22 at 19:53
  • That is the fundamental theorem of absorbing markov chains. And it isn't the sum of the diagonal, it is the sum of the column corresponding to our initial state – JMoravitz Jun 10 '22 at 19:55
  • I don't understand why the Probability of going from A2 to A1 = 1/6. If A2 corresponds to two sixes, why do you need to worry about going from two sixes to any other state - you are done, no? Are the states in the same order in the transition matrix as you have written them (A2, A1, A0) - or is it (A0, A1, A2)?
  • – stats_noob Jun 10 '22 at 19:56
  • Describe them in whatever order like, but when writing them in the matrix change the order so that the absorbing state(s) are all at the front. A2 does not go to A1. It only goes to A2 with probability 1. It can go from A1 to A2 with probability 1/6. Make sure whatever notes you are reading you understand if they are writing it so the columns add up to 1, or if they are writing it transposed where rows are adding up to 1 instead. You seem to be confusing what I intend columns and rows to mean. See my above reply to another now deleted comment above. – JMoravitz Jun 10 '22 at 20:02