Rolling Higher

Roll a fair six-sided die until you roll a number that is less than one of your previous rolls. To three decimal places, what is the expected value of the number of rolls made?


Bonus : Suppose you rolled a fair n n -sided die instead. What is the expected value of the number of rolls made?

Extra Bonus : As n , n \to \infty, what does the expected value of the number of rolls approach?


The answer is 2.986.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Mark Hennings
Oct 2, 2017

Relevant wiki: Stars and Bars

If X X is the number of rolls made with an n n -sided dice, then P [ X > N ] \mathbb{P}[X > N] is the probability that the first N N rolls come in ascending order. A standard stars-and-bars argument tells us that this probability is P [ X > N ] = ( N + n 1 N ) × n N \mathbb{P}[X > N] \; = \; \binom{N+n-1}{N} \times n^{-N} and hence E [ X ] = N = 1 P [ X N ] = N = 0 P [ X > N ] = N = 0 ( N + n 1 N ) n N = ( 1 n 1 ) n = ( n n 1 ) n \mathbb{E}[X] \; = \; \sum_{N =1}^\infty \mathbb{P}[X \ge N] \; = \; \sum_{N=0}^\infty \mathbb{P}[X >N] \; = \; \sum_{N=0}^\infty \binom{N+n-1}{N} n^{-N} \; = \; \big(1 - n^{-1}\big)^{-n} \; = \; \left(\tfrac{n}{n-1}\right)^n With n = 6 n=6 , this makes the answer ( 6 5 ) 6 = 2.985984 \boxed{\big(\tfrac65\big)^6 = 2.985984} . The limit as n n \to \infty of the expected value is e e .

:thumbsup:

I'd like to add yet another question to the three that Andy asked: Suppose we only wanted to show that the expected value decreases as n increases. Is there an easy way to do so?

It's common sense that the smaller n is, the greater the chance of re-rolling the same number that was just rolled, which should mean a larger EV all other things being equal but I don't think that by itself is a complete explanation.

Peter Byers - 3 years, 8 months ago

Log in to reply

Certainly P [ X > N ] \mathbb{P}[X > N] is an decreasing function of n n for any N 1 N \ge 1 , since P [ X > N ] = 1 N ! j = 1 N 1 ( 1 + j n ) \mathbb{P}[X > N] \; = \; \frac{1}{N!} \prod_{j=1}^{N-1}\big(1 + \tfrac{j}{n}\big) but I suspect that that is not easy enough!

Mark Hennings - 3 years, 8 months ago

Hello, can you tell me the method or formula you used to calculate the infinite serie of binomials at the end of the proof?

Carlos Andrés Betancourt Baca - 3 years, 8 months ago

Log in to reply

The Inverse, or generalised, Binomial Theorem.

Mark Hennings - 3 years, 8 months ago

Log in to reply

Thanks!, I will check it.

Carlos Andrés Betancourt Baca - 3 years, 8 months ago
Andy Hayes
Oct 2, 2017

Relevant wiki: Law of Iterated Expectation

Let X X be the number of rolls until a lesser number is rolled. Now let the following conditional expected values be defined:

a = E [ X 1 ] = a = \text{E}[X \mid 1] = The expected value of the number of rolls given that the most recent roll was 1.

b = E [ X 2 ] = b = \text{E}[X \mid 2] = The expected value of the number of rolls given that the most recent roll was 2.

c = E [ X 3 ] = c = \text{E}[X \mid 3] = The expected value of the number of rolls given that the most recent roll was 3.

d = E [ X 4 ] = d = \text{E}[X \mid 4] = The expected value of the number of rolls given that the most recent roll was 4.

e = E [ X 5 ] = e = \text{E}[X \mid 5] = The expected value of the number of rolls given that the most recent roll was 5.

f = E [ X 6 ] = f = \text{E}[X \mid 6] = The expected value of the number of rolls given that the most recent roll was 6.

It's easier to solve for f f first and then work your way backwards. Due to linearity of expectation:

f = 1 6 ( 1 + f ) + 5 6 ( 1 ) f = 6 5 e = 1 6 ( 1 + f ) + 1 6 ( 1 + e ) + 4 6 ( 1 ) e = ( 6 5 ) 2 d = 1 6 ( 1 + f ) + 1 6 ( 1 + e ) + 1 6 ( 1 + d ) + 3 6 ( 1 ) d = ( 6 5 ) 3 \begin{aligned} f &= \frac{1}{6}(1+f)+\frac{5}{6}(1) \\ f &= \frac{6}{5} \\ \\ e &= \frac{1}{6}(1+f)+\frac{1}{6}(1+e)+\frac{4}{6}(1) \\ e &= \left(\frac{6}{5}\right)^2 \\ \\ d &= \frac{1}{6}(1+f)+\frac{1}{6}(1+e)+\frac{1}{6}(1+d)+\frac{3}{6}(1) \\ d &= \left(\frac{6}{5}\right)^3 \end{aligned}

One might notice a pattern at this point. It just so happens that this pattern holds, and a = ( 6 5 ) 6 . a=\left(\frac{6}{5}\right)^6. Then note that E [ X ] = E [ X 1 ] . \text{E}[X]= \text{E}[X\mid 1]. Then the expected number of rolls is ( 6 5 ) 6 2.986 . \left(\frac{6}{5}\right)^6\approx \boxed{2.986}.

I don't get it. why is E [ X ] = E [ X 1 ] . \text{E}[X]=\text{E}[X\mid1].

Humam AL Sebai - 3 years, 8 months ago

Log in to reply

There are no rolls less than 1, so rolling a 1 means that you are essentially back where you started.

Andy Hayes - 3 years, 8 months ago

Why is it f=1/6 (1+f) + 5/6(1). I would really appreciate it you could explain further.

Amal Ahmed - 3 years, 8 months ago

Log in to reply

f f represents the expected number of rolls after rolling a 6. After rolling a 6, there is a 1/6 probability that you would roll a 6 again, and a 5/6 probability that you would roll lower than a 6. If you roll a 6, then the expected number of rolls from that point on is f f plus 1 for the roll you just made. If you roll lower than a 6, then you add 1 for the roll just made, but there are no more rolls after that.

Linearity of expectation allows one to add expected values and write equations like this. Check out the wiki if you'd like to learn more.

Andy Hayes - 3 years, 8 months ago

Log in to reply

Why wouldn't in the quation for e the number added by the probability of rolling 6,not be 1/6(1+e),why is it 1/6(1+f)?

Yasoda Gamage - 3 years, 8 months ago

Log in to reply

@Yasoda Gamage e e represents the expected number of rolls after rolling a 5. After rolling a 5, there is a 1/6 probability that you would roll a 6, a 1/6 probability that you would roll a 5, and a 4/6 probability that you would roll lower than a 5. If you roll a 6, then the expected number of rolls from that point on is f f plus 1 for the roll you just made. If you roll lower than a 5, then the expected number of rolls from that point on is e e plus 1 for the roll you just made. If you roll lower then a 5, then you add 1 for the roll just made, but there are no more rolls after that.

Andy Hayes - 3 years, 8 months ago

Log in to reply

@Andy Hayes But if you roll a 6 after rolling a 5,shouldn't the contribution to the expected number of rolls for the next roll to be less than 5,still be e+1,not f+1?

Yasoda Gamage - 3 years, 8 months ago

Log in to reply

@Yasoda Gamage There's 3 possible things that could happen after you roll a 5:

  • You roll a 6. Now your most recent roll is a 6, and so the expected number of rolls from that point on is f . f. (I'm not sure what you are saying about f f and e . e. f = 6 5 . f=\frac{6}{5}. e = 36 25 . e=\frac{36}{25}. f f is indeed less than e . e. )
  • You roll a 5. Now your most recent roll is still 5, so the expected number of rolls from this point is e e again.
  • You roll less than 5. Now you are done rolling.

Andy Hayes - 3 years, 8 months ago

I think you mean first roll and not last roll

Humam AL Sebai - 3 years, 8 months ago

Log in to reply

Actually, I meant "last roll" as in "the most recent roll previous to this one." I will change the language in the solution.

Andy Hayes - 3 years, 8 months ago

I get it now

Humam AL Sebai - 3 years, 8 months ago

This is a very elegant approach, I've been trying to do it using this formula: E(x) = 2 P(2)+3 P(3)+...N*P(N)

I've managed to figure out that P(2)=15/36 but I can't find a formula for P(N)

Tomás Sanz De Santamaría - 3 years, 7 months ago
Stephen Weinberg
Oct 9, 2017

Relevant wiki: Monte-Carlo Simulation

Cheater's ( Monte Carlo ) solution:

This takes me about 30 seconds to run with python 2.7 and less than 2 seconds with pypy. It will usually get the correct answer. Running it 3 times gave me the same number for the first three decimal places which is all that is necessary to answer the question.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
import random

random.seed()

def simulate():
    max = 0
    count = 0
    while True:
        roll = random.randint(1, 6)
        count += 1
        if roll < max:
            return count
        max = roll

n = 10000000

print sum(simulate() for x in xrange(0,n))/float(n)

I have been working for a while on the question because I felt there is more to it than what meets the eye. Before I explain the method I used to solve the question let me explain what I understand the question is asking for. The question wants to determine the expected number of rolls it takes to produce a number that is less than any previous role. A logical question is What happens if I roll 1 in the first turn? I presume that in this case the game finishes. In fact, number 1 is a winner, if I roll a 1 I am done. On the contrary, number six is a loser. You can not win if you role a 6. The complication lies in the numbers in between. OK so here goes the calculation: Let us start from roll 1. If I roll a 1 I win. If I roll 2,3,4,5 and 6 I lose. So P(1)=1/6=0.167. Now suppose I did not roll a 1, this has a likelihood of 5/6. I go to role 2. In roll 2, if I have already rolled 6 then rolling 1,2,3,4 and 5 is a win. if I have already rolled 5 then rolling 1,2,3 and 4 is a win.if I have already rolled 4 then rolling 1,2 and 3 is a win. if I have already rolled 3 then rolling 1 and 2 is a win. and if I have already rolled a 2 the rolling 1 is the only winner. Computing the probability that I win in the second round I get. P(2)=5/12=0.417. Continuing the same way I get: P(3)=0.255 P(4)=0.108 P(5)=0.038 P(6)=0.012 P(7)=0.003 P(8)=0.001 P(9)=0.0002

Ok so Now I can neglect the remaining values as they are too small and will not affect the answer. The expected value for the number of rolls is given by:

E [ X ] = a l l x i x i × P i {E}[X]=\sum_{all x_i} x_i \times P_i

This gives E(X) = 1 x 0.167 + 2 x 0.417 + 3 x 0.255 + ... = 2.488

So final answer is 2.488

Now I understand that this is not the solution according to the problem. But I do not understand the logic behind the solution presented by Mr. Andy Hayes. This is my take on the problem. What do you think

Thank you for your time

For more details Email me humam_sebai@hotmail.com

Humam AL Sebai - 3 years, 8 months ago

Log in to reply

I read it the opposite- each time you begin you need one roll to set the game and another roll to see if your roll is less. So if you roll a 6 then you win on your next roll with anything but a 6. If you roll a 1 then you never win on the second roll and then it depends on the next roll to set the game thus the iterative logic in most of the answers. I am not up on this enough to solve, but I think my basic understanding of the rules is correct.

Donal Stones - 3 years, 8 months ago

Log in to reply

Yes Thanks a lot I get it now I modified my calculations and I got the right answer 2.985

Humam AL Sebai - 3 years, 8 months ago

You only stop if your current roll is smaller than any previous roll. Since, at the first roll, you have no previous rolls, it is impossible for your first roll to be less than any previous roll. Thus you cannot stop at the first roll. As Donal says, you will definitely not stop at the second roll if your first roll was 1 1 , either.

Mark Hennings - 3 years, 8 months ago

Them dice'll make you talk - Damon Runyon

Jay O'Brien - 2 years, 7 months ago

I got it Now

Humam AL Sebai - 3 years, 8 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...