Simulating a 2:3 Odds Ratio with Fair Coins

Probability · Medium · Free problem

You have two fair coins. A colleague asks you to simulate a random outcome where heads occurs with probability $\frac{2}{5}$ and tails with probability $\frac{3}{5}$ -- a 2:3 ratio -- using only these coins.

Design a procedure using only flips of these two fair coins that produces a binary outcome (call it H or T) with exactly $P(H) = \frac{2}{5}$ and $P(T) = \frac{3}{5}$. Your procedure may use as many flips as needed, but each flip must be of a fair coin.

Hints

  1. You cannot produce a probability with 5 in the denominator from a single round of two coin flips -- think about why, and what larger outcome space might help.
  2. With three coin flips, you have 8 equally likely outcomes. Consider rejection sampling: assign some outcomes to H, some to T, and discard the rest.
  3. Assign exactly 2 outcomes to H and 3 outcomes to T from the 8 possible three-flip sequences. If you land in the remaining 3, reflip. The conditional probabilities will be exactly $\frac{2}{5}$ and $\frac{3}{5}$.

Worked Solution

How to Think About It: The core tension here is that fair coins generate probabilities that are powers of $\frac{1}{2}$, but we want $\frac{2}{5}$, which has a 5 in the denominator. You cannot directly produce fifths from halves. The key insight is rejection sampling -- flip coins to generate outcomes over a larger space, identify a subset where the valid outcomes split in a 2:3 ratio, and discard (and reflip) when you land outside that subset. The question is: what is the smallest flip sequence that gives you enough equally-likely outcomes to carve out a 2:3 split?

Quick Estimate: Two coins give $2^2 = 4$ equally likely outcomes. We need 5 equally likely outcomes to split 2:3. Four does not divide into five evenly, so two coins in one shot cannot work. Three coins give $2^3 = 8$ outcomes. We can assign 2 to H and 3 to T -- that is 5 outcomes used, 3 rejected. The acceptance probability is $\frac{5}{8}$, so on average we need $\frac{8}{5} = 1.6$ rounds of three flips, or about 4.8 flips total in expectation. That is pretty efficient.

Approach: Use rejection sampling over three-flip blocks (two coins and one extra flip -- or equivalently, three flips of either coin). Assign 2 of the 8 equally likely outcomes to H, 3 to T, and reject the other 3.

Formal Solution:

Flip coin A twice and coin B once (or any three fair flips in a fixed order). There are $2^3 = 8$ equally likely outcomes, each with probability $\frac{1}{8}$:

$$\text{HHH, HHT, HTH, HTT, THH, THT, TTH, TTT}$$

Assign outcomes as follows: - HHH, HHT $\to$ result H (2 outcomes) - HTH, HTT, THH $\to$ result T (3 outcomes) - THT, TTH, TTT $\to$ reflip (3 outcomes)

Given that we do not reflip (probability $\frac{5}{8}$), the conditional probabilities are:

$$P(H \mid \text{no reflip}) = \frac{2/8}{5/8} = \frac{2}{5}, \quad P(T \mid \text{no reflip}) = \frac{3/8}{5/8} = \frac{3}{5}$$

The expected number of three-flip rounds is $\frac{1}{5/8} = \frac{8}{5} = 1.6$, so the expected total number of flips is $3 \times \frac{8}{5} = \frac{24}{5} = 4.8$.

Answer: Flip three fair coins per round. Map 2 of the 8 outcomes to H, 3 to T, and reject-and-reflip on the remaining 3. This produces $P(H) = \frac{2}{5}$ exactly, with an expected 4.8 flips per result.

Intuition

The deeper principle here is that fair coins are a source of uniform randomness over powers of 2, and any probability you want to simulate must eventually be expressed as a ratio of integers over some $2^n$. When the target probability has a denominator that is not a power of 2 (like 5), you cannot do it in a fixed number of flips -- you need rejection sampling, which introduces randomness in the number of flips but preserves exactness in the output distribution. This is the same idea behind von Neumann's trick for simulating a fair coin from a biased one.

In a quant context, this kind of thinking comes up whenever you need to sample from a non-standard distribution using only a primitive source of randomness. Monte Carlo engines face this constantly: you start with a uniform $[0,1]$ draw (from a PRNG) and transform it into the distribution you need. Rejection sampling is one of the workhorses for doing this when inverse-CDF methods are unavailable or expensive. The efficiency question -- how many flips on average -- is exactly the acceptance rate, and minimizing expected flips is a design problem in its own right.

Open the full interactive solver →