Introduction

Two sealed envelopes sit on a table. You are told that one contains exactly twice as much money as the other — but you don't know which is which. You pick one at random and peek inside: it holds $100.

Now a voice offers you a choice: keep it, or swap for the other envelope. Most people shrug and say it doesn't matter. But a slick expected-value argument says it always matters — and you should always swap:

"The other envelope holds either $50 (with probability 1/2) or $200 (with probability 1/2). The expected value of swapping is \frac{1}{2} \cdot 50 + \frac{1}{2} \cdot 200 = \125$, which is more than the $100 you hold. Always switch."

So you swap. You now hold the other envelope. The same argument applies again — and again — for ever. You are trapped in an infinite loop of swapping, and nothing in the math seems to stop you.

This is the Two Envelopes Paradox, an open puzzle in probability and decision theory. Its resolution is subtle: the naive argument smuggles in a hidden assumption about the distribution of amounts that cannot actually hold.

Try It

The demo below lets you choose a prior distribution over the smaller envelope amount. For each prior, it computes the true expected gain from switching after observing xx in your envelope.

<!-- {{c_html_comment}} -->
<div class="controls">
  <label for="prior-select">{{label_prior}}</label>
  <select id="prior-select">
    <option value="uniform">{{opt_uniform}}</option>
    <option value="geometric" selected>{{opt_geometric}}</option>
    <option value="exponential">{{opt_exponential}}</option>
  </select>
  <label for="x-range" id="x-label">{{label_x}} <span id="x-val">10</span></label>
  <input type="range" id="x-range" min="1" max="100" value="10" step="1">
</div>
<div class="result-box" id="result-box">
  <div class="result-row">
    <span class="result-label">{{label_your_envelope}}</span>
    <span class="result-value" id="val-x">$10</span>
  </div>
  <div class="result-row">
    <span class="result-label">{{label_prob_a}}</span>
    <span class="result-value" id="val-pa">—</span>
  </div>
  <div class="result-row">
    <span class="result-label">{{label_prob_b}}</span>
    <span class="result-value" id="val-pb">—</span>
  </div>
  <div class="result-row">
    <span class="result-label">{{label_ev_other}}</span>
    <span class="result-value" id="val-ev">—</span>
  </div>
  <div class="result-row highlight">
    <span class="result-label">{{label_gain}}</span>
    <span class="result-value" id="val-gain">—</span>
  </div>
</div>
<div class="verdict" id="verdict"></div>
<div class="explanation" id="explanation"></div>
<button id="btn-naive" type="button">{{btn_naive}}</button>
<div class="naive-box hidden" id="naive-box">
  <strong>{{naive_title}}</strong>
  <p>{{naive_body}}</p>
  <p class="naive-warn">{{naive_warn}}</p>
</div>
/* {{c_css_comment}} */
* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; margin: 0; color: #222; }
.controls { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .8rem; }
label { font-size: .85rem; color: #555; font-weight: 600; }
select, input[type=range] { width: 100%; }
select { padding: .3rem .4rem; border: 1px solid #ccc; border-radius: 6px; font-size: .9rem; }
.result-box { background: #f0f4f8; border-radius: 10px; padding: .8rem 1rem; margin-bottom: .6rem; }
.result-row { display: flex; justify-content: space-between; align-items: center;
              padding: .2rem 0; border-bottom: 1px solid #dde3e9; font-size: .9rem; }
.result-row:last-child { border-bottom: none; }
.result-row.highlight { font-weight: 700; font-size: 1rem; }
.result-label { color: #555; }
.result-value { font-family: ui-monospace, monospace; }
.verdict { font-size: 1rem; font-weight: 700; min-height: 1.4em; margin-bottom: .3rem; }
.verdict.switch { color: #0a7d33; }
.verdict.keep { color: #c92f3c; }
.verdict.neutral { color: #555; }
.explanation { font-size: .82rem; color: #444; line-height: 1.5; margin-bottom: .6rem; }
button { font: 600 13px system-ui, sans-serif; padding: .4rem .8rem; border: 1px solid #1d3557;
         background: #1d3557; color: #fff; border-radius: 8px; cursor: pointer; margin-bottom: .5rem; }
.naive-box { background: #fff3cd; border: 1px solid #ffc107; border-radius: 8px;
             padding: .7rem; font-size: .85rem; line-height: 1.5; }
.naive-box p { margin: .3rem 0 0; }
.naive-warn { color: #c92f3c; font-weight: 600; }
.hidden { display: none; }
// Code not found

Notice: with a uniform prior on a bounded range, switching is sometimes beneficial and sometimes harmful depending on xx — there is no universal "always switch." With the geometric prior, the expected gain is exactly zero: the two envelopes are symmetric and swapping is irrelevant. The naive argument that gave +25%+25\% was implicitly using an improper flat prior over all positive reals, which does not define a valid probability distribution.

The Real Flaw

The naive argument fails because it treats the observed amount as if it gives symmetric information about both possibilities. Here is why that breaks down.

Let the smaller amount be mm (unknown). Your envelope holds either mm or 2m2m, each with probability 12\frac{1}{2}. If you see xx:

  • Case A: your envelope is the smaller — then m=xm = x and the other holds 2x2x.
  • Case B: your envelope is the larger — then m=x/2m = x/2 and the other holds x/2x/2.

The posterior probability of Case A vs. Case B depends entirely on your prior over mm. If your prior gives P(m=x)P(m = x) and P(m=x/2)P(m = x/2), then by Bayes:

P(Case Ax)=P(xA)p(x)P(xA)p(x)+P(xB)p(x/2)=p(x)p(x)+p(x/2)P(\text{Case A} \mid x) = \frac{P(x \mid \text{A})\, p(x)}{P(x \mid \text{A})\, p(x) + P(x \mid \text{B})\, p(x/2)} = \frac{p(x)}{p(x) + p(x/2)}

The expected value of the other envelope is:

E[otherx]=2xP(Ax)+x2P(Bx)E[\text{other} \mid x] = 2x \cdot P(\text{A} \mid x) + \frac{x}{2} \cdot P(\text{B} \mid x)

This equals xx (no gain from switching) only when p(x)=p(x/2)p(x) = p(x/2) for all xx — which requires a distribution uniform over all powers of 2, which does not exist as a proper probability measure.

The naive argument implicitly uses an improper flat prior p(m)1p(m) \propto 1 over (0,)(0, \infty), which is not a valid distribution. Every proper prior breaks the symmetry at some scale, and for any bounded or geometric prior the gain from switching can be negative, zero, or positive — depending on xx relative to the prior's support. This connects to deeper issues in Bayesian inference about non-informative priors.

Where It Matters

The two-envelopes trap is not just an abstract puzzle — the same logical flaw appears throughout computer science and decision theory:

  • Optimal stopping (secretary problem): deciding when to accept the "current best" requires a model of the underlying distribution. Without one, no stopping rule is universally optimal — just like no switching rule beats the two-envelope argument.
  • Algorithm analysis: comparing two unknown quantities ("is this solution better than the last?") can lead to infinite regress if the comparison assumes scale-free distributions that don't exist.
  • Game theory and adversarial settings: an opponent who knows you always switch will exploit you. The correct strategy depends on beliefs — priors — about the game state.
  • Bayesian model selection: choosing between two models by comparing their marginal likelihoods can exhibit the same prior-dependence. The "obviously better" model can flip based on the prior you choose.

The lesson is always the same: expected value without a valid probability model is meaningless. See also Nash equilibrium for how rational agents must reason about uncertainty in strategic settings.

Conclusion

The Two Envelopes Paradox is still open in the sense that there is no universally agreed single resolution — philosophers and mathematicians continue to debate its subtleties. But the core lesson is clear: the naive switching argument is invalid because it implicitly assumes an improper prior distribution that cannot exist.

Once you fix a real, bounded prior over possible amounts, the expected gain from switching is well-defined, finite, and no longer universally positive. Sometimes you should switch, sometimes not — it depends entirely on what you observed and what you believed about the amounts beforehand.

Expected value is one of the most powerful tools in probability. But it is only as trustworthy as the distribution it is computed from. Demand a valid prior, and the infinite-swap loop evaporates.

Share this article

Pick a channel — or use your device's native share sheet.

Comments

Loading comments...

https://www.kipuhub.com/en/article/two-envelopes/Content licensed under CC BY-NC 4.0.