Feeling Sleepy

I am feeling sleepy but can't sleep. So I decide to roll a dice as many times as it takes until I get a 6 immediately after a 5.

Assuming each throw takes me one second and I will fall asleep as soon as I get a 6 immediately after a 5, what is the expected time (in seconds) in which I will fall asleep?

For example, if the results of the dice rolls are 1 , 6 , 5 , 6 , 5 , 2 {1, 6, 5, 6, 5, 2} , then I must stop at roll 4 and fall asleep immediately, which implies that the time taken would be 4 seconds.


The answer is 36.

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

Lokesh Sharma
Oct 3, 2016

Let X X and Y Y be two random variables defined as follows:

X X : Number of rolls until 6 6 appears immediately after a 5 5

Y Y : Number of rolls until either 6 6 appears in the first roll or 6 6 appears immediately after a 5 5

Lets relate the expected values of random variable X and Y before and after the most recent throw.

E [ X ] = 5 6 E [ X + 1 ] + 1 6 E [ Y + 1 ] E[X] = \frac{5}{6}E[X+1] + \frac{1}{6}E[Y+1]

E [ Y ] = 1 6 + 4 6 E [ X + 1 ] + 1 6 E [ Y + 1 ] E[Y] = \frac{1}{6} + \frac{4}{6}E[X+1] + \frac{1}{6}E[Y+1]

Solving these two equations yield E [ X ] = 36 E[X] = 36

Explanation for above two equations

Let A A be the event that the most recent roll was a 5 5 .

We know that:

E [ X ] = E [ X A ] × P [ A ] + E [ X A ] × P [ A ] E[X] = E[X|A'] \times P[A'] + E[X|A] \times P[A]

E [ X ] = 5 6 E [ X A ] + 1 6 × E [ X A ] E[X] = \frac{5}{6}E[X|A'] + \frac{1}{6} \times E[X|A]

Now, here's the crucial part,

E [ X A ] = E [ X + 1 ] E[X|A'] = E[X+1]

The above is true because given the most recent throw was determined to be not a 5 5 , the expected value is same as that of X + 1 X+1 because of the memorylessness property.

Similarly E [ X A ] = E [ Y + 1 ] E[X|A] = E[Y+1] because given the most recent roll is determined to be 5 5 , the expected value is same as that of Y + 1 Y+1 .

Similarly the second equation can be thought of.

+1 Your solution is a great read. Here are some ways to improve it

  1. Clarify what "A be the event that the first roll was a 5" means. Do you mean the very first roll (which in the example would be 1)? In fact, I believe that you mean the most recent (IE last) roll instead.

Thanks for contributing and helping other members aspire to be like you!

Calvin Lin Staff - 4 years, 8 months ago

Log in to reply

Yes, I meant the most recent throw. Thanks for pointing it out. I have corrected it.

Lokesh Sharma - 4 years, 8 months ago
Alex Li
Oct 10, 2016

You want to get a specific permutation of 2 dice. There are 36 possible permutations. Since you have a 1/36 chance of getting the correct permutation each roll, it is expected to take 36 tries. I don't really understand why it's not 37, though- the first roll doesn't count as a try, so I'm pretty sure you need to add 1.

Thanks for putting in the effort to write up the solution. Unfortunately, it is incorrect because of:

  1. You made a misconception with expected value calculations. Finding it for such "compound" events isn't as simple as "find the number of instances" which works for the single-event with uniform probability. Instead, you have to get at the heart of expected value to figure out the answer.

Keep up the good effort!

Calvin Lin Staff - 4 years, 8 months ago

I also answered 37.

Pedro Baldaia - 4 years, 8 months ago
Khaled Khalil
Oct 10, 2016

Since we have six possibilities for any single roll, it takes 6 rolls to get a 5. On getting a 5, we have six different possibilities of the outcome after it as well. One of those is getting a 6. Hence, out of 36 different possibilities for a pair (like 3 then 4), there is one possibility of 5 then 6.

So the maximum time needed to get a (5,6) is 36 seconds.

Yet, the average time would definitely be less than this. It'd be 18.

Thanks for putting in the effort to write up the solution. Unfortunately, it is incorrect because of:

  1. You made a misconception with expected value calculations
  2. We are not guaranteed to find (5,6) within 36 seconds. We could row the dice and get 6's 100 times.
  3. The average (IE expected) time is actually 36.

Keep up the good effort! I look forward to seeing more solutions.

Calvin Lin Staff - 4 years, 8 months ago

That's what I thought. I totally agree.

Peter Ye - 4 years, 8 months ago

Log in to reply

Careful there. 36 isn't the maximum time needed to get a (5,6). It's the expected time. Nothing garantees that it won't take longer. Also the average time is the expected time, so the average is 36, not 18.

Kai Ott - 4 years, 8 months ago

Aaa Bbb I understand now. Thanks

Peter Ye - 4 years, 8 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...