Last Updated: July 18, 2014

# Random Number Poker Solution

## Rules

- Two players are each given a random number drawn from a uniform distribution from 0 to 1.
- Player 1 may keep his number or switch it for a new random number.
- Player 2, knowing player 1's decision, may also switch or stick with his original number.
- The higher final number at the end wins.

## Questions

- What is the optimal strategy for each player?
- Assuming both players follow optimal strategy, what the probability of winning for each player?

## Answers

- Player 1 should switch with less than 0.567364, otherwise stand.
- If Player 1 switches, then player 2 should switch with less than 0.5, otherwise stand.
- If Player 1 stands, then player 2 should switch with less than 0.660951, otherwise stand.
- Probability player 1 wins = 0.494333.
- Probability player 2 wins = 0.505667.
- Assuming each player wagers one number, then the expected value of player 1 = -0.011333.

## Solution

It is obvious that if player 1 switches then player 2 should switch with less than 0.5 and stand otherwise.Otherwise, player 1 should stand if his original number is above a certain number. Let's call that number x.

If player 1 stands then player 2 can assume that player 1 has a decent number. The player 2 needs to be aggressive to try to beat it. His strategy should be to switch above a certain number, let's call it y, if player 1 stands.

To solve problems like this you have to solve for these indifference points, x and y. You do this be equalizing the expected value for standing and switching.

For the rest of this solution, I will be calculating the expected value from the perspective of player 1, assuming that both players wager one unit each.

Let's solve for x first.

Expected value by standing = y*(2x-1) - (1-y)

Expected value by hitting = 0.5 * 0 + 0.25 * 0 + 0.25 * -1 = -0.25.

Next, set these expected values equal to each other:

y*(2x-1) - (1-y) = -0.25

2xy - y - 1 + y =-0.25

2xy - 1 = -0.25

2xy = 0.75

xy = 3/8

Next, let's find the expected value if player 2 has y and stands after player 1 stands:

(y-x)/(1-x) + (1-y)/(1-x) * -1 = (x-2y+1) / (x-1)

Next, let's find the expected value if player 2 has y and hits after player 1 stands:

(1 / (1-x)) * [(1-x)^2 * 0 + x * (1-x) * -1] =

(1 / (1-x)) * [x^2 - x] =

x * (x-1) / -(x-1) =

-x

Next, set these expected values equal to each other:

(x-2y+a) / (x-1) = -x

x^2 - 2y + 1 = 0

x^3 - 2xy + x = 0

Next, substitute 3/8 for xy.

x^3 + x - 0.75 = 0

4x^3 + 4x - 3 = 0.

You can use a cubic equation solver at this point to get x = 0.567364.

Knowing xy = 3/8, you can substitute the value above for x to get y = 0.660951.

It is then just going through all the ways the two to four numbers can fall to get the probability of each player winning. This can be done with geometry or calculus. Forgive me if I leave that part to the reader. Here are the answers:

Probability player 1 wins = 0.494333.

Probability player 2 wins = 0.505667.

Assuming each player wagers one number, then the expected value of player 1 = -0.011333.

For those of you who must have an exact expression of the answer:

Let z = (3/8 + (307/1728)^(1/2))^(1/3) ~ 0.926962

Then x = z - 1/(3z) ~ 0.567364

Then y = 3/(8x) ~ 0.660951

Then expected value of player 1 = 3x/8 + y(y-1) ~ -0.011333

Thanks to Joe Shipman for the problem.