Skip to content
Neuropsych

Can you solve what an MIT professor once called ‘the hardest logic puzzle ever’?

Logic puzzles can teach reasoning in a fun way that doesn’t feel like work.

Credit: Shutterstock

Key Takeaways
  • Logician Raymond Smullyan devised tons of logic puzzles, but one was declared by another philosopher to be the hardest of all time.
  • The problem, also known as the Three Gods Problem, is solvable, even if it doesn’t seem to be.
  • It depends on using complex questions to assure that any answer given is useful.
Sign up for the Smarter Faster newsletter
A weekly newsletter featuring the biggest ideas from the smartest people

Despite the general dislike of mathematics that most profess to have, many people enjoy logic puzzles. This is strange, as many logic puzzles are just variations of math problems. Gleefully ignorant of this fact, many mathaphobes will try to solve riddles and puzzles of tremendous difficulty using reasoning tools they fear to employ when the subject is an equation.

Today, we’ll look at a puzzle, the polymath who devised it, and why you should consider picking up a book of logical puzzles next time you are at the library.

This puzzle was written by the brilliant logician Raymond Smullyan. Born in New York 101 years ago, Smullyan earned his undergraduate degree at the University of Chicago and his doctorate in mathematics at Princeton, where he also taught for a few years.

An extremely prolific writer, he published several books on logic puzzles for popular consumption and an endless stream of textbooks and essays for an academic audience on logic. His puzzle books are well regarded for introducing people to complex philosophical ideas, such as Gödel’s incompleteness theorems, in a fun and non-technical way.

Skilled in close-up magic, Smullyan once worked as a professional magician. He was also an accomplished pianist and an amateur astronomer who built his own telescope. Besides his interest in logic, he also admired Taoist philosophy and published a book on it for a general audience.

He also found the time to appear on Johnny Carson, where, as in many of his books, he argued that people who like his puzzles claim to dislike math only because they don’t realize that they are one and the same.

One of the more popular wordings of the problem, which MIT logic professor George Boolos said was the hardest ever, is:

“Three gods A, B, and C are called, in no particular order, True, False, and Random. True always speaks truly, False always speaks falsely, but whether Random speaks truly or falsely is a completely random matter. Your task is to determine the identities of A, B, and C by asking three yes-no questions; each question must be put to exactly one god. The gods understand English, but will answer all questions in their own language, in which the words for yes and no are da and ja, in some order. You do not know which word means which.”

Boolos adds that you are allowed to ask a particular god more than one question and that Random switches between answering as if they are a truth-teller or a liar, not merely between answering “da” and “ja.”

Give yourself a minute to ponder this; we’ll look at a few answers below. Ready? Okay.

George Boolos’ solution focuses on finding either True or False through complex questions.

In logic, there is a commonly used function often written as “iff,” which means “if, and only if.” It would be used to say something like “The sky is blue if and only if Des Moines is in Iowa.” It is a powerful tool, as it gives a true statement only when both of its components are true or both are false. If one is true and the other is false, you have a false statement.

So, if you make a statement such as “the moon is made of Gorgonzola if, and only if, Rome is in Russia,” then you have made a true statement, as both parts of it are false. The statement “The moon has no air if, and only if, Rome is in Italy,” is also true, as both parts of it are true. However, “The moon is made of Gorgonzola if, and only if, Albany is the capitol of New York,” is false, because one of the parts of that statement is true, and the other part is not (The fact that these items don’t rely on each other is immaterial for now).

In this puzzle, iff can be used here to control for the unknown value of “da” and “ja.” As the answers we get can be compared with what we know they would be if the parts of our question are all true, all false, or if they differ.

Boolos would have us begin by asking god A, “Does “da” mean yes if and only if you are True if and only if B is Random?” No matter what A says, the answer you get is extremely useful. As he explains:

“If A is True or False and you get the answer da, then as we have seen, B is Random, and therefore C is either True or False; but if A is True or False and you get the answer ja, then B is not Random, therefore B is either True or False… if A is Random and you get the answer da, C is not Random (neither is B, but that’s irrelevant), and therefore C is either True or False; and if A is Random…and you get the answer ja, B is not random (neither is C, irrelevantly), and therefore B is either True or False.”

No matter which god A is, an answer of “da” assures that C isn’t Random, and a response of “ja” means the same for B.

From here, it is a simple matter of asking whichever one you know isn’t Random questions to determine if they are telling the truth, and then one on who the last god is. Boolos suggests starting with “Does da mean yes if, and only if, Rome is in Italy?” Since one part of this is accurate, we know that True will say “da,” and False will say “ja,” if faced with this question.

After that, you can ask the same god something like, “Does da mean yes if, and only if, A is Random?” and know exactly who is who by how they answer and the process of elimination.

If you’re confused about how this works, try going over it again slowly. Remember that the essential parts are knowing what the answer will be if two positives or two negatives always come out as a positive and that two of the gods can be relied on to act consistently.

Smullyan wrote several books with other logic puzzles in them. If you liked this one and would like to learn more about the philosophical issues they investigate, or perhaps if you’d like to try a few that are a little easier to solve, you should consider reading them. A few of his puzzles can be found with explanations in this interactive.

Sign up for the Smarter Faster newsletter
A weekly newsletter featuring the biggest ideas from the smartest people

Related