The Two Guards Riddle: A Couple of Insights

Remember that riddle with the two doors and the two guards, where one always lies and one always tells the truth? I was reminded of it when it came up in a podcast recently. After some thought, I had a couple of insights.

Just to recap, the riddle goes like this.

You are trapped in a room with two exits. One leads out to freedom, while the other leads to certain death. You can't tell the difference without taking the risk and stepping through a door. There are two guards in the room with you. These guards will happily let you step through a door. They have a peculiar quirk: one guard always lies, while the other always tells the truth, but again you don't know which is which. They know which door leads out and which leads to death. You can ask ONE of the guards ONE yes-or-no question. Your goal, of course, is to use that one question to determine which door you should pass through and avoid certain death.
An example question that would not work: "Does the left door lead to death?" The guard will answer you, but you can't tell if they are telling the truth or not. Your question has been wasted. Another bad question would be asking the guard something with an obvious answer, the goal being to discover if he is the liar (e.g. "Are you a guard?"). This will reveal who is the liar and who is not, but now you've spent your question and still know nothing about the doors. Hopefully you have a handle on the flavor of this riddle.

 The standard solution is to ask "Would the other guard tell me the left door is dangerous?" If he says yes, the left door leads to safety. Otherwise, the right door does. If you haven't heard this before, take a second to think through why this is true. It's pretty clever.

Now for the insights. I hope you find them as interesting as I did.

1: Spot the Liar or Leave. You Can't Do Both.

I think most people come at this for the first time by trying to ask a tricky question that would both ask the guard which door is safe and simultaneously determine if that guard is the liar. An interesting feature of the standard solution is that when you're done, you still don't know which guard was the liar. This is actually a necessary consequence of asking the right question.

We can see this from an information standpoint. There are four possibilities that we are trying to sort out as the prisoner. Either guard could be the liar and either door could be the right one, which makes four possible combinations. To find out which of those four situations you are in, you're going to need two bits of information. No way around that. However, if you ask a yes or no question, you're going to get a single bit in response. You will never be able to both get the correct door and determine which guard is the liar. You've gotta pick one or the other, and the point of the riddle is that you get the former.

2: Another Solution that Sounds Less Tricky

The standard solution is a bit complicated and would fail what I'll call the XKCD rule: https://xkcd.com/246/

A much simpler solution is this: "If I asked you if your door was the correct one, what would you say?" It's subtle because in everyday conversation, we would probably parse this as essentially asking "Which door is the correct one?" But it is not the same. The truthful guard will just tell you the truth. Nothing complicated there. But the lying guard has to think about it. He knows that if you asked him directly, he would lie. So to answer your question, he has to lie about that too and ends up telling you the truth about the door. He basically ends up telling two lies that cancel each other out. In either case, the guard will point you to the correct door and you are free to leave. Note that, in line with the earlier insight, you still don't know which guard was the liar once you're done.

A neat feature of this solution is that, while the standard solution requires two guards, this solution only needs the one. It would apply just as well to a similar riddle where there is only one guard who you are told either always lies or always tells the truth.

Comments

Popular posts from this blog

Fight Functors with Fire

The Logarithmic Black Sheep

"Why Do I Need Complex Numbers?"