Two Envelopes Problem

Tristan Gamilis, 16.03.2010

I happened to remember the 'two envelopes paradox' a while ago, and just like the first time I heard it, it's kept me awake at night. A few sleepless nights later, this is what I've come up with. Maybe I'm right, maybe I'm wrong, maybe I'm just expressing existing knowledge in a different way - your feedback is welcome.

The problem generally goes like this:

Two envelopes, identical in appearance, are presented, each containing a sum of money. All we are told about the sums is that one is twice the other (which of course means that one is half the other). So long as this is true, the amounts in the envelopes can be any real numbers.

We choose an envelope at random and open it to find, for example, 20 dollars. We are then given a choice: we can keep the $20, or take whatever is in the other envelope. Naturally, we want to take as much as possible, so we do our best to figure out the expected value of the unknown envelope. Most people end up with something that looks like this:

EV = 0.5 * (2 * 20) + 0.5 * (0.5 * 20)

Or generically, for any initial initial sum we find (F):

EV = 0.5 * 2F + 0.5 * F/2

This seems pretty straightforward, as there's a 50% chance of doubling our money and a 50% chance of halving it. The peculiarity appears when we solve this equation:

EV = 0.5 * 2F + 0.5 * F/2
EV = F + 0.25 F
EV = 1.25F

A clear profit! For F=20, that makes the EV (herein, EV) of the other envelope $25

If that doesn't immediately strike you as problematic, consider it this way: suppose we don't open the first envelope, but rather consider its amount to be A. We decipher that the other envelope must have 1.25A, and then we call that B. We then calculate the EV of the first envelope relative to B as being 1.25B, according to the same logic, that it must be double or half.

Already we've decided that the first envelope contains 1.25(1.25A), and there seems to be no reason why we can't switch envelopes all day, increasing our winnings by 1.25 each time. That's almost certainly not true, and that's the problem.

A solution:

The difficulty of this problem, similar to the Monty Hall problem, is its deceptive simplicity and counter-intuitive nature. Figuring out theoretically that an EV formula of which equates to 1.25F must be flawed isn't too tough. Figuring out why it is flawed is tricky, and figuring out an accurate formula is trickier still.

Lost in a theoretical cloud, I wrote a Ruby script to simulate the situation hoping to gain some insights. If you're not familiar with programming, just read the commented lines to get an idea of what's going on.

#we'll be keeping track of:
#our initial choices
agg_initial = 0
#ev calcs of 'other'
agg_ev_other = 0
#real val of 'other'
agg_other = 0
#the first envelope
agg_env_a = 0
#and the second envelope
agg_env_b = 0

#we'll run the test 100 million times to reduce variance
numruns = 100000000 

numruns.times do
  #envelope_a gets set to random number from 1 to 100
  envelope_a = 1 + rand(100)

  #assign envelope_b to either double or half of envelope_a, at random 
  if rand(2) == 1
    envelope_b = envelope_a * 2
  else
    envelope_b = envelope_a / 2
  end

  #choose an initial envelope at random
  if rand(2) == 1
    initial_choice = envelope_a
  else
    initial_choice = envelope_b
  end

  #...add our initial choice to the aggregate of initial choices
  agg_initial += initial_choice

  #calculate the ev of the other envelope according to our original formula
  ev_other = 0.5 * (initial_choice/2) + 0.5*(initial_choice*2) 

  #..and add that to the aggregate of our calculated ev's
  agg_ev_other += ev_other

  #take a look at the true value of the envelope we didn't choose 
  #initially, and add it to the aggregate of 'other envelopes'
  if initial_choice == envelope_a
    agg_other += envelope_b
  else
    agg_other += envelope_a
  end

  #..add each envelope to aggregates
  agg_env_a += envelope_a
  agg_env_b += envelope_b

end

puts "Average of initial choice = #{agg_initial/numruns.to_f}"
puts "Average other exp. values = #{agg_ev_other/numruns.to_f}"
puts "Average other real values = #{agg_other/numruns.to_f}"
puts "Average value envelope a  = #{agg_env_a/numruns.to_f}"
puts "Average value envelope b  = #{agg_env_b/numruns.to_f}"
			

100 million simulations later, the results are in... (rounded here to two decimal places)

Average of initial choice   = 56.74
Average other exp. values = 70.84
Average other real values = 56.75
Average value envelope a = 50.50
Average value envelope b = 62.99

The first thing that surprised me was that the average initial choice was about 56.74, when I had expected it to be 50.5 (that is, the average of 1 to 100). However, this makes sense, and leads us to a useful absolute truth:

True double-or-half X propositions have an EV of 1.25X

The average value we should expect to choose initially is the average of envelop_a and envelope_b

envelope_a averages to 50.5 (that is, the average of 1-100)
envelope_b averages to 1.25 * 50.5 (double-or-half envelope_a)

(50.5 + 50.5 * 1.25) / 2 = 56.8125

From here on I am going to refer to envelope_a (the envelope which has a random value assigned to it) as the 'seed', and envelope_b (the envelope that has it's value set to either double or half of the seed at random) as 'seeded'.

Because true double-or-half propositions return an EV of 1.25 times your wager, the seed envelope is less than the seeded envelope.

Seed = A
Seeded = 1.25A

If when playing this game, you could somehow tell which envelope was the seed, you could always opt for the other one for a better EV. For example, if the person putting the money in the envelopes for you to choose was first putting some money in an envelope (out of your sight) and then putting it down on the table in front of you, then flipping a coin (out of your sight) to determine whether they would put double or half the first amount in the other envelope, and putting the second envelope on top of the first, you would do 25% better on average to choose the envelope on top.

If you'd like to test this, simply modify the script to choose envelope_b every time and watch your initial_choice average.

This seems to be perfectly understood by other envelope paradox enthusiasts.

The next thing to note is that our calculated EV for the other envelope is consistently wrong - out by a factor of 1.25:

factor = exp_value / real_value
factor = 70.84 /  56.75 
factor =~ 1.25

One of the most important things we see is that the average value (same as expected value) of the other envelope in reality is the same as the initial choice average (in our simulation, about 56.75). Whatever function we use to calculate the EV of the other envelope should find the EV to be the same as the amount we have just found (F).

EV = F

Which makes sense intuitively. Does anybody really believe that you'll get more money if you change envelopes?

Now we know empirically, as well as theoretically and intuitively, that our EV formulation is flawed.

Let's try to figure out why.

Two tempting, but false inferences

It is true that some real double-or-half of X propositions have an EV of 1.25, but we need to define which propositions are 'true'. In the envelope paradox, we are misusing this double-or-half calculation. Here's how:

1 » The fact that there are only two possible values for the other envelope does not necessarily make it's expected value their average.

Suppose Bob spends a day walking around city streets making the following proposition to strangers:

What is the Stranger's EV when they hand Bob X dollars?
The possible values Bob will give back are 2X and 0.5X; but if Bob give back 0.5X almost every time, their EV is certainly not 1.25X, but 0.5X.

A true double-or-half proposition returns 2X and X/2 with equal probability.

2 » The fact that those two possible values are equiprobable still does not necessarily make it's expected value their average.

Suppose Bob makes a further guarantee to the strangers. Bob will return double their money exactly half the time, and half their money exactly half the time. What is the Stranger's EV if they hand Bob X dollars now?

That depends on whether Bob gives back double or half at random, or if Bob discriminates. If Bob always give back half of the larger amounts (say, amounts larger than $100), and double the smaller amounts (amounts smaller than $100), then Bob may very well turn a profit, and the strangers turn a loss, on average.

A true double-or-half proposition returns 2X and X/2 at random.

What that means for envelopes

So you choose an envelope at random, open it, and find some amount, F.

If we want to calculate the EV of the other envelope, we have to consider, probabilistically, both the possibility the we have initially chosen the seed envelope, and the possibility that we have initially chosen the seeded envelope. Half the time we are playing the role of the stranger, and half the time we are playing the role of Bob.

Both possibilities are equiprobable.

Only considering 1.25F is a plain mistake - it assumes that we have chosen the seed envelope every time.
When you chose the seed envelope initially and find F, EV = 1.25F is true.
When you chose the seeded envelope initially and find F, EV = 1.25F is false.

If we chose the seeded envelope initially, what is the formula to calculate the seed? We can figure that out by isolating S.

S = seed envelope value
D = seeded envelope value
D = 0.5(2S) + 0.5(S/2)
2D = 2S + S/2
4D = 4S + S
4D = 5S
S = 4/5D
S = D/1.25

But what that that relate to in reality? Basically, when we pick the seed envelope, we can probabilistically decipher the EV of the seeded envelope, because it is a double-or-half proposition where each possibility has a probability of 0.5, and the doubling or halving is done at random.

When we pick the seeded envelope, we cannot calculate the seed using this same double-or-half formula. For now, we have to halve seeded_amount if it was the higher possibility, and double it if it was the lower possibility. Whereas a true double-or-half proposition returns a profit of 25%, this type of proposition returns a loss of %20. Does this balance things out?

Keeping in mind that there's an equal chance of getting the seed and seeded envelopes, we'll take the average of both and call it the generic 'other envelope expected value'.
Remember, we want the EV to equal the amount fount (F). If it doesn't, our function is flawed.

EV = 0.5(F * 1.25) + 0.5(F / 1.25)
EV = 0.625 * F + 0.4 * F
EV = 1.025*F

So close! Why didn't this work?

Because F is not always the same. I don't mean it's not always the same in the sense that it is a random number. I mean that the times you happened to choose the seed envelope, F was smaller on average than the average initial choice; and the times you chose the seeded envelope F was larger on average than the average initial choice.

When we find a value in an envelope, we have to treat F not as a seed or a seeded envelope, but as the average of the two!

After all, in our simulation, the average initial_choice was not the same as envelope_a average (seed) or envelope_b average (seeded), but the average of envelope_a average and envelope_b average.

In our calculation, we need to account for this by adjusting from the total average (A, also known as F) to the average seed (S) and seeded (D) values respectively before we calculate the EV of each of those possibilities. Here's how we adjust them:

Let S = 1

#seed (S):
S = A / 1.125 = 1

#average (A):
A = S * 1.125 = 1.125

#seeded (D):
D = A * 1.25 / 1.125 = 1.25

Now lets use the same formula as above, this time adjusting from the average (A) to the seed and seeded values appropriately:

EV = 0.5( (A / 1.125) * 1.25) + 0.5( (A * 1.25 / 1.125) / 1.25)
EV = 0.5( (A * 0.8) * 1.25  ) + 0.5( (A * 1.1) / 1.25)
EV = 0.5 * A  + 0.4 * A
EV = 0.5( A * 1.1 ) + 0.5( A * 0.8 )
EV = A

And that's it!
An EV function, based on the reality of the situation which accurately calculates the expected value of the other envelope. It's a shame we're not turning a profit, but understanding the problem is pretty cool anyway.

Again, this may not be original thought, but at the very least it should help me get some much needed sleep.


Questions or comments welcome: envelope@gamilis.com