# Solving the two envelopes problem

Suppose you are presented with a game. You are given a red and a blue envelope with some money in each. You are allowed to ask an independent party to open both envelopes, and tell you the ratio of blue:red amounts (but not the actual amounts). If you do, the game master replaces the envelopes, and the amounts inside are chosen by him using the same algorithm as before.

You ask the independent observer to check the amounts a million times, and find that half the time the ratio is 2 (blue has twice as much as red), and half the time it's 0.5 (red has twice as much as blue). At this point, the game master discloses that in fact, the way he chooses the amounts mathematically guarantees that these probabilities hold.

Which envelope should you pick to maximize your expected wealth?

It may seem surprising, but with this set-up, the game master can choose to make either red or blue have a higher expected amount of money in it, or make the two the same. Asking the independent party as described above will not help you establish which is which. This is the surprising part and is, in my opinion, the crux of the two envelopes problem.

This is not quite how the two envelopes problem is usually presented, but this is the presentation I arrived at after contemplating the original puzzle. The original puzzle prescribes a specific strategy that the game master follows, makes the envelopes indistinguishable, and provides a paradoxical argument which is obviously false, but it's not so obvious where it goes wrong.

Note that for simplicity, let's assume that money is a real quantity and can be subdivided indefinitely. This avoids the problem of odd amounts like $1.03 not being exactly divisible by two.

### The flawed argument

The flawed argument goes as follows. Let's call the amount in the blue envelope B, and in red R. You have confirmed that half the time, B is equal to 2R, and half the time it's R/2. This is a fact. Surely then the expected value of B is (2R * 50% + R/2 * 50%), which simplifies to 1.25R. In other words, the blue envelope has a higher expected amount of money given the evidence we have.

But notice that the situation is completely symmetric. From the information you have, it's also obvious that half the time, R is 2B, and half the time it's B/2. So by the same argument the expected value of R is 1.25B. Uh-oh. The expected value of both envelopes is higher than the other?...

### Game master strategies

Let's muddy up the water a little by considering the strategies the game master can use to pick the amounts for each envelope.

##### Strategy 1

Pick an amount X between $1 and $1000 randomly. Throw a fair die. If you get an odd number, put X into the red envelope and 2X into blue. Otherwise put X into blue and 2X into red.

##### Strategy 2

Pick an amount X between $1 and $1000 randomly. Put this into the red envelope. Throw a fair die. If you get an odd number, put 2X into blue, and if it's even, put X/2 into blue.

The difference between these strategies is fairly subtle. I hope it's sufficiently obvious that the *"ratio condition"* (B = 2R half the time and R = 2B the other half) is true for both strategies. However, suppose we have two people take part in this game, one always picking the red envelope and the other always picking the blue envelope. After a million repetitions of this game, with the first strategy, the two guys will have won almost exactly the same amounts in total. After a million repetitions with the second strategy, the total amount won by the blue guy will be *25% higher* than the total amount won by the red guy!

Now observe that strategy 2 can be trivially inverted to favour the red envelope instead of the blue one. The player can ask an independent observer for ratios (as described in the introduction) all he wants, but this information will not allow him to distinguish between these three scenarios (strategy 1, strategy 2 and strategy 2 inverted). It's obviously impossible to figure out which envelope has a higher expected winnings from this information!

### What's going on here?

I hope I've convinced you by now that the information about the likelihood of the ratios does not tell you which envelope is better. But what *exactly* is the flaw in the original argument?

Let's formalize the puzzle a bit. We have two random variables, R and B. We are permitted to ask someone to sample each one and compute the ratio of the samples, r/b, and disclose it to us. Let's define a random variable called RB whose samples are produced by sampling R and B and computing their ratio. We know that RB can take two values, 2 and 0.5, with equal probability. Let's also define BR, which is the opposite ratio: that of a sample of B to a sample of R. BR can also take two values, 2 and 0.5, with equal probability.

The flawed argument is simply that the expected value of RB, E(RB), is 1.25, which is greater than 1, and therefore E(R) > E(B). The flawed argument continues that E(BR) is 1.25 too, therefore E(B) > E(R), leading to a contradiction. What's the flaw?

### Solution

The expected value of RB, E(RB), really is 1.25. The puzzle gets that one right. E(BR) is *also* 1.25. The flaw in the argument is simply that it assumes E(X/Y) > 1 implies that E(X) > E(Y). This implication seems to hold intuitively, but human intuition is notoriously bad at probabilities. It is easy to prove that this implication is false, by considering a simple counter-example courtesy of

So there you have it. The proposed argument relies on an implication which seems true intuitively, but turns out to be false under scrutiny. Mystery solved?... Almost.

##### Imprecise language's contribution to the puzzle

The argument concerning the original, indistinguishable envelopes, is phrased like this: *"(1) I denote by A the amount in my selected envelope. (2) The other envelope may contain either 2A or A/2, with a 50% probability each. (3) So the expected value of the money in the other envelope is 1.25A. (4) Hence, the other envelope is expected to have more dollars."*

Depending on how pedantic you are, you might say that the statement made in the third sentence is strictly false, or that it is too ambiguous to be strictly false, or that at least one interpretation is true. The expected value 1.25A is *"of the amount of money contained in the other envelope expressed in terms of the amount of money in this envelope"*. It is *not* *"of the amount of money in the other envelope expressed in dollars"*. Hence the last sentence does not follow, and if the statements were made in full and with complete accuracy, the fact that it does not follow is a little bit more obvious.

In closing, I would say this puzzle is hard because "in terms of this envelope" and "in terms of dollars" are typically equivalent enough in everyday life, but when it comes to expected values, this equivalence breaks down rather counter-intuitively.

## Comments (33)

Best*15 points [-]This does not follow; a counterexample:

Suppose X and Y are independent random variables, with X taking the values {2,100}, and Y the values {1,150}, each with equal probability (i.e., each of X and Y follows the Bernoulli distribution with p = 0.5). Then we have

E(X/Y) = (2/1 + 100/1 + 2/150 + 100/150) / 4 = 25.67 > 1,

but

E(X) = 51 < 75.5 = E(Y).

Keep in mind that the equation E(1/Y) = 1/E(Y) does

nothold in general, because taking the inverse is not a linear transformation. To evaluate the expectation after a nonlinear transformation, one requires not just the orignal expectation, but also the pdf of the distribution. (I can't be sure this is what you did, but misapplying this gives: E(X/Y) = E(X)E(1/Y) = E(X)/E(Y). The first equality holds if X and Y are independent or by definition if X and 1/Y are uncorrelated, but the second equality does not hold in general.)*3 points [-]Thanks, good point. Hopefully I don't turn out to be falsely complacent about

thisconclusion too :)Addressed by making a few edits to the "Solution" section. Thank you!

An even easier example: X is always -4 and Y is always -2.

Since amounts of money are positive, this is a counterexample to a mistake not in the original article.

Thanks, this is indeed a simpler counterexample. Note that it is a counterexample to a different error in the original statement. In particular, the error you've caught here is that from

X/Y > 1,

one cannot conclude that

X > Y.

*6 points [-]Generally, people do take

`R`

and`B`

to be fixed amounts of money - then, it's worth pointing out that the expected value of the blue envelope is not`.5*.5R+.5*2R`

, because`R`

there stands for 2 different amounts of money.If the amounts of money are

`$5`

and`$10`

, then`R`

in the first case stood for`$10`

and`R`

in the second case stood for`$5`

, so it should really be`.5*.5($10)+.5*2($5)`

, and the expected value is just`$7.50`

.*0 points [-]Yes, I like your simplification.

To amplify it and make the results explicit, Suppose my envelope strategy is to flip a fair coin and

heads: R=$5 B=$10

tails: R=$10 B=$5.

Then

E(R) = E(B) = $7.50

E(B)/E(R) = E(B)/E(R) =1

E(R/B) = E(B/R) = 1.25

*7 points [-]Another commentary I once read regarding the "two envelopes paradox":

In order to make any sense out of this problem, you have to assume

someprior probability distribution over the amount of money in the two envelopes. For many of these possible distributions, once you open one of the envelopes and learn how much money is inside, you now know more about whether the other envelope has more or less money than the one you opened. For example, if you assume that neither envelope has more than $1,000 and then open an envelope with $800, the other envelope has to have $400, so, contrary to the line of reasoning in the "paradox", switching would be bad.On the other hand, perhaps you only want to think about distributions for which it seems the paradox still holds: ones in which that, regardless of how much money you find in envelope A, envelope B still has an equal chance of being twice as much or half as much. Well, it turns out that you can prove that this criterion also implies that the expected value of the amount of money in envelope A is

infinity. This makes the paradox seem much less paradoxical: first, when your expected value is infinity, any specific finite result is disappointing (which is why switching is always correct), and second, any finite number multiplied by infinity is still infinity (which explains how each envelope can have an expected value of 1.25 times the other).(Apparently, my original source was David Chalmers, of all people.)

I don't see your conclusion holding. I am inclined to say: Therefore there are no distributions which that, regardless of how much money you find in envelope A, envelope B still has an equal chance of being twice as much or half as much.

I suppose "numbers selected from all the numbers in the series 2^n" and so forth are ruled out of being distributions based on the "infinities and uncomputable things are just silly" principle? (I am fairly confident that) something on that order of difficulty is going to required to provide the envelopes. A task that is beyond even Omega in the universe as we know it but perhaps not beyond an intelligent agent in the possible universes that represent computational abstractions natively.

Actually there are no uniform distribution in this set (an infinite enumerable set). You may select numbers from this set, but some of them will have higher probability than others.

That is what I was getting at with 'ruled out of being distributions'.

Oh... I misunderstood you then.

Moreover, this means that if we want to do this with utility rather than money, you'd need an unbounded utility function, which can't happen if you're obeying Savage's axioms.

Nice.

*2 points [-]There is another very cool puzzle that can be considered a followup which is:

There are two envelopes in which I, the host of the game, put two different natural numbers, chosen by any distribution I like, that you don't have access. The two envelopes are indistinguishable. You pick one of them (and since they are indistinguishable, this can be considered a fair coin flip). After that you open the envelope and see the number. You have a chance to switch your number for the hidden number. Then, this number is revealed and if you choose the greater you win, let's say a dollar, otherwise you pay a dollar.

Now, before everything I said happens, you must devise a strategy that guarantees that you have a greater than 1/2 chance of winning.

Some notes:

1- the problem may be extended for rational, or any set of constructive numbers. But if you want to think only in probabilities this is irrelevant, just an over formalism.

2- This may seem uncorrelated to the two envelopes puzzle at first, but it isn't.

3- I saw this problem first on EDITthis post on xkcd blag. Thanks for Vaniver for pointing out.

I believe you're thinking of this blag post.

Yes, that's it! Thanks.

Isn't there an additional requirement that there is a minimum element in the set?

No, you can think on the rationals, for example.

Well natural numbers and simple greater than satisfying makes it easy. "If one THEN swap ELSE keep."

Maybe I didn't express myself well, but this strategy should work regardless of the distribution I choose. For example, if I choose a distribution in which 1 has probability 0, than your strategy yield 1/2 chance.

If that kind of selection of distributions is possible then there is no free lunch to be found.

For any strategy of envelope switching a hostile distribution selector who knows your strategy in advance can trivially select distributions to thwart it.

*1 point [-]Have you looked at the "solution"? There really isn't a counter-strategy that reduces it to 1/2 chance, although there are strategies moving it arbitrarily close to 1/2.

*2 points [-]Even simpler counter example: X and Y take values 1 and 100, independently and with equal probability. Then E(X/Y) = 1/4 ( 1/1 + 1/100 + 100/100 + 100/1), which is basically 25.5. Ditto for E(Y/X).

Expectation is a mean, and in means, large terms dominate - for E(X/Y), the (X=100,Y=1) situation dominates, while for E(Y/X), the (X=1,Y=100) situation dominates.

In fact, if X and Y are independent, identically distributed, strictly positive and non-trivial (ie not just constants), then I think that we always have E(X/Y) > 1.

*4 points [-]Such people have probably not heard of the two envelopes problem and thus the title is not informative for them.* It seems to me that it would be useful to put something in the title to indicate that this post is about probabilities and maybe that it is fairly introductory. I could be wrong about how people read this site. Maybe everyone clicks through to the article and reads as far as the italicized section, but it seems low cost to give it a more informative title.

* Also, I doubt that people who do associate "two envelopes" with probability are not very likely to think of this particular problem, for what it's worth.

Added: "this site" = discussion. If the plan is to move this to main, the structure makes more sense. But I still think the title could be better.

*1 point [-]All fair points. I did want to post this to main, but decided against it in the end. Didn't know I could move it to main afterwards. Will work on the title, after I've fixed the error pointed out by VincentYu.

One of the envelopes contains 2 glort's worth of dollars, and the other envelope contains 4 glorts' worth of dollars. I don't know the exchange ratio of glorts to dollars, except that it is positive.

Now it is clear that the expected value is 3 glorts' worth of dollars, regardless of the envelope picked. It's still possible that the game master is using some variant of "if the value of the glort is low for the duration of this trial, put the larger amount of money in envelope B; if the value of the glort is high, put the larger amount of money in envelope a" that favors one envelope over the other.

*1 point [-]I think you reached the wrong conclusion in your final paragraphs. Can you show how the expected value calculation could be different for "

the amount of money contained in the other envelope expressed in terms of the amount of money in this envelope [which is in dollars, BTW]" versus "the amount of money in the other envelope expressed in dollars"?I see that Wikipedia says that there is no generally accepted solution to the paradox. That almost certainly means people are interpreting it differently. I'll give my opinion. But let me recast the problem in more pointed terms.

Mr Moneybags writes a check for some real positive amount of money and puts it in an envelope. Then he writes a check for double the amount of the previous check and puts it in another envelope. He shuffles the envelopes. You pick one and open it, and you find $N. He offers to let you switch to the other just this once. Should you?On first glance it appears that the other envelope could have $N/2 or $N*2, and that you are entirely ignorant about which is the case, so your ignorance priors are 1/2 for each possibility. Then the expected value calculation comes up all wrong! Call the hypothesis that you opened the lower value envelope L and the hypothesis that you opened the higher value envelope H.

But that's nonsense. My opinion as to what went wrong was that it's false that you are entirely ignorant

after opening the envelope, because you can now do an update on your ignorance prior.We'll start, of course, with Bayes' formula P(H|N)/P(L|N) = P(N|H)/P(N|L) * P(H)/P(L) * P(N)/P(N). The last ratio cancels. The second-to-last ratio also cancels because the shuffling of the envelopes made it equally likely you'd open either one. We know basically nothing about the distribution that the lower value was first drawn from, so a convenient ignorance prior on it is that it was some uniform distribution over the interval $A to $B. Consequently, the higher value would be described by a uniform distribution over the interval 2*$A to 2*$B. The distributions may or may not overlap. I'll take each case separately.

Common start: A=0.

Separate start: A>0 and 2A<B.

No overlap: B<2A.

So viewing your prize, you suddenly feel it's twice as likely that you got the higher amount. Bizarre, huh? And your expected value calculation becomes

so there's no point switching after all. Even weirder is that, before you open the envelope, this is a situation where you know for sure what you will believe in the future, but you nevertheless can't make that update till then.

*1 point [-]This is a really good exposition of the two envelopes problem. I recall reading a lot about that when I first heard it, and didn't feel that anything I read satisfactorily resolved it, which this does. I particularly liked the more precise recasting of the problem at the beginning.

(It sounds like some credit is also due to VincentYu.)

I didnâ€™t understand this sentence very well at first, because the inequality on the right is two steps removed from the one on the left. I find this version clearer:

*0 points [-]Here's a solution to a more general version of the problem:

Let's say that the red envelope contains

Ntimes as much money as the blue envelope with probabilityp, and the blue envelope containsNtimes as much money as the red envelope with probability (1 -p).Without loss of generality,

Nis at least 1.If

N= 1, both envelopes contain the same amount, and there is no point in switching.If

N> 1, let the variablesrepresent the smaller amount of money between the amounts of the two envelopes. So one envelope containss, and the other envelope containsNs.Scenario 1: The blue envelope contains

s, and the red envelope containsNs. This scenario occurs with probabilityp.Scenario 2: The red envelope contains

s, and the blue envelope containsNs. This scenario occurs with probability (1 -p).Assume

sis not less than 0.The expected amount of money in the blue envelope, E(B) =

sp+Ns(1 -p) =s(p+N-Np).The expected amount of money in the red envelope, E(R) =

s(1 -p) +Nsp=s(1 -p+Np).If

s= 0, both envelopes contain the same amount, and there is no point in switching.If

s> 0, compare the expectations of the amounts of money in the envelopes in terms ofs:E(B) > E(R) when

s(p+N-Np) >s(1 -p+Np)p+N-Np> 1 -p+Np2

p- 2Np> 1 -N2

p(1 -N) > 1 -N2

p< 1, because (1 -N) < 0p< 1/2Similarly, E(B) < E(R) when

p> 1/2, and E(B) = E(R) whenp= 1/2.The ratios of the expected amounts of money in each envelope depend only on

pwhens> 0 andN> 1.Both envelopes contain the same amount of money when

s= 0,N= 1, or both.So if your degree of belief that the red envelope contains more money than the blue envelope is the same as your degree of belief that the blue envelope contains more money than the red envelope, don't bother switching, unless you need to kill time (which you already knew intuitively, but

Q.E.D.)I got the idea of using the variable

sto represent the smaller of the amounts in the two envelopes from R Falk 2008: "The Unrelenting Exchange Paradox".