Let me name the objects before I compute with any of them. D is that Bob picked the double-headed coin, N is that he picked a fair one, and E eight is that all eight tosses came up heads. What the question asks is the probability of D given E eight; that is a statement about the coin, not about the tosses. The reversal is the whole difficulty.
I also want the two numbers on the board at once, because they are not accidental: one hundred and twenty-nine is two to the seven plus one, and two to the eight is two hundred and fifty-six, which is exactly twice one hundred and twenty-eight. That is the seam this question is built on. I will come back to it.
So let me guess out loud before I prove anything. Picking the odd coin is a one in one hundred and twenty-nine shot, so the odds are one to one hundred and twenty-eight against. Eight heads is two hundred and fifty-six times more likely on the double-headed coin. That is exactly twice the disadvantage, nothing more than that. So I expect the answer comfortably above a half, somewhere near two over three. Now let me earn it.
Two columns, and I will not let them mix. The prior column is about the pile: one coin in one hundred and twenty-nine is double-headed, so the prior on D is one over one hundred and twenty-nine and the prior on N is one hundred and twenty-eight over one hundred and twenty-nine. Note it is one hundred and twenty-eight fair coins, not one hundred and twenty-nine.
The likelihood column is about the tosses, conditional on which coin we hold. On the double-headed coin heads is certain every time, so eight heads has likelihood one to the eighth, which is one. On a fair coin the tosses are independent given the coin, so eight heads in a row is one half to the eighth, that is one over two hundred and fifty-six.
One assumption I want stated rather than smuggled in: the evidence is that all eight are heads, not that at least one is. At least one head on a fair coin has probability one minus one over two hundred and fifty-six, which is nearly one and would change the entire answer. And Bob gains no other information; he never looks at the second face of the coin.
I want this as a picture, because the argument is really about mass. Take total probability as an area, and cut it the way the pile is cut: a narrow strip of one over one hundred and twenty-nine for the odd coin, the rest for the fair ones. Then flood each branch with its chance of surviving eight heads. The fake strip survives with probability one and keeps everything; the fair branch survives with probability one over two hundred and fifty-six.
The only multiplication worth doing is one hundred and twenty-eight over two hundred and fifty-six, and that is a clean one half. So the fair branch is left holding exactly half of what the fake branch holds. I deliberately do not compute one hundred and twenty-eight over thirty-three thousand and twenty-four; that big fraction is the trap, and the question is testing whether I see the cancellation instead.
Look at what is still standing: two blocks against one block. The drawing already says two over three, so whatever the next two beats compute has to agree with this picture or one of them is wrong.
Here is the route I would actually defend under time pressure. Odds are the honest currency for this problem: posterior odds equal prior odds times likelihood ratio. The evidence term never has to be computed at all, because it cancels between the two branches.
Read it straight off the two columns. Prior odds are one to one hundred and twenty-eight. The likelihood ratio is one divided by one over two hundred and fifty-six, that is two hundred and fifty-six to one. Multiplying, the powers of two do the entire job. Two hundred and fifty-six over one hundred and twenty-eight is two, so the posterior odds are two to one.
Then the conversion, and I state it instead of skipping it. Odds o become probability o over one plus o, so two to one is two over three. Backwards, a probability p is odds p over one minus p; I will want that in a moment. Notice that one hundred and twenty-nine never appeared as a divisor. The size of the pile entered purely as the prior disadvantage.
Now the textbook route, in exact rational arithmetic rather than decimals. I want a genuinely independent second number, not the same one twice. The denominator is the total chance of eight heads. The fake branch contributes one over one hundred and twenty-nine, which is two over two hundred and fifty-eight, and the fair branch contributes one over two hundred and fifty-eight.
So the evidence has probability three over two hundred and fifty-eight, which reduces to one over eighty-six. That is the fraction I measured off the drawing, and it is worth hearing how ordinary it is. Eight heads is nothing to boast about: once the pile is in play, about one run of eight tosses in eighty-six produces it. That is exactly why the base rate has to be in the argument.
Dividing, one over one hundred and twenty-nine over one over eighty-six is eighty-six over one hundred and twenty-nine, and both are multiples of forty-three, so two over three. The fair branch gives one third. The two sum to one, and their ratio is the two to one the odds form predicted and the two blocks to one block the drawing showed. Three routes, one number.
Before I commit to two over three I want the family this answer sits in. Take the evidence to be n heads in a row. The identical odds argument then gives one over one plus one hundred and twenty-eight times two to the minus n, and that is the same thing as two to the n over two to the n plus one hundred and twenty-eight. That is the curve I have drawn.
Two endpoints come free, and both are checks on me rather than on the arithmetic. With no tosses at all the posterior is one in one hundred and twenty-nine; it collapses back onto the prior, which is the only sane behaviour when there is no evidence. With heads for ever it tends to one. A formula that failed either test would be wrong however neat it looked.
Now the table from one to ten: one sixty-fifth, one thirty-third, one seventeenth, one ninth, one fifth, one third, one half, two thirds, four fifths, eight ninths. It is strictly increasing, as it must be, since another head can never argue against the coin that always gives heads. And look where it crosses a half: at seven heads exactly, because one hundred and twenty-eight is two to the seven. That is why the pile has one hundred and twenty-nine coins. Seven heads merely erase the disadvantage, and the eighth doubles the odds past even.
The same table shows the asymmetry: one tail anywhere sets the probability to zero at once. Eight heads take seven tosses to be worth anything; one tail finishes the case immediately.
Let me justify the shortcut rather than merely use it. The odds form is Bayes' theorem written for both hypotheses and then divided, so the evidence term cancels. That is precisely why one hundred and twenty-nine never had to be multiplied into anything. No approximation is hiding in it.
And in base two, which is the number sense being probed: each head is worth one bit of evidence for the odd coin, and the pile starts seven bits against. So seven heads break even and the eighth leaves one bit in front, that is two to the first power, odds two to one. This is the same computation as beat four, but it explains the choice of one hundred and twenty-nine rather than one hundred and thirty.
Last, what the answer is sensitive to. If I misread the pile as one hundred and twenty-eight coins, one fake and one hundred and twenty-seven fair, I get two hundred and fifty-six over three hundred and eighty-three, about zero point six six eight, against two thirds at zero point six six seven. The change is less than two thousandths. So a one-coin miscount is nearly harmless, while dropping the fair branch or reading the conditional backwards destroys the answer completely. I would rather be accused of miscounting than of misconditioning.
So the probability is two over three. The number I would say out loud first is its complement: even after eight heads, there is still a one in three chance Bob holds a perfectly fair coin that got lucky, because one hundred and twenty-eight lucky fair coins is a large population to argue against.
The general fact behind it: with one odd coin in a pile of N and n heads in a row, the fake branch contributes one to the numerator and the fair branches contribute N minus one times two to the minus n, so the posterior is two to the n over two to the n plus N minus one. Our case, one hundred and twenty-nine coins and eight heads, is two hundred and fifty-six over three hundred and eighty-four, which is two thirds once more.
And where it stops. This is a statement about Bob's information, not about the metal. If he turns the coin over and looks, the probability is no longer two thirds but nil or one, and the question dies. If a tail appears it is nil. If he re-picks a coin for each toss, the tosses are no longer conditionally independent given one coin, the likelihood column is not two to the minus eight, and the whole argument has to be rebuilt. I would ask which of those the examiner intends before going further.
Only if you want to push further: how much evidence is enough. To exceed ninety-nine per cent I need two to the n greater than ninety-nine times one hundred and twenty-eight, which is twelve thousand six hundred and seventy-two. Two to the thirteen is eight thousand one hundred and ninety-two, too small. Two to the fourteen is sixteen thousand three hundred and eighty-four, so fourteen heads. And at fourteen heads the posterior is exactly one hundred and twenty-eight over one hundred and twenty-nine, the prior turned inside out. That closes a very satisfying circle around the number one hundred and twenty-nine.
Sequentially, the odds form has paid for itself. Given two to one now, one further head doubles the odds to four to one, four fifths, and I recompute nothing. The closed form agrees, since five hundred and twelve over six hundred and forty is four fifths. The reverse question is equally quick: a pile of two hundred and fifty-seven coins would make eight heads worth exactly even odds, because two hundred and fifty-seven is two to the eight plus one.
If the odd coin were merely biased, heads with probability p, the likelihood ratio becomes p over one half, all to the eighth, so the odds are two p to the eighth over one hundred and twenty-eight. At p three quarters that is one and a half to the eighth, roughly twenty-five point six. That is still far short of one hundred and twenty-eight, so the prior wins and the probability falls to six thousand five hundred and sixty-one over thirty-nine thousand three hundred and twenty-nine, about one sixth. The exact tipping value is two to the minus one eighth, roughly zero point nine one seven; below that a suspicious coin is not believable at all. I would offer this as a bonus rather than as the answer.
It is an inequality in powers of two, so let me solve it rather than iterate. P above ninety-nine hundredths means two to the n over two to the n plus one hundred and twenty-eight exceeds ninety-nine hundredths, which rearranges to two to the n greater than ninety-nine times one hundred and twenty-eight, that is twelve thousand six hundred and seventy-two.
Two to the thirteen is eight thousand one hundred and ninety-two, which fails. Two to the fourteen is sixteen thousand three hundred and eighty-four, which works. So fourteen heads, and the posterior there is exactly one hundred and twenty-eight over one hundred and twenty-nine.
For calibration: eleven heads give sixteen over seventeen, about zero point nine four. Seventeen heads are needed to pass three nines, since two to the sixteen is sixty-five thousand five hundred and thirty-six, short of one hundred and twenty-seven thousand eight hundred and seventy-two.
This is why I want the answer stored as odds. The odds are two to one; one more head multiplies the odds by the same per-toss factor of two, giving four to one. And four over one plus four is four fifths. Nothing about eight heads re-enters the working.
The closed form confirms it: two to the nine over two to the nine plus one hundred and twenty-eight is five hundred and twelve over six hundred and forty, which is four fifths exactly, and ten heads give eight ninths.
And the other branch of the nine: if that ninth toss is a tail, the posterior is nil at once, because the double-headed coin cannot produce it. Sequential updating is linear in log-odds: one bit for a head, minus infinity for a tail.
The double-headed coin is just the endpoint p equals one of a one-parameter family, and the odds form survives it untouched. The likelihood ratio is p to the eighth over one half to the eighth, which is two p to the eighth, so the odds are two p to the eighth over one hundred and twenty-eight.
At p equals three quarters, two p is one and a half, and one and a half to the eighth is six thousand five hundred and sixty-one over two hundred and fifty-six, about twenty-five point six. That is still only a fifth of the way to one hundred and twenty-eight. The probability is six thousand five hundred and sixty-one over thirty-nine thousand three hundred and twenty-nine, roughly one sixth, so the pile's base rate comfortably beats a mildly biased coin.
Even odds, the point where I would call the coin suspicious, needs two p to the eighth equal to one hundred and twenty-eight, so p is two to the minus one eighth, about zero point nine one seven. At p equals one we recover two thirds, as we must.
Even odds means the surviving masses tie, so two to the eight equals N minus one, giving N equals two hundred and fifty-seven coins. One hundred and twenty-nine is the pile size at which seven heads are even, so eight heads is one doubling past it. The examiner set the question to land on two thirds rather than on a half.
Re-picking is a different problem, not a harder version of this one. Then the eight tosses are no longer conditionally independent given a single coin, so there is no event E eight whose likelihood under D is one. Each toss has its own prior; eight heads just says the coin happened to be the odd one that time, and the probability that all eight picks were the odd coin is one over one hundred and twenty-nine to the eighth.
So my first question back to the examiner would be exactly this one: same coin, eight times, or eight coins once? The wording says he chooses a coin and tosses it eight times, so it is the same coin, and I would have checked either way.