Tossing A Die With A Choice

This week, a guy from Jane Street asked the following question:

  1. Suppose in Game 1, a dealer toss a fair die. The player receive money equal to whatever shows up on the die. (So, if a ‘4’ shows up, you receive $4). But in order to play this game, you must pay an “entry fee” first. What is the maximum amount of “entry fee” should you pay?
  2. Suppose in Game 2, we have the same rule (assume the entry fee is $3.5, which is the answer for a fair Game 1). But after every toss, you can observe the value on the die and have the choice to either:

a)     Receive the amount equal to whatever showed up on the die, which is the same as Game 1.

b)    Have a re-roll and receive whatever the new amount shows up on the die.

The question: is this option to have a re-roll more favourable game to play for the player?

The answer I immediately gave was: yes. This was just a pure reflex, because possessing more information “usually” improve the decision making process. Of course, this should be confirmed using probability, but I am reasonably comfortable with this intuition.

The argument using probability is very simple: If $3.5 is the entry fee, then anything less than $3.5 will be a “loss”. The probability of a “loss” is the sum of probabilities of getting a ‘1’, a ‘2’ and a ‘3’. P(win)=P(loss)=0.5, which is a fair game. Now, if we choose to have a re-roll whenever we encounter a ‘1’ or a ‘2’ or a ‘3’, then intuitively, we should maximise our probability of winning. Hence,

P(win)=P(win at first roll) + P(loss at the first roll)*P(win at second roll)

= 0.5  + 0.5 * 0.5

= 0.75

Which is what we should expect if we run a simulation in Mathematica.

When I started to program in Mathematica, I made several generalisations:

  1. Instead of using the strategy “re-roll if the die shows less than 3.5”, I produced a list, when the “cut-off value for a re-roll ranges from 1 to 6”.
  2. Instead of “entry fee is 3.5”, I used Manipulate function to display the probability of making a profit in the game, if the entry fee ranges from 1 to 6.

I am still unfamiliar with a lot of functions in Mathematica, for instance, I am sure there is a more efficient way of counting than using Length[Select[….]].

nexp = 10000;
 rolls = RandomInteger[{1, 6}, nexp];
 nnoroll = Length[Select[rolls, # > 3.5 &]]
 f[i_, entry_] := (switch = RandomInteger[{1, 6}, nexp];
   Do[
    If[
     switch[[k]] < i,
     switch[[k]] = RandomInteger[{1, 6}];
     ]
    , {k, 1, Length[switch]}
    ];
   Length[Select[switch, # > entry &]]/nexp)

 Manipulate[{ListPlot[Table[f[i, entry], {i, 1, 6}], Filling -> Axis, 
    DataRange -> {1, 6}, PlotRange -> {0, 1}], 
   Table[f[i, entry], {i, 1, 6}] // N}, {entry, 1, 6, 1}]
 TimeUsed[]
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s