The hardest logic puzzle ever: the solution

The answer to Tuesday’s puzzle, then. Remember that the puzzle is:

There are three guardians, A, B and C. Their names are Knight, Knave and Chaos. Knight always speaks truly, Knave always lies. Chaos tossed a coin this morning to decide whether today he would behave like Knight or like Knave.
Your task is simple: ask three yes-no questions, each of a single guardian, and determine which is Knight, which is Knave, and which is Chaos. There is, alas, a complication: the guardians understand English but will answer in the local language, in which “Da” means yes and “Ja” means no. Or possibly “Ja” means yes and “Da” means no – you cannot remember.

Yesterday I gave you a hint:
For any yes/no question, Q, you can ask any guardian this question:

“If I asked you Q in your current mental state, would you say ‘ja’?”

And you’ll get the answer “ja” if and only if the truthful answer to Q is yes. This is true whether you ask the question of Knight, Knave or Chaos.

The answer follows:

Ask Guardian A, “If I asked you, “Are you Chaos?” in your current mental state, would you say “ja”?”
If A answers “ja”, he’s Chaos. Then ask Guardian B, “If I asked you, “Are you Knight?”, would you say “ja”?”. The answer is “ja” if B is Knight, and either way the problem is now solved.

If A answers “da”, he’s either Knight or Knave. So ask him instead, “If I asked you, “Are you Knight?”, would you say “ja”?” If the answer is “ja” he’s Knight; otherwise he is Knave.
So, now, ask him “If I asked you, “Is guardian B Chaos”, would you say “ja”?” If he answers “ja”, B is Chaos, and C is the opposite of A. If he answers “da” then C is Chaos and B is the opposite of A.

Wikipedia has more, much more, and of course the puzzle is no longer the hardest logic puzzle ever

The Undercover Economist: a guide

Publishing schedule: Excerpts from "The Undercover Economist" and "Dear Economist", Tim's weekly columns for the FT Magazine, are published on this blog on Saturday mornings.
More about Tim: Tim also writes editorials for the FT, presents Radio 4's More or Less and is the author of "The Undercover Economist" and "The Logic of Life".
Comment: To comment, please register with FT.com, which you can do for free here. Please also read our comments policy here.
Contact: Tim's contact address is: economist@ft.com
Time: UK time is shown on posts.
Follow: A link to the blog's RSS feeds is at the top of the page.
Follow on Twitter
FT blogs: See the full range of the FT's blogs here.