This is a fun puzzle – I took a crack at it.
Let X be the amount as in the statement of the puzzle. Let Y be the amount revealed in the first envelope.
There are two possible states in which one can be after the revelation: either Y = X (you have pulled the lesser envelope, and the other has twice as much), or Y = 2X (you have pulled the greater envelope, and the other has half as much).
There are also two actions: stay, and switch.
We can then construct the average expected winnings from each move, based on each of the two states, in a 2 x 2 table:
Each of the four cells represents an outcome of the move made based on the corresponding state (states on the horizontal, moves on the vertical). In each case, the value is expressed in terms of both X and Y.
Assuming that there is a 50% chance that one is in either of the two states, we can get the average expected winnings for each move by halving the value given by that move in each state, then adding these two together.
What's interesting is that the results look different depending on whether you express the average result in terms of X or Y.
For Y:
Switch: .5(2Y) + .5(.5Y) = Y + .25Y
= 1.25Y
Stay: .5 Y + .5Y
= Y
Thus, expressed in terms of Y, the greater average output is had by switching, since 1.25Y > Y, regardless of the value of Y.
For X:
Switch: .5(2X) + .5X = X + .5X
= 1.5X
Stay: .5X + .5(2X) = .5X + X
= 1.5X
Thus, expressed in terms of X, both moves have the same average output.
––––
So what's going on? How can the output be equal, but not equal, for the two actions?
It turns out there is an illusion in the way the problem was set up with respect to Y: there is no single value of a variable Y that can be defined independently of X, and then placed next to it in proportion (as either equal to it, or double it). Where Y is the number you drew in the first envelope, such a variable is already defined in terms of X: it is only possible to draw X, or 2X. The illusion results from thinking of 'the value of what I drew' as some distinct variable Y, when this is not the case. This in turn leads to the illusion that one can calculate the average expected return based on this new value, 'what I drew,' and conclude that switching allows a better return on 'what one drew.'
But
what you drew is simply either X or 2X in the first place. There are thus two possible situations: either you drew X, or you drew 2X. And there are two possible moves: switch, or stay. Now let's draw the real table, defined this time in terms of the
only variable there is, X:
This table simply eliminates the illusory Y (not a well-defined value independent of X to begin with), and we see that as before, switching has no effect on average expected output.
––––
The take-away message is that there is no such thing as a value of 1.25Y, averaged across the two possible situations, because there is no such single value Y that is the same across said situations, since you don't know whether you're drawn the greater or lesser envelope. X, by contrast, is a value we can refer to coherently across both situations, and cast in these terms, it becomes obvious that switching is ineffectual. The illusion comes in thinking that the
de dicto description 'what I drew' is equivalent
de re to some single numerical value across possible situations, and it is not.