Question on a solution to the two envelopes paradox
The two envelopes paradox: You are given a choice of two envelopes with money inside. One of the envelopes has double the amount of money than the other. After choosing an envelope, you are given the option to switch. Should you switch? If the amount of money in the envelope you chose is X, the expected value of switching is:
E(Switching) = (1/2)(2X)+(1/2)(X/2)=5/4X. Which suggests you should always switch.
I watched a video on this problem, and the solution they gave is that the expected value equation is invalid because the first X is from the case where X is the smaller amount, and the second X is from the case where X is the bigger amount, so the variables are representing different things.
I know that there's not a definitive solution to this paradox, but this particular solution seems wrong to me because it challenges my basic understanding of algebra. It shouldn't matter where the X's came from because they're just representing a numerical value. For example, if person A has X dollars and person B has X dollars, then the total is X+X=2X. The X's are technically representing different things, but the equation still works.
So is this solution actually valid?