User:IssaRice/Two envelopes problem

From Machinelearning

https://en.wikipedia.org/wiki/Two_envelopes_problem

Step Wikipedia Formal interpretation
1 I denote by A the amount in my selected envelope. We need to define a sample space. Let be a set. The intended interpretation here is that is the world in which envelope contains the larger amount () and we chose envelope . Since all choices are made randomly, we can assume a uniform distribution, i.e. for all . We need to decide what sort of object is. Since later on, we start talking about hypotheticals (e.g. "If A is the smaller amount") it makes sense to let be a random variable. We define as

For instance, if the larger amount was in envelope 1 and we chose envelope 2, then we are in the world so as expected.
2 The probability that A is the smaller amount is 1/2, and that it is the larger amount is also 1/2. We can interpret this as saying that and . Both of these are true, e.g. .
3 The other envelope may contain either 2A or A/2. Here it helps to introduce a random variable tracking the amount in the unchosen envelope. Call it . We have

Now the claim from Wikipedia is saying that either or . Since this is an equality between random variables, things are starting to get a little tricky. Formally, is an event; in fact, it is the set (for both of those pairs, and so indeed). Similarly, is the set . Now, "either or " means that and (interpreted as events) include all the possible worlds, i.e. that . This is indeed the case.
If A is the smaller amount, then the other envelope contains 2A.
If A is the larger amount, then the other envelope contains A/2.
Thus the other envelope contains 2A with probability 1/2 and A/2 with probability 1/2.
So the expected value of the money in the other envelope is:
This is greater than A, so I gain on average by swapping.
After the switch, I can denote that content by B and reason in exactly the same manner as above.
I will conclude that the most rational thing to do is to swap back again.
To be rational, I will thus end up swapping envelopes indefinitely.
As it seems more rational to open just any envelope than to swap indefinitely, we have a contradiction.