Skip to main content

Two Envelopes Paradox Calculator

Two envelopes, one holding X and the other 2X, and you have opened one of them. Should you switch? The famous argument says you must, because the other envelope is more likely to be the larger one, and that would make the envelope in your hand more likely to be the smaller one. The reasoning is memorable, it feels airtight, and it is wrong.

The lower bound of the range X is drawn from, which stands in for the problem having no preferred scale.

The upper bound. The width of this range is what decides whether an amount you see rules out one envelope.

The figure written on the envelope you opened.

How X is assumed to be spread across the range. Uniform weights every amount equally; log-uniform gives every decade the same mass.

How many times to build the envelopes, pick one at random and apply each strategy.

Fixes the random sequence, so the same inputs always give the same simulation.

Calculated Result
33.3333%

P(you hold the larger envelope)

P(you hold the larger envelope)

33.3333%

P(you hold the smaller envelope)

66.6667%

Break-even probability

66.67%

Gain from swapping

3

Gain from keeping

0

Loss if the swap goes wrong

3

Gain if the swap goes right

6

Swap: the odds favour it — X uniform on [1, 10]; break-even at P(larger) = 66.67%.

Calculation Breakdown

  1. Work out which envelopes could hold this amountYour envelope holds y = 6. If it is the X envelope then X = 6, which the prior allows. If it is the 2X envelope then X = 3, which it also allow. Both readings survive, so the amount alone has not settled the question.X=yorX=y2X = y \quad \text{or} \quad X = \frac{y}{2}
  2. Weight the two readingsThe prior density of the doubled branch carries a factor of 1/2 from the change of variable, since x to 2x stretches the range and flattens the density. Weighting the surviving branches gives P(larger) = 33.3333%.P(larger∣y)=p(y/2)/2p(y)+p(y/2)/2P(\text{larger} \mid y) = \frac{p(y/2)/2}{p(y) + p(y/2)/2}
  3. Compare the two payoffs, which are not the same sizeSwapping gains 6 when you hold the smaller envelope and loses 3 when you hold the larger one. Expected gain = 66.6667% × 6 − 33.3333% × 3 = 3, so swapping is the better move.E[gain]=P(smaller) y−P(larger) y2E[\text{gain}] = P(\text{smaller})\, y - P(\text{larger})\, \frac{y}{2}

What Is the Two Envelopes Paradox Calculator?

The two-envelopes paradox is a probability puzzle about a choice between two sealed envelopes, one holding an amount X and the other twice that amount. It is famous less for being a good puzzle than for the fact that its usual solution is wrong in an instructive way.

The setup hides a genuine asymmetry. A right switch doubles your money, a wrong one halves it, so even a strategy that wins less than half the time can be profitable. Most statements of the paradox ignore this and reason purely about which event is more likely.

How Does the Two Envelopes Paradox Calculator Work?

You open an envelope showing y. Either it holds X, so X = y, or it holds 2X, so X = y/2. Both readings are consistent with what you see, so the question is which is more likely.

A prior turns that into arithmetic. Each reading gets a weight from the prior density, and the doubled reading carries an extra factor of one half because the map x to 2x stretches the range and flattens the density. Dividing gives P(larger | y).

Switching gains y when you hold the smaller envelope and loses y/2 when you hold the larger one, so the expected gain is P(smaller)·y − P(larger)·y/2 and the break-even probability is two thirds.

The classic argument sidesteps all of this by assuming a uniform distribution over the positive reals, whose density 1/x has an infinite integral. The resulting "probability" grows past 1 as the cutoff climbs, which is the contradiction and also the diagnosis.

Two Envelopes Paradox Calculator Formula & Variables

The core mathematical equation utilized by this calculator is expressed as:

P(larger∣y)=p(y/2)/2p(y)+p(y/2)/2,E[gain]=P(smaller) y−P(larger) y2P(\text{larger} \mid y) = \frac{p(y/2)/2}{p(y) + p(y/2)/2}, \qquad E[\text{gain}] = P(\text{smaller})\, y - P(\text{larger})\,\frac{y}{2}

Variable Definitions

SymbolVariable Meaning & Units
ythe amount written in the envelope you opened
Xthe unknown smaller amount; the other envelope holds 2X
p(x)the prior density for X
P(larger | y)chance you are holding the 2X envelope, given the amount you see
E[gain]expected change in your amount if you switch

The amount you see has two readings: the envelope holds X, so X = y, or it holds 2X, so X = y/2. The prior gives each reading a weight, and the second reading carries a factor of one half because doubling X spreads the same probability over twice the range. The switch decision then follows from the payoffs, which are asymmetric: +y when you are right and −y/2 when you are wrong. The final term is the naive argument, and its divergence is the diagnosis.

How to Use the Two Envelopes Paradox Calculator

  1. Pick what you want to work out: the decision for an amount you have actually seen, the flaw in the classic argument, the behaviour under a scale-invariant prior, or a simulation of many attempts.
  2. Give the range X is drawn from. This is the only real input to the problem and the one the paradox never mentions, so treat it as the assumption doing all the work.
  3. Enter the amount from your envelope. The calculator reports the chance you hold the larger envelope, the gain from switching and the loss from a wrong switch, then names the better move.
  4. Read the Method row as a prior in disguise. Different ranges give different answers, and that variation is the point: the puzzle has no answer until you supply a prior.

Step-by-Step Example Calculation

An envelope showing 6, with X somewhere in [1, 10]

Input Values:

mode:observed
a:1
b:10
y:6
prior:uniform
Worked Steps: Both readings survive: X = 6 is allowed and X = 3 is allowed. The doubled branch carries half the weight of the direct one from the change of variable, so P(larger) = 1/3. Switching gains 6 with probability 2/3 and loses 3 with probability 1/3, an expected gain of 3, so switch — even though you are only twice as likely to hold the smaller envelope, not more.

Understanding Your Result

The probability that you hold the larger envelope is the number that organises everything else. Below the prior minimum times two it is zero, in the interior it is a fixed fraction, and above the prior maximum it is one.

The expected gain is measured against keeping the envelope, which is the zero baseline. A negative number means the swap costs you money in expectation, whatever the odds say.

The two-thirds threshold is the difference between the optimal strategy and the intuitive one. The intuitive rule swaps only when you certainly hold the smaller envelope, which leaves profitable swaps on the table.

A small positive expected gain is a statement about the bounds you supplied, not about the envelopes. Widen the range and the evidence gets rarer, so the edge shrinks.

Factors That Affect the Result

  • The range of the prior. It decides how often an amount you see can rule one envelope out, which is the only source of information in the problem.
  • Which prior you choose. A log-uniform prior makes the interior completely uninformative, while a uniform one gives a fixed 1/3 chance of holding the larger envelope wherever both readings survive.
  • Where the amount falls in the range. Near the ends the answer is certain; in the middle it is not.
  • The factor between the envelopes. A factor of two makes the two branches look alike to a scale-invariant prior; a larger factor would not.

When Should You Use This Calculator?

  • Understanding the standard resolutions of the paradox, including the improper-integral diagnosis.
  • Deciding what a prior-free version of the question can and cannot tell you.
  • Teaching why some apparently reasonable probability arguments are not.
  • Any practical version of the puzzle where the range of the hidden amount really is known.

Assumptions & Limitations

  • The result depends entirely on the prior you supply. There is no prior-free answer to this question, which is the whole content of the paradox.
  • The puzzle assumes the two envelopes are equally likely to be the one you receive and that the amounts are exactly related by the stated factor.
  • It says nothing about who chose X or why. If X is a prize designed to be interesting, that is information the prior has not captured.
  • The simulation reports averages over the prior, which is a different quantity from the average a single player experiences, and the two can differ sharply.

Frequently Asked Questions

Calculation Accuracy & Reference Note

The posteriors are ratios of prior densities and the expected gains are closed-form arithmetic, so both are exact up to floating point. The improper integral is evaluated at a finite cutoff, which is precisely why it can exceed 1 while no true probability ever does.

Standard Reference: Mollow, J. (1994), On the two-envelope paradox. Analysis 54 (3), 240–242. Original puzzle attributed to Lewis Carroll and to a 1970 Putnam paper.