# The „Two Envelopes Problem“

During the recent four day Holidays I found time to think about the paradox of the two envelopes: Assume you are given two envelopes, one containing the double amount of the other. You select one of them by chance and see 100$. Should you accept it, or switch to the other envelope with a chance to exchange the 100$ for 50$or 200$?

I read about this in SPIEGEL online, and the explanation given there was wrong, to say the least. The argument went as follows: Since we took one of the envelopes by chance, the chance of taking the lower one is 1/2, as well as the chance of taking the better one. So the chance of finding 200$and 50$ in the other envelope is 1/2 each, and that yields an expected value of 125$for the change. Thus, you should change. Clearly, this is nonsense. With such an argument, you should have taken the second envelope right away. Furthermore, you could argue that switching once more, i.e., taking the first envelope, increases your chances again by a factor of 5/4. In an earlier blog I outed myself as a „frequentist“, i.e., I say that probabilities only make sense if we can imagine a repeatable experiment to check them against frequencies of outcomes. This is the not case here. Imagine a simulation of the envelopes. If the amounts you put into the envelopes are known in advance it is obvious when to change and when not. If you select the amount of the bigger envelope randomly the chances of changing or not changing depend on the selected random distribution. Without fixing the distribution there is no experiment, no simulation, and thus no probability. Update: People keep arguing with me that the probability to find 50$/100$or 100$/200\$ are the same, so the argument for the change must be correct. In fact, we are facing an infinity paradox here. It is impossible to choose a positive number at random so that all numbers have the same probability. If we select a very large number Omega as our upper limit, we would have to keep anything above Omega/2, and we cannot argue that this „does never happen“. This problem with infinity is much like the Petersburg paradox.

But it is interesting to compute the optimal switching strategy for a given distribution. First we assume a density Sigma for the amount of money in the bigger envelope, and a keeping probability Tau depending on the amount found in the randomly chosen envelope. We assume that Sigma is a random distribution with expected value 1. I.e.,

$$\int\limits_0^\infty \sigma(x) \,dx = 1, \quad \int\limits_0^\infty x \sigma(x) \,dx = 1.$$

Then the expected outcome of the strategy Tau is

$$G = \int\limits_0^\infty \left( \dfrac{1}{2} \left(x \tau(x) + \dfrac{x}{2} (1-\tau(x))\right) + \dfrac{1}{2} \left(\dfrac{x}{2} \tau(\dfrac{x}{2}) + x (1-\tau(\dfrac{x}{2}) \right)\right) \sigma(x) \,dx$$

Thus

$$G = \dfrac{3}{4} + \dfrac{1}{4} \int\limits_0^\infty x \left( \tau(x) – \tau(\dfrac{x}{2})\right) \sigma(x) \, dx.$$

As expected, if we change always or never, or with a constant probability, the expected outcome is 3/4, the mean value between 1/2 and 1. (Remember that 1 is the expected content of the bigger envelope by our assumptions about Sigma.) With a little bit of manipulation, we get

$$G = \dfrac{3}{4} + \dfrac{1}{4} \int\limits_0^\infty x \tau(x) \left(\sigma(x) – 4 \sigma(2x)\right) \, dx.$$

Thus the optimal strategy is the following.

$$\tau(x) = \begin{cases} 1=\text{keep}, & \text{if} \,\, \sigma(x) > 4 \sigma(2x) \\ 0=\text{change}, & \text{else}. \end{cases}$$

Let us study a few examples.

First, we select the high value randomly between 0 and 2, i.e.,

$$\sigma = \dfrac{1}{2} \chi_{[0,2]}.$$

Then it is easy to see that we have to keep every amount higher than 1. One gets

$$G = \dfrac{3}{4} + \dfrac{1}{4} \int\limits_1^2 x \dfrac{1}{2} \, dx = \dfrac{15}{16} = 0.9375$$

We can simulate this in EMT (Euler Math Toolbox). Doing it with the matrix language is always a bit obscure. But it is the fastest way. A loop should be preferred for more readability.

>n=10000000; x1=random(n)*2; x2=x1/2; // fill the envlopes (10 million times)
>env=intrandom(n,1,2); i=nonzeros(env==2); // select 1 or two randomly
>x=x1; x[i]=x2[i]; // get the selected envelope
>j=nonzeros(x<=1);  // see which contain less than 1
>env[j]=3-env[j]; i=nonzeros(env==2); // adjust the selection accordingly
>x=x1; x[i]=x2[i]; // select the envlope according to this
>mean(x) // print the mean of our 10 million repetitions
0.937501261533

The result is in accordance with our theory. Let us try

$$\sigma(x) = e^{-x}.$$

In this case we keep everything above log(4). Now

$$G = \dfrac{3}{4} + \dfrac{1}{4} \int\limits_{\log(4)}^\infty x \left(e^{-x}-4e^{-2x}\right) \, dx \approx 0.8402$$

This distribution is a bit better. Another EMT simulation shows that we have computed the right values.

>n=10000000; x1=-log(random(n)); x2=x1/2;
>env=intrandom(n,1,2); i=nonzeros(env==2);
>x=x1; x[i]=x2[i];
>j=nonzeros(x<=log(4));
>env[j]=3-env[j]; i=nonzeros(env==2);
>x=x1; x[i]=x2[i];
>mean(x)
0.840447946298

The following is a plot with different keepers. The optimum is log(4) which is approximately 1.386. The plot takes n=1000000 for each value from 0.5 to 2 with a spacing of 0.02. It is not clear to me which Sigma is optimal and gives the smallest gain for changing. But the problem should clearly have been investigated somewhere in the literature.

You may ask: What about discrete distributions? If only values n/N, n=1,2,…, are allowed we can simulate this by selecting Sigma constant on a small interval of length d/n around n/N with d=1/(2N). Then it is obvious that every odd n is the lower value. In fact, Sigma must be chosen 0 there, because the value cannot be the higher value. This is in accordance with our theory.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.