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.

PuzzleInformationAnswer
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 boxboxes GG, SS, GS; random box, random coin, it is gold; is the other gold?
three prisonersone 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;
}