Conditional-probability puzzles where the intuitive answer is wrong, or right only for a different way of learning the information. Rule: write down the sample space and the protocol that produced the information, then apply Bayes.
| Puzzle | Information | Answer |
|---|---|---|
| boy or girl (Gardner) | “at least one of my two children is a boy" | |
| "the older child is a boy" | ||
| "at least one is a boy born on a Tuesday” | ||
| general: “at least one is a boy with a trait of probability ” | (from at to as ) | |
| you meet a random one of the two children and it is a boy | ||
| the parent picks a random child and says “I have a boy born on Tuesday” | ||
| Bertrand’s box | boxes GG, SS, GS; random box, random coin, it is gold; is the other gold? | |
| three prisoners | one of A, B, C is pardoned at random; the warden tells A “B will be executed” | A still , C now |
// Two children; sex (0 = boy) and a trait uniform on t values (t = 7: weekday) are independent.
// P(both boys | at least one is a boy with trait 0), by enumerating the 4t^2 equally likely families.
pair<ll, ll> boyWithTrait(int t) {
ll cond = 0, both = 0;
for (int s1 = 0; s1 < 2; s1++) for (int d1 = 0; d1 < t; d1++)
for (int s2 = 0; s2 < 2; s2++) for (int d2 = 0; d2 < t; d2++)
if ((s1 == 0 && d1 == 0) || (s2 == 0 && d2 == 0)) { cond++; both += s1 == 0 && s2 == 0; }
ll g = gcd(both, cond); return {both / g, cond / g};
}
// Same families, but the parent reports a uniformly random child: "a boy with trait 0". P(both boys | that report).
double boyWithTraitRandomChild(int t) {
double cond = 0, both = 0;
for (int s1 = 0; s1 < 2; s1++) for (int d1 = 0; d1 < t; d1++)
for (int s2 = 0; s2 < 2; s2++) for (int d2 = 0; d2 < t; d2++)
for (int who = 0; who < 2; who++) { // each report has weight 1/2
int s = who ? s2 : s1, d = who ? d2 : d1;
if (s == 0 && d == 0) { cond += 0.5; both += 0.5 * (s1 == 0 && s2 == 0); }
}
return both / cond;
}Proof: the boy-or-girl answers
The four families BB, BG, GB, GG (older first) are equally likely. “At least one boy” removes GG, leaving BB among three equally likely families: . “The older is a boy” leaves BB, BG: .
Trait of probability . A child is “a boy with the trait” with probability , independently for the two children. So , and . The ratio is ; for it is . Intuition: the more specific the trait, the less likely that two boys both qualify, so the condition nearly identifies one particular child, as in “the older is a boy”.
Random child. If a uniformly random child is reported, . Taking expectations, ; in a BB family each child qualifies with probability , so . The posterior is for every , including (“I met a random child, a boy”). The same words carry different information under different protocols. Both functions were checked against the closed forms for .
Proof: Bertrand's box and the three prisoners
Box. The six coins are equally likely to be drawn. Three are gold, and two of those lie in the GG box. Given a gold coin, the box is GG with probability , and then the other coin is gold. (The tempting answer treats “GG or GS” as equally likely, ignoring that GG produces a gold coin twice as often.)
Prisoners. If A is pardoned, the warden names B or C with probability each; if C is pardoned he must name B; if B is pardoned he cannot name B. So , , . This is Monty Hall in disguise: A’s chance cannot change because the warden can always name someone other than A.