Quant Memo
Advanced

The Hardest Logic Puzzle Ever

A logic puzzle with three gods who answer yes/no questions in a language you don't understand, where one god always lies, one always tells the truth, and one answers randomly — solvable in three questions if you ask carefully.

Three gods, A, B, and C, are called (in some order) True, False, and Random. True always answers questions truthfully, False always lies, and Random answers yes or no completely at random. You don't know which god is which. They understand English but answer only "da" or "ja", and you don't know which word means yes and which means no. Your task: figure out the identities of all three gods using exactly three yes/no questions, each addressed to exactly one god (a god can be asked more than once, and later questions may depend on earlier answers).

The puzzle is notoriously hard because two separate uncertainties stack on top of each other: you don't know which god is lying, and you don't even know what their words mean. A question that would pin down a truth-teller's identity in an ordinary puzzle is useless here, because you can't tell if "ja" means "yes" or "no", and you can't tell if the answer came from the liar. The trick is to build questions that cancel out both uncertainties at once, using embedded conditionals like "if I asked you X, would you say ja?" — a device that forces even a liar to give you a usable answer, because lying about a lie produces the truth.

The standard first question is asked of a random god, say A: "Does 'da' mean yes if and only if you are True if and only if B is Random?" A carefully constructed biconditional like this is designed so that True and False — whatever the words mean — end up giving the same factual answer, since False's lie about the embedded falsehood flips back to match True's honest answer. Only Random's answer is unpredictable. This first question identifies a god who is definitely not Random (the one whose answer type you can trust), and the next two questions pin down True and False among the two remaining candidates, then resolve which word means yes.

The core device that solves this puzzle — nesting a hypothetical question inside another ("if I asked you Q, would you say ja?") — forces a liar's double negation to cancel out, so both a truth-teller and a liar report the same underlying fact; only the random answerer remains unpredictable, and isolating that unpredictability is what lets three questions fully identify all three gods.

Related concepts

Practice in interviews

Further reading

  • Boolos, 'The Hardest Logic Puzzle Ever', Harvard Review of Philosophy, 1996
ShareTwitterLinkedIn