Yahtzee!

How long does it take you to roll a Yahtzee?

The dice game Yahtzee is a classic. Each player takes turns rolling 5 dice, 3 times each. After each roll, the player can set aside some dice that they want to "keep" and reroll the rest in order to get a better score. The best roll that someone can have is called a "Yahtzee," or 5 dice of the same number, e.g. five 1s, five 2s, etc.

It's easy to determine the probabilities of getting a Yahtzee in 1 roll. You have 5 dice, and a dice has 6 sides, so the chance of getting all 5 the same is ( 1 6 ) 5 \left(\frac{1}{6}\right)^5 , but since there are 6 ways to get a Yahtzee, the probability is really ( 1 6 ) 4 = 1 1296 \left(\frac{1}{6}\right)^4 = \frac{1}{1296} . From this, we can determine that one should expect to roll 5 dice 1296 times before getting a Yahtzee, right?

If you've ever played, you'll realize that the chances of getting a Yahtzee in a game are higher than that. This is because of the rule that you can keep some dice aside after each roll. If after each roll you decide to keep the dice aside that have the number that shows up the most, given an infinite number of rolls (not limited to 3 rolls as in real games), what is the expected number of turns it should take you to get a Yahtzee?

Round your answer to the nearest whole number.

Example sequence of rolls:

  • Roll 1: 1, 2, 4, 4, 5. Keep the two 4s.

  • Roll 2: 4, 4, 6, 3, 3. Keep the two 4s.

  • Roll 3: 4, 4, 1, 1, 1. Keep the three 1s.

  • Roll 4: 1, 1, 1, 5, 1. Keep the four 1s.

  • Roll 5: 1, 1, 1, 1, 1. Done after 5 rolls.


The answer is 11.

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.

2 solutions

Garrett Clarke gave the standard MarPkov chain / linear algebra solution. Here is a more elementary solution, without the use of linear algebra techniques.

General strategy

Just like Garrett did, we can consider 5 "states", depending on how many dice we are keeping aside. Of course, for the first roll we have state "zero".

We will calculate

  • p i j p_{ij} , the probability of getting from state i i to state j j .
  • E i E_i , the expected number of turns to get from state i i to Yahtzee.

It should be clear immediately that p i j = 0 p_{ij} = 0 for j < i j < i . Also, E 5 = 0 E_5 = 0 because if we have Yahtzee there are no more rolls left.

The crucial step in the calculation is the fact that E i = 1 + j p i j E j : E_i = 1 + \sum_j p_{ij} E_j: the number of rolls needed is one (the current roll) plus the weighted average of the rolls that will be needed afterward.

Calculation of E 4 E_4

To see how this pans out, suppose that we have rolled four of a kind: a , a , a , a , b \langle a, a, a, a, b\rangle , with a b a \not = b . We keep the four a a 's behind, and re-roll the one die with a different value. Let x x be the new value of this die.

There are six possible outcomes, which we classify as follows:

  • x = a x = a , with probability 1:6. We have rolled Yahtzee (state 5).
  • x a x \not= a , with probability 5:6. We still have four of a kind (state 4).

Thus p 45 = 1 6 p_{45} = \tfrac16 and p 44 = 5 6 p_{44} = \tfrac56 . The expected number of rolls from state 4 is E 4 = 1 + p 44 E 4 + p 45 E 5 ; E 4 = 1 + 5 6 E 4 ; E_4 = 1 + p_{44}E_4 + p_{45}E_5; \\ E_4 = 1 + \tfrac56E_4; remember that E 5 = 0 E_5 = 0 . Solve this to find 1 6 E 4 = 1 E 4 = 6. \tfrac16E_4 = 1\ \ \ \ \therefore\ \ \ \ \ E_4 = 6.

Thus from state 4 we expect to need six rolls to get Yahtzee.

Calculation of E 3 E_3

If we have rolled a , a , a , b , c \langle a, a, a, b, c\rangle (with b b and c c possibly equal), we re-roll two dice with outcomes x , y x, y . There are 6 2 = 36 6^2 = 36 possible outcomes in three categories:

  • x = y = a x = y = a . This is Yahtzee. The probability is p 35 = 1 / 6 2 = 1 36 p_{35} = 1/6^2 = \tfrac1{36} .
  • x = a x = a or y = a y = a but not both. This gets us to state four. Since there are two dice involved and the other die could be any of five values, the probability of this happening is p 34 = 2 5 / 6 2 = 5 18 p_{34} = 2\cdot 5/6^2 = \tfrac5{18} .
  • x , y a x, y \not= a . This leaves us in state 3. Since x x and y y each has five possible values, p 33 = 5 2 / 6 2 = 25 36 p_{33} = 5^2/6^2 = \tfrac{25}{36} .

The equation for E 3 E_3 becomes E 3 = 1 + p 33 E 3 + p 34 E 4 + p 35 E 5 = 1 + 25 36 E 3 + 5 18 E 4 ; E_3 = 1 + p_{33}E_3 + p_{34}E_4 + p_{35}E_5 = 1 + \tfrac{25}{36}E_3 + \tfrac{5}{18}E_4; substituting E 4 = 6 E_4 = 6 and solving we get 11 36 E 3 = 1 + 5 18 6 11 E 3 = 36 + 60 = 96 E 3 = 96 11 = 8 8 11 . \tfrac{11}{36}E_3 = 1 + \tfrac5{18}\cdot 6\ \ \ \ \therefore\ \ \ \ 11 E_3 = 36 + 60 = 96\ \ \ \ \therefore\ \ \ \ E_3 = \frac{96}{11} = 8 \tfrac{8}{11}.

Calculation of E 2 E_2

And so we continue. If we have two a a 's and re-roll three dice, there are 3 6 = 216 3^6 = 216 possible outcomes in six categories.

  • a , a , a \langle a, a, a\rangle and we get Yahtzee. p 25 = 1 / 6 3 = 1 216 p_{25} = 1/6^3 = \tfrac1{216} .
  • a , a , b \langle a, a, b\rangle gets us to state 4. Since there are three possible dice that could show b b , and five possible values for b b , this gives p 24 = 3 5 / 6 3 = 5 72 p_{24} = 3\cdot 5/6^3 = \tfrac{5}{72} .
  • a , b , c \langle a, b, c\rangle (with b , c b, c possibly equal) gets us to state 3. There are possible dice to show a a , and five possible values for each of b , c b, c , so that we have 3 5 2 = 75 3\cdot 5^2 = 75 outcomes in this category.
  • b , b , b \langle b, b, b\rangle . This interesting situation in which we don't roll any a a still gets us to state 3. (Nobody said we should keep the same dice as before...) There are 5 possible values for b b , so that this adds 5 more outcomes to get us to state 3. Combining with the previous category, we get p 23 = ( 75 + 5 ) / 6 3 = 10 27 p_{23} = (75 + 5)/6^3 = \tfrac{10}{27} .
  • b , b , c \langle b, b, c\rangle with 60 possible arrangements and b , c , d \langle b, c, d with 60 possible arrangements accounts for the remaining 216 1 15 75 5 = 120 216 - 1 - 15 - 75 - 5 = 120 outcomes. Thus p 22 = 120 / 6 3 = 5 9 p_{22} = 120/6^3 = \tfrac 59 .

We can now write and solve the equation for E 2 E_2 : E 2 = 1 + p 22 E 2 + p 23 E 3 + p 24 E 4 + p 25 E 5 ; E 2 = 1 + 5 9 E 2 + 10 27 8 8 11 + 5 72 6 ; E 2 10.46. E_2 = 1 + p_{22}E_2 + p_{23}E_3 + p_{24}E_4 + p_{25}E_5; \\ E_2 = 1 + \tfrac59 E_2 + \tfrac{10}{27}\cdot 8 \tfrac{8}{11} + \tfrac{5}{72}\cdot 6; \\ E_2 \approx 10.46. In other words, once we have two dice with the same value, we expect to roll 10.46 more times to get Yahtzee.

Calculation E 0 E_0

You should get the idea now... it is good practice to categorize the 7776 possible outcomes with 5 dice:

  • a , a , a , a , a \langle a, a, a, a, a\rangle : 6
  • a , a , a , a , b \langle a, a, a, a, b\rangle : 150
  • a , a , a , b , b \langle a, a, a, b, b\rangle : 300
  • a , a , a , b , c \langle a, a, a, b, c\rangle : 1200
  • a , a , b , b , c \langle a, a, b, b, c\rangle : 1800
  • a , a , b , c , d \langle a, a, b, c, d\rangle : 3600
  • a , b , c , d , e \langle a, b, c, d, e\rangle : 720

This gives the probabilities p 00 = 5 54 p_{00} = \tfrac{5}{54} ; p 02 = 25 36 p_{02} = \tfrac{25}{36} ; p 03 = 125 648 p_{03} = \tfrac{125}{648} ; p 04 = 25 1296 p_{04} = \tfrac{25}{1296} ; and p 05 = 1 1296 p_{05} = \tfrac{1}{1296} .

Use this to write the equation for E 0 E_0 and solve. You find E 0 11.09 E_0 \approx 11.09 , which we round off to 11 \boxed{11} .

What about the matrices?

Garrett's solution uses matrices; essentially the values E i E_i are packaged into a vector e \mathbf{e} and the probabilities p i j p_{ij} become a matrix P \mathbf{P} . The four equations E i = 1 + j p i j E j E_i = 1 + \sum_j p_{ij} E_j become the single vector equation e = 1 + P e \mathbf{e} = \mathbf{1} + \mathbf{P}\,\mathbf{e} which is algebraically rearranged as e = ( I P ) 1 1. \mathbf{e} = (\mathbf{I} - \mathbf{P})^{-1} \mathbf{1}. The question is, of course, how to calculate this... well, you need the same calculations as we used above for solving for E i E_i . The linear algebra approach is elegant and more abstract, but ultimately does not save work.

Awesome solution, my method is a little more technical and requires a bit more background knowledge. I'm glad someone posted a more elementary method. One quick thing, I think it should actually be the following sum: E j = 1 + i = j 5 p j i E i E_j = 1 + \displaystyle \sum_{i=j}^5 p_{ji}E_i

Garrett Clarke - 4 years, 10 months ago

Correct. I'll fix it.

Arjen Vreugdenhil - 4 years, 10 months ago

I have a challenge to add to this problem: is the strategy chosen here optimal?

Specifically, if you roll a , a , b , b , c , \langle a, a, b, b, c, \rangle , is it efficient to reroll b , b , c \langle b, b, c\rangle , or would it pay off to leave the a a 's and b b 's and reroll only c c ? The answer it not trivial!

Arjen Vreugdenhil - 4 years, 10 months ago

Log in to reply

The real question is: have you already solved it?

Garrett Clarke - 4 years, 10 months ago

Log in to reply

Yes, I have. It is more efficient to leave only two and reroll the other three.

(The technique is the same, except with a sixth state representing the situation 2 + 2 + 1.)

Arjen Vreugdenhil - 4 years, 10 months ago

Log in to reply

@Arjen Vreugdenhil Haha I was literally about to reply to you, yeah it takes about 13.016 rolls on average with the new method, so the old method is better. Whether my method is the best possible, I have no idea, but I'd guess it's close to it.

Garrett Clarke - 4 years, 10 months ago

Here is a comparison between the two strategies: on top, your strategy; on bottom, the strategy of rerolling only one die in the case a , a , b , b , c \langle a, a, b, b, c\rangle . Comparing the numbers in the right column, it is even more efficient to reroll everything than the strategy I proposed...

Arjen Vreugdenhil - 4 years, 10 months ago
Garrett Clarke
Aug 3, 2016

This problem can be solved through the proper use of transition matrices. We can consider ourselves to be in 1 of 5 states when rolling:

  • State 1: Keep 0 dice aside

  • State 2: Keep 2 dice aside

  • State 3: Keep 3 dice aside

  • State 4: Keep 4 dice aside

  • State 5: Keep 5 dice aside (Yahtzee)

These states make what is known as a Markov Chain. This means that the probability to get from the current state to the next state is not affected by how it got to the current state. We start by filling out a matrix that contains our probabilities to get from one state to another.

T = [ 5 54 25 36 125 648 25 1296 1 1296 0 5 9 10 27 5 72 1 216 0 0 25 36 5 18 1 36 0 0 0 5 6 1 6 0 0 0 0 1 ] T = \begin{bmatrix} \frac{5}{54} & \frac{25}{36} & \frac{125}{648} & \frac{25}{1296} & \frac{1}{1296} \\ 0 & \frac{5}{9} & \frac{10}{27} & \frac{5}{72} & \frac{1}{216} \\ 0 & 0 & \frac{25}{36} & \frac{5}{18} & \frac{1}{36} \\ 0 & 0 & 0 & \frac{5}{6} & \frac{1}{6} \\ 0 & 0 & 0 & 0 & 1 \end{bmatrix}

Each row represents your current state and each column represents your next possible state. The fractions in each column represent the probability that you will reach that state on your next roll, given that you are in another state. For example, if I was currently holding 2 dice back, the chance that I would be holding 4 dice aside after the next roll would be 5 72 \frac{5}{72} , because it is in the 2nd row and the 4th column, or T 2 , 4 T_{2,4} .

To find the expected value, we need to find the probability that we have reached the final state after each roll. Since once we reach the last state we’re done, we can remove the last row and column from our matrix because they are trivial and make calculation harder.

T = [ 5 54 25 36 125 648 25 1296 0 5 9 10 27 5 72 0 0 25 36 5 18 0 0 0 5 6 ] T = \begin{bmatrix} \frac{5}{54} & \frac{25}{36} & \frac{125}{648} & \frac{25}{1296} \\ 0 & \frac{5}{9} & \frac{10}{27} & \frac{5}{72} \\ 0 & 0 & \frac{25}{36} & \frac{5}{18} \\ 0 & 0 & 0 & \frac{5}{6} \end{bmatrix}

Finding the probability that you'll end up in a given state after n n rolls is as easy as finding T n T^n , then reading the probabilities that the resultant matrix provides us with. We now can use the expected value formula for transition matrices to find our answer. Where τ = [ 1 0 0 0 ] \tau = \begin{bmatrix} 1 & 0 & 0 & 0 \end{bmatrix} , I I is the Identity Matrix, and 1 \mathbf{1} is a column vector of all 1s:

E ( Y a h t z e e ) = τ ( I + T + T 2 + T 3 + ) 1 = τ ( I T ) 1 1 E(Yahtzee) = \tau (I+T+T^2+T^3+\dots) \mathbf{1} = \tau (I-T)^{-1} \mathbf{1}

E ( Y a h t z e e ) = [ 1 0 0 0 ] [ 54 / 49 675 / 392 1500 / 539 94575 / 17248 0 9 / 4 30 / 11 965 / 176 0 0 36 / 11 60 / 11 0 0 0 6 ] [ 1 1 1 1 ] 11.09 E(Yahtzee) = \begin{bmatrix} 1 & 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} 54/49 & 675/392 & 1500/539 & 94575/17248 \\ 0 & 9/4 & 30/11 & 965/176 \\ 0 & 0 & 36/11 & 60/11 \\ 0 & 0 & 0 & 6 \end{bmatrix} \begin{bmatrix} 1 \\ 1 \\ 1 \\ 1 \end{bmatrix} \approx 11.09

This means that following this method should give you a Yahtzee in approximately 11 \boxed{11} rolls.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...