Solved – Roll a die until it lands on any number other than 4. What is the probability the result is > 4

diceprobability

A player is given a fair, six-sided die. To win, she must roll a number greater than 4 (i.e., a 5 or a 6). If she rolls a 4, she must roll again. What are her odds of winning?

I think the probability of winning $P(W)$, can be expressed recursively as:

$$
P(W) = P(r = 5 \cup r = 6) + P(r = 4) \cdot P(W)
$$

I've approximated $P(W)$ as $0.3999$ by running 1 million trials in Java, like this:

import java.util.Random;
public class Dice {

    public static void main(String[] args) {
        int runs = 1000000000;
        int wins = 0;
        for (int i = 0; i < runs; i++) {
            wins += playGame();
        }
        System.out.println(wins / (double)runs);
    }

    static Random r = new Random();

    private static int playGame() {
        int roll;
        while ((roll = r.nextInt(6) + 1) == 4);
        return (roll == 5 || roll == 6) ? 1 : 0;
    }
}

And I see that one could expand $P(W)$ like this:

$$
P(W) = \frac{1}{3} + \frac{1}{6} \left(\frac{1}{3} + \frac{1}{6}\left(\frac{1}{3} + \frac{1}{6}\right)\right)…
$$

But I don't know how to solve this type of recurrence relation without resorting to this sort of approximation. Is it possible?

Best Answer

Just solve it using algebra:

\begin{aligned} P(W) &= \tfrac 2 6 + \tfrac 1 6 \cdot P(W) \\[7pt] \tfrac 5 6 \cdot P(W) &= \tfrac 2 6 \\[7pt] P(W) &= \tfrac 2 5. \end{aligned}