This question was posed during an interview for a AI / data science position for a global financial firm:

Consider a game of chance in which a player can roll up to 3 times a dice. They win an amount of money proportional to the outcome of the last dice roll (1, 2, 3, 4, 5, or 6 £). They don’t need to do all the 3 throws and can stop before and collect their win if they want. You are the house in this game, what is the minimum amount of £ that you can charge for playing this game such that you won’t take losses in the long term.

## **Shorter answer by Oliver Perkins.**

Oliver Perkins pointed out that this can be calculated working backwards from the last throw:

£4.65?

— Oli Perkins 🔥🌍🏳️ 🌈 (@OliPerkins2) September 27, 2020

As the punter on roml 3, E(£) = 3.5, so we stick on 4+ on throw 2. Knowing this our EV for the final 2 throws is is (0.53.5)+(0.55)=4.25. Therefore we stick on 5+ on the first throw so E(£) = (0.6674.25)+(0.3335.5) = ~4.64

His solution makes perfect sense and differs from my initial one in that the player would accept a 4 at throw 2 (although now I have updated my answer to take that into account). This small difference in the strategy it’s rational since it increases the overall expected value of the game by \(\approx\) 0.05 from a strategy in which the player do not settle for anything less than 5 at any throw.

## **Click to see another approach.**

Let’s define with \(\mathcal{C}\) the price that the player pay to play the game, and with \(\mathcal{W}\) the amount they win. A possible strategy could be to keep playing until their winning are *at least* equal to the price, i.e. until \(\mathcal{W} \ge \mathcal{C}\) (and may also continue after that if continuing increases their expected win).

Assume the player continue until they get a 6 (). Let’s define \(D_1, D_2, D_3\) indicate the outcomes of throws 1, 2, and 3, respectively. The probability of getting a 6 is

\[ p\left(\mathcal{W} =6\right) = \frac{1}{6} + \underbrace{\left( 1 - \frac{1}{6} \right) \times \frac{1}{6}}_{p \left(D_2=6 \mid D_1<6\right)} + \underbrace{\left( 1 - \frac{1}{6} \right)^2 \times \frac{1}{6}}_{p \left(D_3=6 \mid D_1<6 \cup D_2<6\right)} = \frac{91}{216} \approx 0.42 \]

If instead the player aims for at least \(5\), the probability of getting it is

\[ p\left(\mathcal{W} \ge 5 \right) = \frac{2}{6} + \underbrace{\left( 1 - \frac{2}{6} \right) \times \frac{2}{6}}_{p \left(D_2 \ge5 \mid D_1<5\right)} + \underbrace{\left( 1 - \frac{2}{6} \right)^2 \times \frac{2}{6}}_{p \left(D_3 \ge 5 \mid D_1<5 \cup D_2<5\right)} = \frac{19}{27} \approx 0.70 \]

Say the player obtain 5 at the first throw. Is it worth to continue?

The probability of getting at least \(5\) in the next two throws is \(\frac{2}{6} + \left(1 - \frac{2}{6} \right)\times \frac{2}{6} = \frac{20}{36} \approx 0.55\)

The probability of getting a \(6\) in the next two throws is \(\frac{1}{6} + \left(1 - \frac{1}{6} \right)\times \frac{1}{6} = \frac{11}{36} \approx 0.30\)

If the player reach the last throw without obtaining at least \(5\) the remaining outcomes, \(1\) to \(4\), are equally likely with probability \(\frac{1}{4}\). Thus continuing after obtaining \(5\) at the first throw has an expected value of \[\frac{11}{36}\times6 + \left(\frac{20}{36} - \frac{11}{36}\right)\times 5 + \left(1 - \frac{20}{36}\right)\times \sum_{i=1}^4 \frac{1}{4}i \approx 4.19\]

The value of stopping after having obtained \(5\) is \(5\), thus the player should stop and not continue.

## Expected value of the game

If \(\mathcal{C}=5\) we have that \(p\left(\mathcal{W} > 5 \right) = \frac{91}{216} \approx 0.42\), and also that \(p\left(\mathcal{W} > 4 \right) = \frac{19}{27} \approx 0.70\). Thus in the long run the player will win more than they paid about \(42\)% of the times, they will be even with the house \(28\)% of the times, and they will loose money (obtaining any number from \(1\) to \(4\), with equal probability) about \(30\)% of the times.

To see if this is a good deal we calculate the expected value assuming the player continue until they either obtain a \(5\) or complete 3 throws. The probability of getting at least 5 in three throws is \(\frac{19}{27}\), and conditional of getting at least 5 the two outcomes of 6 and 5 have both the same probability \(\frac{1}{2}\). We have that for a price of \(5\) the player that follow this strategy is expected to incur a loss in the long run since the expected value is:

\[\underbrace{\frac{19}{27}\frac{1}{2}\times6 + \frac{19}{27}\frac{1}{2}\times5 + \left(1 - \frac{19}{27}\right) \frac{1}{4}\times \sum_{i=1}^4 i}_{\text{expected value if player keep playing until } \mathcal{W} \ge 5} = \frac{83}{18} \approx 4.61\]

Now, say the player obtain 4 at the second throw, should they keep it? Yes, since the expected value of the last throw is \(\frac{1}{6}\sum_{i=1}^6 i=3.5\). To take this into account we need a slightly different calculation in which the outcomes are considered separately for each throw (the underbraces indicate the acceptable score in each throw):

\[ \underbrace{\frac{2}{6}\frac{1}{2}\times \left(5+6\right)}_{\text{5 or 6 in 1st throw}} + \underbrace{\left(1-\frac{2}{6}\right)\frac{3}{6}\frac{1}{3}\times \left(4+5+6\right)}_{\text{4, 5 or 6 in 2nd throw}} + \underbrace{\left(1-\frac{2}{6}\right)\frac{3}{6} \frac{1}{6}\times \sum_{i=1}^6 i}_{\text{any number in last throw}} = \frac{14}{3} \approx 4.67 \]

Thus, the house needs to set a price \(\mathcal{C}\) that is at least \(\frac{14}{3}\approx 4.67\) otherwise they risk incurring losses.