Lambdia

A Thousand Coins, Ten Heads in a Row, and 1024/2023

Draw one coin from a thousand, flip ten heads, and the chance it is the two-headed one is 0.5062. Both reflex answers miss, in opposite directions: ninety-nine percent ignores the bag, one in a thousand ignores the flips. Counting patterns gets the exact figure with no Bayes notation at all, and the reason it lands on a coin flip is that 2^10 happens to sit next to the size of the bag.

A bag holds 10001000 coins. Nine hundred and ninety-nine of them are fair, and one has heads on both faces. You draw a coin at random, flip it ten times, and get heads every time. What is the probability you are holding the two-headed coin?

The exact answer is

10242023  =  0.5061789\frac{1024}{2023} \;=\; 0.5061789\ldots
(1)

which is almost exactly a coin flip, and that is a strange place for a question like this to land. Ten heads in a row feels like overwhelming evidence. One coin in a thousand feels like an unlikely draw. The two feelings cancel, and the reason they cancel is a numerical accident worth understanding, because it tells you how fragile the answer is.

Two reflex answers, wrong in opposite directions

The first reflex is that ten heads settles it. Nobody flips ten heads with a fair coin, so the coin is rigged, call it 99%99\%. The second reflex, usually from someone who has been warned about the first, is that the coin was drawn from a bag that is 99.9%99.9\% fair, so the answer is 1/10001/1000.

Both are wrong, and they are wrong on opposite sides of the truth:

11000  <  10242023  <  51100\frac{1}{1000} \;<\; \frac{1024}{2023} \;<\; \frac{51}{100}
(2)

The first reflex ignores the base rate. The second ignores the evidence and reports the prior back as though the flips had never happened. A question that catches both errors is more useful than one that catches either, because it forces you to combine two numbers rather than pick the more salient one.

Count the patterns

The cleanest route here avoids conditional probability notation entirely, and it is exact rather than approximate.

Ten flips of one coin produce 210=10242^{10} = 1024 patterns, and for a fair coin all 10241024 are equally likely. Since the coin itself was drawn uniformly from 10001000 coins, the pair (coin, pattern) ranges over

1000×1024=1,024,0001000 \times 1024 = 1{,}024{,}000
(3)

equally likely outcomes. Now count the ones that show ten heads. Every fair coin contributes exactly one, namely HHHHHHHHHHHHHHHHHHHH, so the fair coins contribute 999999. The two-headed coin shows heads no matter what, so all 10241024 of its patterns are ten heads. Total: 20232023.

10241024+999  =  10242023\frac{1024}{1024 + 999} \;=\; \frac{1024}{2023}
(4)
Fig. 1 — Every way of seeing ten heads, sorted by which coin produced it. The near-tie is the whole answer.

Giving the two-headed coin all 10241024of its patterns is the step that deserves a second look, since it feels like double counting. It is not. The coin has ten flips and each flip has two possible recorded outcomes; it happens that the recorded outcome is heads either way. What the count is really doing is weighting each coin by its likelihood, on a scale where the fair coin's likelihood is one unit and the trick coin's is 10241024.

The same thing in the usual notation

For the version an interviewer may want written out, let TT be the event that the coin is two-headed and EE the event of ten heads.

What the model assumes

The draw is uniform over the 10001000 coins, the flips are independent, and the two-headed coin shows heads with probability exactly 11. The observation is "ten flips, all heads", with the number of flips fixed in advance.

P(TE)  =  P(ET)P(T)P(ET)P(T)+P(ETc)P(Tc)  =  1100011000+999100011024  =  10242023P(T \mid E) \;=\; \frac{P(E \mid T)P(T)}{P(E \mid T)P(T) + P(E \mid T^{c})P(T^{c})} \;=\; \frac{\tfrac{1}{1000}}{\tfrac{1}{1000} + \tfrac{999}{1000}\cdot\tfrac{1}{1024}} \;=\; \frac{1024}{2023}
(5)

Odds form is faster and it is the one to use under pressure. Prior odds on the trick coin are 1:9991 : 999. The likelihood ratio is 1:(1/2)101 : (1/2)^{10}, which is 1024:11024 : 1. Multiply:

1:999  ×  1024:1  =  1024:9991 : 999 \;\times\; 1024 : 1 \;=\; 1024 : 999
(6)

and converting odds to a probability gives (1) with no algebra at all. Notice that equation (6) is equation (4) with different punctuation. The pattern count, Bayes, and the odds ratio are one computation at three different scalings.

Why it lands on a coin flip

Redo the calculation with nn coins instead of a thousand, one of them two-headed:

P(TE)  =  1024n+1023P(T \mid E) \;=\; \frac{1024}{n + 1023}
(7)

This equals 1/21/2 exactly when n+1023=2048n + 1023 = 2048, that is at n=1025n = 1025 coins. The problem uses 10001000, which sits 2525 coins away, and that is the entire explanation for the tidy answer:

1024202312  =  254046\frac{1024}{2023} - \frac{1}{2} \;=\; \frac{25}{4046}
(8)

The near-tie is arithmetic, not insight. Somebody chose a bag size close to 2102^{10} and a flip count of ten so the two would nearly cancel. Nothing deep is happening, and a version with 10001000 coins and eleven flips would answer 2048/30470.6722048/3047 \approx 0.672, while nine flips would answer 512/15110.339512/1511 \approx 0.339.

Read from the other side: for a fixed bag of nn coins, the evidence overtakes the prior when 2k2^k passes n1n-1, which happens at

k  =  log2(999)  =  9.964k \;=\; \log_2(999) \;=\; 9.964\ldots
(9)

Ten flips is the first whole number past that crossing, by less than four hundredths of a flip. The problem is engineered to be answered right at the tipping point, which is exactly where both reflexes look plausible and neither is defensible.

How many heads would actually settle it

Since the posterior is 2k/(999+2k)2^k/(999 + 2^k) after kk heads, asking for 99%99\% confidence means solving 2k99×9992^k \ge 99 \times 999, so 2k98,9012^k \ge 98{,}901 and k=17k = 17. Sixteen heads gives 0.984990.98499, seventeen gives 0.992440.99244.

Fig. 2 — Each extra head doubles the odds on the trick coin. Seven more heads take you from a coin flip to near certainty.

The curve is a logistic in disguise, which is what any Bayesian update with a fixed likelihood ratio per observation looks like. Each additional head multiplies the odds by two, so the log-odds climb linearly and the probability traces an S. That also explains why ten is such an uncomfortable number of flips: it sits in the steep middle of the S, where a single extra observation moves the answer by 1717 percentage points.

The practical reading, and the one worth saying out loud: seven more flips settle a question that ten flips left open. If a real decision hung on this, the correct move is not to argue about 0.5060.506, it is to keep flipping.

What the number quietly assumes

Two assumptions carry weight, and neither is visible in the statement of the problem.

The first is the stopping rule. Equation (5) treats the observation as "ten flips were made, all ten were heads". It is a different problem if the observation is "a run of ten heads appeared somewhere in a longer sequence of flips", because a long sequence of a fair coin will eventually produce such a run, and the likelihood P(ETc)P(E \mid T^c) is then much larger than 1/10241/1024. Ten heads noticed after the fact is far weaker evidence than ten heads planned in advance.

The second is that the two-headed coin shows heads with probability exactly one. Weaken it to 1ε1 - \varepsilon and the numerator of (5) picks up a factor (1ε)10(1-\varepsilon)^{10}, so the likelihood ratio drops from 10241024 to 1024(1ε)101024(1-\varepsilon)^{10}. A one percent chance of misreading each flip costs you about ten percent of the evidence, and drags 0.5060.506 back below even money.

One last thing worth being precise about, because the temptation to round is strong. The answer is 0.50620.5062, which is aboveone half. So the two-headed coin is the marginally likelier explanation, and any closing line along the lines of "so the coin is probably fair" is false. The honest statement is that after ten heads the two stories are indistinguishable, with the trick coin ahead by 25/404625/4046.

Sources and further reading

Every number above was checked three ways before publication: exact rational arithmetic, an exhaustive walk of all 1,024,0001{,}024{,}000 (coin, pattern) pairs, and a seeded simulation of four million ten-flip runs, which kept the 78527852 all-heads runs and found 0.50040.5004 of them used the trick coin, inside its own sampling error of 0.00560.0056.

Comments · 0

Be the first to comment.