two envelopes

two envelopes hold money, one exactly twice the other. u pick one at random and open it. should u swap? naive argument: if mine holds X, the other holds X/2 or 2X with equal odds, so swapping gains +X/4 on average — every time. that can't be right, and it isn't. play it, then let the machine play it a million times.
envelope 1
 
envelope 2
click an envelope to pick it
rounds 0
total if keep 0
total if swap 0
why it breaks: the X in the naive argument secretly depends on which envelope u hold, so the two “cases” aren't equally likely once u condition on what u see. pick a real prior for the amounts (here: the smaller sum is drawn log-uniform up to a cap) and the expected gain from swapping is zero. the paradox lives in the missing prior, not in the money.