The two envelopes problem solved

Share this page

The two envelopes problem solved


The two envelope problem is a famous paradox from probability theory (which we first presented on Plus back in September). Imagine you are given two envelopes, one of which contains twice as much money as the other. You're allowed to pick one envelope and keep the money inside. But just before you open your chosen envelope you are given the chance to change your mind. Should you stick with the envelope you picked first or switch?

To find out write $x$ for the amount that's in your chosen envelope. This means that the amount of money in the other envelope is either $2x$ or $x/2$. The probability that it's $2x$ is $1/2$ and so is the probability that it's $x/2$. So the expected amount you'll get for switching is

$$\frac{1}{2}\left(2x+\frac{x}{2}\right) =x+\frac{x}{4} = \frac{5x}{4}.$$ Since that's bigger than $x$, you should swap envelopes. But what if you are given another chance to swap envelopes after you have changed your mind once? By the same reasoning as above you should swap back again. And then, by the same argument again, you should swap a third time, and so on, forever. You end up in an infinite loop of swapping and never get any money at all. What's wrong with this reasoning?

A resolution

Let's write $A$ for the envelope you picked at first and $B$ for the other one. We write $x$ for the amount of money in $A$. Now since we haven't opened envelope $A$, $x$ isn't a fixed amount: it's a random variable. It can take one of two values: the smaller amount of money that's hidden in the two envelopes or the larger amount of money. Let's write $y$ for the smaller amount and $2y$ for the larger amount (recall that one envelope contains twice as much money as the other). Since you have picked $A$ randomly, there's a 50:50 chance that $A$ contains either of the two amounts. This means that the expected amount of money $E(A)$ in envelope $A$ is $$E(A) = \frac{1}{2}\left(y+2y\right) =\frac{3y}{2}.$$ We said above that the expected amount in envelope $B$ is \begin{equation}E(B) = \frac{1}{2}\left(2x+\frac{x}{2}\right).\end{equation} But recall that $x$ isn't a fixed amount but can take one of two values. In the case that envelope $B$ contains $2x$, envelope $A$ contains the smaller amount of money, so $x=y.$ In the case that envelope $B$ contains $x/2$, envelope $A$ contains the larger amount of money, so $x=2y.$ So in formula (1) above, the first $x$ really stands for $y$ and the second $x$ stands for $2y$. The two $xs$ in the formula are actually different and shouldn't have been added up to give $5x/4.$ Substituting the $y$ for the first appearance of $x$ in (1) and $2y$ for the second gives $$E(B) = \frac{1}{2}\left(2y+y\right)=\frac{3y}{2}.$$ Thus $E(A) = E(B)$ so there is no incentive to switch envelopes and hence no paradox.

What if you open envelope A?

What if we had already opened envelope $A$, to find $\pounds x$ inside, before being offered the chance to switch? Can we still produce the apparent paradox? If you have opened envelope $A$ then $x$ is a fixed amount of money. There's a 50:50 chance of finding $2x$ or $x/2$ in envelope $B$, so the expected amount in envelope $B$ is $$E(B) = \frac{1}{2}\left(2x+\frac{x}{2}\right) =x+\frac{x}{4} = \frac{5x}{4}.$$
Martin Hairer

We heard about the two envelopes problem in a talk by the Fields medallist Martin Hairer at the Heidelberg Laureate Forum 2017. Foto: Bernhard Kreutzer for HLF (c) Pressefoto Kreutzer.

The formula is now correct. It tells you that on average (if you repeated the same wager many times with the same amount $x$ in envelope $A$), you'd do better by switching. The paradox doesn't arise. If after switching to envelope $B$ you are given the chance to switch back again, you won't because you already know that the amount in $A$ is less than the expected amount in $B$. The paradox arose in the original version because both envelopes could be treated the same — the situation was symmetric. Once you have opened envelope $A$, however, the symmetry is broken. Notice, however, that opening envelope $A$ and seeing the amount $x$ may change your mind about the probability that envelope $B$ contains $2x$ or $x/2.$ For example, if $x$ is a very large amount, then you might think it very unlikely that envelope $B$ contains the even larger amount $2x$. Writing $p$ for the probability that envelope $A$ contains the larger amount, the expectation $E(B)$ becomes $$E(B) = 2x(1-p)+\frac{px}{2}.$$ This is greater than $x$ if and only if $pTo us the above resolution of the supposed paradox appears satisfactory, but not everyone would agree. People have spent a lot of time thinking and writing about the two envelopes problem. Its Wikipedia page is a good start if you'd like to find out more.
Read more about...



This problem causes us to confuse prior (before information is learned) and posterior (after information is learned) probabilities. The prior probability that A has the lower amount is 1/2. The same posterior probability is:
Pr(A=x & B=2x)/[Pr(A=x & B=2x) + Pr(A=x & B=x/2)].

The posterior probability that A has the higher amount is:
Pr(A=x & B=x/2)/[Pr(A=x & B=2x) + Pr(A=x & B=x/2)].

These are the expressions you must use in the expectation under "What if you open envelope A?". In general, they can't both be 1/2 - your benefactor would have to possess an infinite supply of money.

I'm inclined to agree and suggest going a bit deeper. The confusion between prior and posterior probabilities results from the fact that no decision is in fact made, however much we think we're seeing into what would happen were it made, so no new information is in fact ever learned. And that decision was never made because it was revoked before being implemented and nothing changes, including information. If a decision does change anything, then it can't be revoked or switched, at least not without cancelling the resulting information changes too.

In this crucial respect the two envelopes problem differs from Monty Hall (which some people compare it to), since in the latter the first decision does result in new information which the player can then use for their next. But switching doors doesn't mean they're revoking their first decision. They can't.

(When I finally hit the SAVE button, I can't change anything either. Oh well, here goes)

... but what it changes is unknown. This is why the issue is indeed the distribution.

An example might help. Say your monk (from the link) put a $10 bill in one envelope. He then put nine $5 bills and one $20 bill into a bucket. With his eyes closed, he picked one bill from the bucket and put it in the second envelope.

The statement "one envelope contains either half, or twice, what is the in other" is still a true statement. The chances that you pick the higher, or lower, envelope are indeed both 50%. But if you open your envelope and see $10, the chances are 90% that you have the larger envelope, not 50%.

The formula Exp(other) = (X/2)*Prob(higher) + (2X)*Prob(lower) is correct. What is wrong in the calculation is assuming Prob(higher) = Prob(lower) = 1/2 when you claim your envelope contains X. They are actually the relative probabilities that the pair of envelopes contained (X/2,X) and (X,2X), which you have no way of knowing.


Note that the ONLY assertion being made in the original problem formulation is that the two envelopes contain x and x/2 with EQUAL probability. But because an absurdity follows from this - namely that it is profitable to continually keep switching envelopes - the assertion itself must therefore be false.

Indeed, there is no distribution in which the probabilities are both 1/2. Such a distribution does not exist so the probabilities are never 1/2. So the paradox does not arise at all.

If you change the game slightly to the following: You receive X amount of money and you can flip a coin. If you flip Tails they have to pay you 2X, if you flip Heads they have to pay you X/2, obviously you always should flip because in that game, the probabilities are 1/2.


If you ask a child to choose a random number from 1 to a million, and he says something like 5, then it's likely he really didn't really randomize his choice.

If you are asked to choose a random positive number (with no other restrictions) then:
P(The number is less than 10) = 0.
P(The number is less than 100) = 0.

P(The number is less than any arbitrarily chosen number, N) = 0.

It is thus impossible to choose a random number with no constraints.

More technically:
P(A | B) where:
A: The number you have chosen is truly random
B: The number you have chosen is less than any arbitrary number, N

is given by:

P(A|B) = P(A Intersect B) / P(B)
The numerator is 0. The denominator is not.

Thus the problem is poorly formed.

If you restrict the maximum amount of money so some value, then the problem is trivial and whether or not you should switch (assuming you examine the contents of the chosen envelope before deciding whether or not to switch) is an easy calculation.

(I think)


The reasoning is flawed for the scenario: 'What if you open envelope A?'

Per Marianne
"It tells you that on average (if you repeated the same wager many times with the same amount $x$ in envelope $A$), you’d do better by switching."

If you open envelope A no new relevant information is gained (assuming no practical limitations of likely $ ranges). Suppose person Y opens A and person Z opens B. Would they not conclude using Marianne's logic that each is better off switching? There is no advantage to switching regardless of the amount revealed in the envelope (again assuming normal $ range estimates arising from practical considerations are excluded).

True, if you had a chance at a 50/50 wager of either losing 0.5x or winning 1.0x, then it would be to your benefit to take the wager. But in the example you open envelope A, you still don't know if the fair value of the game. The fair value of the game is 1.5x (where x is the smaller amount). After opening you don't know if you have the smaller or larger amount by definition. Choosing to play the game you in essence wager 0.5x against the 1.5x fair value. Half the time you lose and are left with 1x, half the time you win and have 2x. Switching after opening is no different.


By all means calculate the expected amount in envelope B as 5x/4 if you like. But since you're switching, you're giving up the amount in envelope A, which is x. So the expected gain on the switch must be 5x/4 - x = x/4

But what if it's A that contains 2x or x/2 and you switch it for B containing x? Then the expected gain is the result of reversing the subtraction in the above EV equation, namely x - 5x/4 = -x/4. Symmetry.

If you can't know which envelope is which, then you can't know either the advantage or disadvantage, the gain or loss, to switching. The expected gains, positive and negative, cancel. Symmetry.

If you know that A contains x, then sure, you switch. If you know A contains x/2 or 2x, then sure, you don't switch. Symmetry.


It makes no difference whether the first envelope is opened, as there is no warrant within the game to assume that any amount is "reasonably" likely to be present. We do not know the universe from which the pairs of envelopes are drawn, so we can make no assumption about it. The "default" assumption about equal likelihood is simply us putting frog DNA where the dinosaur DNA is missing. That is not allowed. We have insufficient information on which to do any math at all.


I'm discussing this problem with a friend. We are discussing the first problem where the envelope is not opened, and we have the question as to whether the problem is well formed or not. Specifically the idea arose that it might not be well formed because the sample space does not contain explicit amounts.

I hope someone can reply to this with their views. I have another question but it depends on what I learn from the comments in the reply as maybe my question will be answered there.
Thanks for your consideration,


After coming across the problem, I think the solution (and many others on the internet) solve slightly different problems that revolve around information.

One problem I have read is that after picking an envelope you get informed that the other envelope contains either half or double of this envelope. Here you don't know the amount of money in the envelopes. Another problem states, like the one above, that one envelope has a fixed amount, say 10, while the other envelope has double, so 20. I will argue that the solution depends on the information known.

To the onlooker, who knows what's in the envelopes, there is only X for one envelope and 2X for the other. There is no X/2 like in the 2nd paragraph above. He knows the amount is either 10 or 20, but it's never 5 or 40. So the pick becomes relevant. If you pick the 10, by necessity the other envelope holds 20, if you pick the 20, the other envelope by necessity holds 10.

This can be the same for the player if he knows the amounts are fixed. In case A where he picks 10, p=1 that the other envelope holds 20. In case B p=1 that the other envelope holds 10. If we assume no bias from the person asking, both cases are just as likely, getting an EV of 0,5x1x10 + 0,5x1x20 = +15.

The problem changes when the information about the fixed amounts in the envelopes isn't there. This is the problem where, after we pick an envelope, we get told that the other envelope holds either half or double the amount. This is a different problem to my eyes, because I don't have the same information.

Now there are 4 cases:
A. I pick 10, the other envelope is half
B. I pick 10, the other envelope is 20
C. I pick 20, the other envelope is half
D. I pick 20, the other envelope is double.

Now EV for switching will be:
0,25 x 5 + 0,25 x 20 + 0,25 x 10 + 0,25 x 40. I gain EV by switching because of the difference between 0,25 x 5 and 0,25 x 40.

I think the difference in the problems can be explained by the fact that choosing an envelope is actually relevant in the 1st problem. After I choose 1, the other envelope is locked. It's in fact never both double or half, it's always double or always half, but I just don't know which of the cases apply. In the 2nd problem the other envelope isn't fixed as half of the time it is half and half of the time it is double.

To elaborate a little further: the 2 problems can be likened to 2 different games. One in which the envelopes hold no clue whatsoever and are shuffled in such a way that nobody knows what's in either envelope and one in which the envelopes are clearly marked and a quizmaster tells us that he knows that the other envelope holds half or double of the envelope we picked.

In the first problem, the EV is actually not 0,5 (2x + (x/2)), because the x's aren't the same. The right way to describe the relation is 0,5 x 2x + 0,5 x (y/2), where y = 2x and x = the amount in the envelope that holds half. After all, it's only half if my envelope holds 2x, and only ever double if my envelope holds x.

In the other problem with marked envelopes and the person asking us to swap knows that the other envelope is either half or double of what is in this envelope, we do get to EV: 5x/4. This time the information is relevant to the envelope we hold.

If we asume no bias because of deception, the solution should be to always swap. When we're playing game 1 it doesn't matter what we do, but in game 2 swapping is +EV. That means we should always swap even when we don't know which of the two games we're playing. Our EV will be p x (5x/4) where p is the chance that we're playing game 2.


In the article above there is a serious error I think. Suppose we open an envelope and find $10 inside. According to the section "What if you open envelope A?" once you've opened an envelope, you should always switch. Furthermore it is argued that this decision would be empirically justified by the results we would find when carrying out the experiment repeatedly. This defies common sense. All we know is how much is in one envelope and that one envelope contains twice as much as the other. The probability of getting the larger amount by switching is 50% regardless of whether we have opened the envelope or not.

I can clarify what I mean in the following way. Suppose we carry out the experiment a hundred times each with two envelopes. Supposed each experiment is identical. We open one envelope in one experiment and find it has $10. There are two possible scenarios. Scenario A is that in every experiment one envelope contains $10 and the other contains $20. Scenario B is that in every experiment one envelope contains $10 and the other contains $5. If Scenario A is the actual experimental setup, we should always switch. If Scenario B is the actual setup, we should always stay. But we don't know if we're in Scenario A or Scenario B.

All we know is that one envelope contains twice as much as the other. I would suggest that we should apply the Principle of Indifference to Scenarios, assume Scenario A is just as probable as Scenario B. This would mean, as common sense suggests, that it makes no difference whether we switch envelopes or stick with the original envelope.

This argument does not solve the problem but it strongly suggests that the argument made in the "What if you open envelope A?" section must be incorrect. The claim that repeating the experiment repeatedly would show that switching is better than sticking only works if we're in Scenario A. But it fails in Scenario B. It is because we don't know which Scenario obtains that we should estimate the probability as 50 percent.



The flaw is that a number cannot be picked randomly from an infinite set. That's because Randomly means that the probability of each choice is the same. If the probability for any choice is any non-zero amount, then the sum of probabilities for the entire set must be infinity since there are an infinite number of amounts in the set. But one of the fundamental probability laws states that the sum of probabilities of each possible choice must be 1. So, you can't randomly choose an amount from an infinite set of amounts.

That means that the premise that the probability that the amount in the other envelope is the smaller amount is 50% is not valid. That probability is undefined.

If choosing from a finite set of amounts, then the probability of the other envelope (B) having twice the amount as envelope A is zero (not 50%) if the amount in A is, for example, the highest possible amount in the finite set.


If you give up an envelope which contains either 2A or A/2. Then its value is 5/4 of A. You get back either 2A or A/2, so the new envelope has a value, Surprise, of 5/4 A. Nothing paradoxical about that. Paradoxical is how can people be so blind and consider just one part of the story...it's a joke