2

A teacher in school told us about this math problem:

  • Problem 1: On average, how many times do you need to roll a dice before you see a 4 followed by a 6?
  • Problem 2: On average, how many times do you need to roll a dice before you see a 6 followed by a 6?

Apparently, even though we might think that rolling any number on a dice has equal probability, the answer to Problem 1 is not the same as Problem 2!

In another post (https://stackoverflow.com/questions/69081795/simulating-dice-rolls-in-r), I learned how to write a function (using the R programming language) to simulate both of these problems:

Problem 1:

# Problem 1 (4 followed by 6):

roll_from_4_to6 <- function() { n <- 1:6 i <- 1 previous_4 <- FALSE while(TRUE) { current_value = sample(n, 1) i <- i + 1 if(previous_4 && current_value == 6) break previous_4 <- current_value == 4 } i }

mean(replicate(100000, roll_from_4_to6())) [1] 36.92289

Problem 2:

# Problem 2 (6 followed by 6):

roll_from_6_to6 <- function() { n <- 1:6 i <- 1 previous_4 <- FALSE while(TRUE) { current_value = sample(n, 1) i <- i + 1 if(previous_4 && current_value == 6) break previous_4 <- current_value == 6 } i }

mean(replicate(100000, roll_from_6_to6()))

[1] 43.25653

As we can see here, the number of times needed to roll a "4 followed by a 6" is clearly different than a "6 followed by a 6". I have always tried to find a mathematical explanation for what is happening. I heard this problem can be solved using Markov Chains - but I am not sure how to set up the Transition Matrix for these problems and calculate the number of "steps" (i.e. raising the transition matrix to the power of "k") required to reach the Absorption State.

Can someone please show me how to do this specifically using Markov Chains?

Thanks!

stats_noob
  • 4,375
  • 2
    If you have thrown a 4 and aim to throw a 6 in the next roll then by a faiure you can have thrown again a 4 so that the next effort starts right away and one new throw might be enough to succeed. If on the other hand you have thrown a 6 and aim to throw a second 6 then things are different because by a failure at least two new throws are needed to succeed. So there is an essential difference. – drhab Jun 10 '22 at 17:07
  • @ drhab: thank you for this comment! it makes a lot of sense! – stats_noob Jun 10 '22 at 17:20
  • The difference is: in the first, after you have rolled a $4$ you can roll another $4$ to stay active. In the second, there is no analog. After the first $6$ you either win or you revert to start. – lulu Jun 10 '22 at 22:39
  • If you want to use (absorbing) Markov chains you can define states spaces ${\emptyset,4,46},{\emptyset,6,66}$ for problem #1, problem #2 respectively. You start in $\emptyset$ and step each time you roll. Can you draw the corresponding state transition diagrams? Are they identical? You know about the fundamental matrix? –  Jun 11 '22 at 01:45
  • @ Matthew H : Thank you for your reply! I can draw the corresponding state diagram. What is the fundamental matrix? Thank you so much! – stats_noob Jun 11 '22 at 02:25

1 Answers1

2

This can be solved very simply.

For getting $4$ followed by a $6$:

Let s be the starting state (waiting for a $4$) and a be the state where we have just rolled a $4$ and are waiting for a $6$

From the starting state, with one throw, either we get a $4$ with $Pr=\frac16$ or return to starting state with $Pr= \frac56$, so
$s = 1+ \frac{a}6 + \frac{5s}6 ... [I]$

And from a either we throw a $6$ and are done , remain at $4$, or return to start $a = 1+\frac{a}6 + \frac{4s}6 ...[II]$

Solving we get $s = \boxed{36}$


For getting $6$ followed by a $6$

The first equation will be as before, viz

$s = 1+ \frac{a}6 + \frac{5s}6 ... [I]$

But note that after getting a $6$, if we don't get another $6$, we go straight back to start

$a = 1+\frac{5s}6\;...[II]$

solving, we get $s = \boxed{42}$

  • @ true blue anil: thank you so much for your answer! is it possible to solve this using markov chains? thank you! – stats_noob Jun 11 '22 at 02:33
  • This does use the Markov property (future state depends only on the present state) without matrix algebra. The technique is called first step analysis, you can understand the relation between the two better from this answer. https://math.stackexchange.com/questions/4083871/something-maybe-related-to-stochastic-process – true blue anil Jun 11 '22 at 05:05