There's a mistake in question 2. I think the optimal strategy would be to re-roll if first roll <= 3.
You only calculate probabilities but one should look at the expected value. One should only perform a second roll when its expected value is larger than what we currently have by our first roll.
| first roll |
Expected value second roll |
| 1 |
1/8 * (2 + 3 + 4 + 5 + 6 + 7 + 8) = 35/8 |
| 2 |
1/8 * (3 + 4 + 5 + 6 + 7 + 8) = 33/8 |
| 3 |
1/8 * (4 + 5 + 6 + 7 + 8) = 30/8 |
| 4 |
1/8 * (5 + 6 + 7 + 8) = 26/8 |
| 5 |
1/8 * (6 + 7 + 8) = 21/8 |
| 6 |
1/8 * (7 + 8) = 15/8 |
| 7 |
1/8 * (8) = 1 |
| 8 |
0 |
As soon as the first roll = 4, the expected value that we obtain by making a second roll is lower than the value we already have. As such, optimal strategy is to re-roll when first roll <= 3.
Another extra question that could be asked here is how much you would be willing to bet. For this, we can calculate the expected value of this game. For first roll equal to 1, 2 or 3, we take the expected value of the second roll. For the others, we take the expected value of the first roll.
Giving us: E[X] = 1/8 * (35 / 8 + 33 / 8 + 30 / 8 + 4 + 5 + 6 + 7 + 8) = 5.28125
--> We are willing to bet anything lower than this value.
One could calculate this for an alternative strategy as well. E.g. re-rolling when first roll <= 4 gives us:
E[X] = 1/8 * (35 / 8 + 33 / 8 + 30 / 8 + 26/8 + 5 + 6 + 7 + 8) = 5.1875
Simulation in Python (ugly code!)
>>> import numpy as np
>>> reward_3 = []
>>> reward_4 = []
>>> for _ in range(1_000_000):
... r1 = np.random.randint(1, 9)
... if r1 <= 3:
... strat1 = r1 + np.random.randint(1, 9)
... else:
... strat1 = r1
... if r1 <= 4:
... strat2 = r1 + np.random.randint(1, 9)
... else:
... strat2 = r1
... if strat1 > 8:
... strat1 = 0
... if strat2 > 8:
... strat2 = 0
... reward_3.append(strat1)
... reward_4.append(strat2)
...
>>> print(np.mean(reward_3))
5.280888
>>> print(np.mean(reward_4))
5.186363
Notice how the average rewards our expected values very well (law of large numbers)
There's a mistake in question 2. I think the optimal strategy would be to re-roll if first roll <= 3.
You only calculate probabilities but one should look at the expected value. One should only perform a second roll when its expected value is larger than what we currently have by our first roll.
As soon as the first roll = 4, the expected value that we obtain by making a second roll is lower than the value we already have. As such, optimal strategy is to re-roll when first roll <= 3.
Another extra question that could be asked here is how much you would be willing to bet. For this, we can calculate the expected value of this game. For first roll equal to 1, 2 or 3, we take the expected value of the second roll. For the others, we take the expected value of the first roll.
Giving us:
E[X] = 1/8 * (35 / 8 + 33 / 8 + 30 / 8 + 4 + 5 + 6 + 7 + 8) = 5.28125--> We are willing to bet anything lower than this value.
One could calculate this for an alternative strategy as well. E.g. re-rolling when first roll <= 4 gives us:
E[X] = 1/8 * (35 / 8 + 33 / 8 + 30 / 8 + 26/8 + 5 + 6 + 7 + 8) = 5.1875Simulation in Python (ugly code!)
Notice how the average rewards our expected values very well (law of large numbers)