95
$\begingroup$

You are a prisoner in a room with 2 doors and 2 guards. One of the doors will guide you to freedom and behind the other is a hangman --you don't know which is which.

One of the guards always tells the truth and the other always lies. You don't know which one is the truth-teller or the liar either.

You have to choose and open one of these doors, but you can only ask a single question to one of the guards.

What do you ask so you can pick the door to freedom?

$\endgroup$
  • 5
    $\begingroup$ Links to Wikipedia and TVTropes pages for this classic old puzzle. $\endgroup$ – Trevor Powell Mar 12 '15 at 11:29
  • 26
    $\begingroup$ And the obligatory XKCD link. $\endgroup$ – Trevor Powell Mar 12 '15 at 13:13
  • 3
    $\begingroup$ Why not just ask them something you know the answer to, like are you a guard? and then just listen to the one who says yes. $\endgroup$ – Ali Habibzadeh Apr 18 '15 at 9:43
  • 11
    $\begingroup$ @XGreen Because then you've used your one question and don't have any information about which door to take. $\endgroup$ – Kevin Stricker Jun 9 '15 at 5:50
  • 2
    $\begingroup$ This reminded me an old episode of Yu-Gi-Oh!, with Yûgi and Joey against the Paradox twin brothers ! $\endgroup$ – Mayo May 23 '16 at 14:37

16 Answers 16

101
$\begingroup$

If I asked what door would lead to freedom, what door would the other guard point to?

If you asked the truth-guard, the truth-guard would tell you that the liar-guard would point to the door that leads to death.

If you asked the liar-guard, the liar-guard would tell you that the truth-guard would point to the door that leads to death.

Therefore, no matter who you ask, the guards tell you which door leads to death, and therefore you can pick the other door.

$\endgroup$
  • 12
    $\begingroup$ This assumes that the liar guard will only tell a lie. (As opposed to trying to deceive you.) There is more to lying than words - there is body language. $\endgroup$ – Mayo May 5 '15 at 18:56
  • 25
    $\begingroup$ @Mayo It's a logic puzzle, though, not one of human interaction. $\endgroup$ – Aza May 5 '15 at 19:53
  • 2
    $\begingroup$ Yes. I forgot my :-) I've been thinking about questions like this along the line of a prisoner's dilemma and not only as a matter of a logic puzzle. $\endgroup$ – Mayo May 5 '15 at 20:06
  • 2
    $\begingroup$ @Mayo That makes sense! No worries :] $\endgroup$ – Aza May 5 '15 at 20:13
  • 6
    $\begingroup$ Note to self - if this answer is confusing, focus only on the latter clause which is simple to understand and the only key to the problem, i.e. What door would the other guard point to? (if you asked him where the treasure is). The reason this works is because the answer reveals the integrity of BOTH guards. $\endgroup$ – Sridhar Sarnobat Aug 13 '15 at 20:20
48
$\begingroup$

Choose a guard and ask him,

"If I asked you 'are you standing in front of the freedom door?', would your reply be 'yes'?"

  • If you choose the truthful guard, he will give you an honest answer. Enter his door if he says "yes" and enter the other door otherwise.
  • If you choose the liar, he will lie about what his reply would be. Since that reply is also a lie, the two lies cancel out. Enter his door if he says "yes" and enter the other door otherwise.
$\endgroup$
  • 9
    $\begingroup$ I think there was no information about where the guards stand. But that was a brilliant idea :-) $\endgroup$ – Rafe Sep 3 '14 at 5:21
  • 9
    $\begingroup$ That's true. But any question that distinguishes between the doors would work as the "inner" question. For example, 'is the door on the left the freedom door?' $\endgroup$ – Kevin Sep 3 '14 at 11:54
  • 6
    $\begingroup$ @TanSiongZhe, How so? Looks like a 100% chance to me. 1. If you ask the honest guard and he says "yes", you pass through his door safely. 2. If you ask the honest guard and he says "no", you pass through the other door safely. 3. If you ask the liar guard and he says "yes", you pass through his door safely. 4. If you ask the liar guard and he says "no", you pass through the other door safely. Where's the danger? $\endgroup$ – Kevin Oct 23 '14 at 12:03
  • 8
    $\begingroup$ The goal is not to find out which guard is truthful. The goal is to find the correct door. None of the other answers determine the identity of the guards either. $\endgroup$ – Kevin Oct 24 '14 at 12:04
  • 3
    $\begingroup$ I like @Emrakul's answer slightly more, because in real life, the lying guard will just want you to have fake information, and he won't care about "double negation" from his own answer. He will just tell you something so that you have fake information $\endgroup$ – nopole May 30 '15 at 19:27
35
+50
$\begingroup$

Here is a twisted solution.

Go to any guard, point at a door and ask:
Among the propositions 1. "You are a liar", 2. "You will reply negatively" and 3. "This door leads to freedom", is there an odd number of true propositions?

If you get the answer yes:
If the guard is a truthteller, the number of truths is odd, 1. is false, 2. is false, so 3. must be true.
If the guard is a liar, the number of truths is even, 1. is true, 2. is false, so 3. must be true.

If you get a negative answer:
If the guard is a truthteller, the number of truths is even, 1. is false, 2. is true, so 3. must be true.
If the guard is a liar, the number of truths is odd, 1. is true, 2. is true, so 3. must be true.

So regardless of the answer of the guard, the door you pointed at is the door to freedom, you can leave safely.


Note: Before you argue about this solution, please read the following:
Logic explanation in "two doors" answer

$\endgroup$
  • 5
    $\begingroup$ What happens if you point to the door to death? $\endgroup$ – Rob Watts Sep 20 '14 at 18:57
  • 3
    $\begingroup$ Logic tells that doesn't happen. [smiley] $\endgroup$ – Florian F Sep 20 '14 at 21:45
  • 3
    $\begingroup$ Fantastic! This "twisted" solution of yours was truly a nice way to solve problems like this. Somehow removed the limit of questions $\endgroup$ – Rafe Jan 15 '15 at 19:19
  • 2
    $\begingroup$ This answer appears to be incorrect. The reasons have been stated in this question $\endgroup$ – March Ho Jan 19 '15 at 13:31
  • 2
    $\begingroup$ I know :-). If you point at the right door it works fine. If you point at the wrong door it results in a paradox as wnen one says "I am lying". It always brings a contradiction. That is why only the 1st possibility looks valid. $\endgroup$ – Florian F Jan 19 '15 at 14:02
34
$\begingroup$

This is a classic old chestnut of a puzzle, and we've had several responses giving the traditional answer to the puzzle. As a bit of spice, here's a slightly lateral-thinking answer, which lets us figure out not only which door is which, but also which guard is which, all using a single question.

We're going to be using a timing attack. Here's how it works.

Ask one of the guards:

"If I was to ask you what you'd say if I asked you what you'd say if I asked you what you'd say if I asked you what you'd say if I asked you what you'd say... (repeat any sufficiently large number of times, remembering to occasionally stop to draw a fresh lungful of air so that you don't faint) ...if I asked you whether this was the door to freedom, then what would you say your answer would be?"

The truth-telling guard will be able to answer this right away. No matter how many nested self-referential clauses you put into that question, she doesn't need to remember them or count them, and it always remains a trivial question to which she can always instantly give a truthful answer.

It's a much harder problem for the lying guard, who will need to think for a short time as she double-checks her answer, and may even have to ask you to repeat the question, just to make sure she correctly counted the number of recursive lies she's supposed to be telling, in order to give you the correct "always lies" answer. Her answer will necessarily be delayed, compared against the truth-teller's answer, because the question is designed to be much more difficult to determine the answer, for someone who is required to tell falsehoods.

Thus, simply by checking whether the answer is instantaneous or not, you can tell whether the guard is a truth-teller or a liar (respectively), and therefore select a door according to the answer that the guard gave you, and whether that guard is the truth-teller or the liar.

$\endgroup$
  • 1
    $\begingroup$ It isn't that hard for the liar, he just has to count the the number of nested clauses. If even, he answers the correct door, else he points to the wrong one. $\endgroup$ – Rohcana Aug 19 '15 at 18:05
  • 10
    $\begingroup$ I'm afraid that if I was the truth telling guard, I'd still have to have a bit of a think before I'd answer that :) $\endgroup$ – Michał T Jan 23 '16 at 23:57
  • 1
    $\begingroup$ What if the liar guard is either a logical machine or omniscient and answers the question instantaneously? It takes a computer only a fraction of a second to evaluate the answer to !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!false (which is true, by the way). $\endgroup$ – Braden Best May 24 '17 at 2:18
  • 1
    $\begingroup$ @BradenBest "What if" is a game for scholars. $\endgroup$ – Trevor Powell May 26 '17 at 0:16
  • 1
    $\begingroup$ Similar caveat to the one in Florian's answer. Even if the guard can answer immediately, it may possibly not. $\endgroup$ – Egor Hans Sep 15 '18 at 20:36
20
$\begingroup$

My answer, assuming I ask one question only...

Is the liar in front of the death door (DD)?

A. (if the Truth guard is asked) If the Truth guy is in front of DD, he answers NO. If not, he answers YES.

B. (if the Liar guard is asked) If the Liar is in front of DD, he answers NO. If not, he answers YES.

Either way, if we get a NO, then we've asked the guard in front of the death door, so we go to the opposite door. If we get a YES, then we've asked the guard not in front of the death door, so we go to the door behind them.

Thank you, I am here all week ;)

$\endgroup$
10
$\begingroup$

EDIT: As @Ben mentioned, this answer is not really matching the tag. Sorry.

If the guards are...

stupid polite

you can

ask one to open a door

so you

didn't open a door (yet)

but

you see what's behind the door the guard opened

and

you can choose the right one (freedom, probably).

This doesn't even use the "truth-telling, lying" fact.

This only works if

  • The guards do what you say.

  • You can see freedom / the hangman when the door is open.

$\endgroup$
  • 4
    $\begingroup$ The OP set a tag called logic-puzzle. This is not a logical answer as you are locked up and they are guarding you from escaping. Please respect the question. (Sorry for being a bit harsh :-)). DISCLAIMER - THIS IS A SUBJECTIVE OPINION OF MINE $\endgroup$ – Ben Jun 14 '16 at 15:36
  • $\begingroup$ @Ben I'm sorry, I just thing lateral. lateral-thinking anywhere. Perhaps this is a problem of mine. $\endgroup$ – palsch Jun 14 '16 at 15:38
  • $\begingroup$ fair enough :-) no worries $\endgroup$ – Ben Jun 14 '16 at 15:39
  • $\begingroup$ Interesting idea, but how would you ask them? You: "Could you please open door 1?" Guard: Yes. (And stays standing there because while he can open the door, he won't.) $\endgroup$ – user1361991 Jun 14 '16 at 16:31
  • 4
    $\begingroup$ @palsch Hmmm along that line of thinking: "Would you be a good chap and fetch the hangman for me?" should get the guard off in the right direction ;). $\endgroup$ – user1361991 Jun 14 '16 at 17:43
5
$\begingroup$

You ask:

Would the other guard say your door is the door to freedom? If either guard is guarding the door to freedom both would answer NO. If either guard is guarding the door to death both would answer YES. NO leads to freedom and YES leads to death. I don't think there is one question whose answer would indicate which guard is guarding which door and which door leads to freedom.

$\endgroup$
4
$\begingroup$

I am a newbie to Stack-Exchange and if my answer violates some guidelines , please correct me .

Let us assume , WLOG that the right door leads to freedom . So , the question I would ask is :

If I were to ask you whether the right door leads to freedom , would you answer yes?

The honest person would answer YES

The liar's internal response would be to say NO but being the liar he is , he would
say YES (due to double negation)

I think this would help you ascertain as to which is the truth-teller and which is the liar

$\endgroup$
  • 2
    $\begingroup$ This answer is identical to (or at best a rehash of) Kevin's answer. $\endgroup$ – March Ho Dec 30 '14 at 11:34
  • 1
    $\begingroup$ @MarchHo Well, some people tend to not check whether their answer is already there, in order to avoid spoilers. Chances are both had the same idea independently that way. $\endgroup$ – Egor Hans Sep 15 '18 at 20:32
  • $\begingroup$ Would, "If I were to ask you if the wrong door leads to the hangman, would you answer no?", also do? $\endgroup$ – Martin Rattigan Feb 27 at 23:57
4
$\begingroup$

I'd like to add an explanation for the answer of Florian F:

If we look at it from the other side, the possibilities are the following:

  1. The door is correct and the guard tells the truth: Then 1 is false, 3 is true, 2 depends on how the guide answers the whole (true if no, false if yes), which fits in both cases (011= no, 001 = yes) => the guard can answer in any way and will pick one answer.
  2. The door is correct and the guard lies: Then 1 is true, 3 is true, 2 is same as above, which in both cases is a lie (111=no=>yes, 101=yes=>no) => the guard can answer in any way and will pick one answer.
  3. The door is not correct and the guard tells the truth: Then 1 is false, 3 is false, 2 is same again, but this time it does not fit (010=yes >< 2 true, 000=no >< 2 false) => the guard cannot answer.
  4. The door is not correct and the guard lies: Then 1 is true, 3 is false, 2 is same again, but this time it's the truth (110=no=>yes -- 2 false, 100=yes=>no -- 2 true) => the guard cannot answer.

Thus, the reasoning is: If the guard can answer then you pointed at the freedom door, if it cannot answer you pointed at the death door.

However, this has one big danger, similar to the Halting Problem: You have no idea whether the guard really cannot answer, or if it's merely thinking about the decision yet what answer to pick, which may take quite a time! And additionally, every answer is assuming that if the guard answers, it answers as soon as it can. While for most answers this is not very relevant, for this answer a negation of this assumption would be fatal!

To illustrate this problem, the following example: Imagine you ask a guard the question Florian proposed. You wait, and wait, and wait. After a long time you decide that the guard doesn't answer because it can't. You then go to the door you didn't point at, and right when you just pushed down the handle, you hear the guard answering.

It was at this moment that Florian knew: He fucked up.

$\endgroup$
  • $\begingroup$ If, however, there's a way to rather safely tell the guard cannot answer, then you're fine. $\endgroup$ – Egor Hans Sep 15 '18 at 20:54
2
$\begingroup$

Emrakul provided the only answer that is close to the way I would explain this riddle solution. Others are violating one or more the original premise or just off base in general. Especially Kevin and Rafe which obviously just convinced themselves 50-50 was ok, LOL, which guard is the honest one and which is the liar is obviously not something you know, it says right in the riddle explanation, but your answer depends on it. I'm really scratching my head and wish you two the best.

The answer, same concept as Emrakul, in other words: Go to either guard. Ask that guard, "Which door would the other guard say is the safe route". This answer, regardless of which guard you ask will allow you to choose the door opposite of either guard's answer and always lead you safely. -1 x -1 = 1 MGO

$\endgroup$
  • $\begingroup$ That is not correct. The first answer you call incorrect says "If you choose the truthful one" and "If you choose the lying one," but it doesn't mean you need to know, it's just an explanation of what happens in each case. In both cases, you respond the same to the answer. So that answer also works regardless of which guard you ask. $\endgroup$ – Loduwijk Oct 8 at 18:05
2
$\begingroup$

As with all such questions you could try:

If the question Q (in this case, "Is this the dodgy door") were to be answered with the same truth or falsehood as you are about to answer this question, would the answer be "yes" (or maybe "pish" if you can remember that this is a native word for "yes" or "no" without exactly recalling which)?

If he answers "yes" (or "pish") then it is the dodgy door irrespective of whether he's a truth teller, a liar, a take your pick, or whether he actually knows the answer (and, where applicable, whether "pish" means yes or no). If he answers no (or "tush") then it isn't.

$\endgroup$
  • $\begingroup$ This solution is actually surprisingly hard to analyze.. $\endgroup$ – Egor Hans Sep 15 '18 at 20:28
1
$\begingroup$

Even though the most common answer has been posted I would like to add an answer that a friend of mine gave me when I asked him this question. I had never heard this answer before and this is why I would like to share it.

If you ask any guard, "is the truth telling guard standing in front of the door that leads to freedom?", if he says no you always go to the opposite door. If he says yes you simply go through that door.

The mechanics are more or less the same in this answer but for some reason it took me a long time to convince myself it worked every time.

$\endgroup$
  • $\begingroup$ Ask the lieing guard that question, s/he will say no if the truth telling guard is in front of the door to freedom, taking the opposite door means you die. However which door the guard was referring to? $\endgroup$ – Matt Stevens Feb 10 '18 at 11:22
  • 1
    $\begingroup$ @MattStevens The answer actually does make sense. What you probably overlooked is that if you ask the liar, you refer to the door he's not standing in front of. That means that it fits: First, let's look at the scenario that you ask the guy in front of the freedom door. If you ask the truth-teller, the door behind him is the freedom door, and he says yes. If you ask the liar, the door behind him is the freedom door, so the door behind the other one (the truth-teller!) is death, which the liar negates to yes. Similar for the guard at the death door, who always says no. $\endgroup$ – Egor Hans Jun 26 '18 at 13:01
1
$\begingroup$

The trick to this question is:

one guard is a NOT gate (the liar - L), and the other is just a straight-forward wire (the truth teller - T). The question is either an on or off pulse, and the answer is also an on or off pulse (which we interpret as pointing to a door).

So:

If we ask TL with an ON pulse (which door is the Freedom door), ON$\to$ON$\to$OFF. And if we ask LT with an ON pulse: ON$\to$OFF$\to$OFF. So they both point to the death door.

$\endgroup$
0
$\begingroup$

Update: My answer is wrong.

If anyone gets confused like I did, please see the comments for a reminder.

(original)

All of the answers are incorrect, and the puzzle itself flawed.

To reiterate the (overlooked) requirements:

  • "... you can only ask a single question from one of the guards", and;
  • "One of the guards always tells the truth and the other always lies. You don't know which one is [which]."

These rules create a situation where there is no method for discerning one guards' honesty from the other, and thus which door leads to freedom.

It's best explained as, "take my word for it*.


Edit - For Example, you ...

  • Ask Guard-A : "Do you guard the door to Freedom?" |OR| "Does Guard-B guard the door to freedom?"
  • Guard-A replies: "Yes"

50% - Guard-A is lying, you die. 50% - Guard-A is honest, you live.

$\endgroup$
  • 3
    $\begingroup$ You don't have to discern the guards - you have to discern the doors. If you try all possible situations with the top two answers, you'll see you'll always pick the right door. Both ask one question from one guard who may or may not be the truthteller. $\endgroup$ – EagleV_Attnam Nov 14 '14 at 10:26
  • $\begingroup$ The answers are misleading because they immediately state "The honest-guard .. blah". How can you possible know which guard is which without asking both. See? Otherwise, just ask the honest guard and be done with the puzzle... $\endgroup$ – Koffy Nov 14 '14 at 11:52
  • 5
    $\begingroup$ @Koffy no, they start "If you asked the truth-guard," and go on to say "If you asked the liar-guard," thus demonstrating that you can safely act on the answer no matter which guard you happen to ask. $\endgroup$ – Kate Gregory Nov 14 '14 at 13:09
  • 2
    $\begingroup$ I can see my error now, thanks. I was never properly separating the 'defined behavior' from 'perceived behavior'. All in my head, the liar-guard would break behavior to .. achieve confusion. I even drew it on paper! I won't change my answer, but will add a note :) ty $\endgroup$ – Koffy Nov 14 '14 at 15:16
0
$\begingroup$

It's common that you might find some difference in 2 doors.Let assume the colors of door are different,for say red & green. So the prisoner chooses one door with a color red(for say) and asks this question to one of the guards. "Is this blue door the road to my freedom". If he asks this question to the truth speaking guard he will correct the prisoner over the color of the gate and will tell the true answer. Instead if he asks to the false speaking guard he will not rectify his false statement over color of the door and so he will tell his wrong answer.

Difference in color is mere an assumption,some other difference in gates could also be used in the question.

$\endgroup$
  • 2
    $\begingroup$ what if the guard doesn't say anything about correctness of your question, and answers like this: "the door that you are pointing will lead you to freedom"? $\endgroup$ – Rafe Jul 23 '16 at 6:18
-2
$\begingroup$

The answer to this riddle is to merely pose an single interogative that completes a simple alternating composite of positive and negative interdependent propositions. By stringing the propositions you can determine the door to freedom by posing the question so that the answer successfully or unsuccessfully completes the alternating polarity. Regardless of how you pose the question the polarity must alternate [negative, positive, negative with the answer providing the last swing back to positive] or [positive, negative, positive with the answer providing the last swing back to negative] to be successful. If and when it does not alternate, that will indicate the required action just as definitively as when and if it does successfully alternate. Below, I will pose the question with the corresponding polarity; keep in mind that your question can utilize either door and either guard; to wit: - Would you be telling the truth [positive], if you said that he would be lying [negative], if he said that this door is the door to freedom [positive]? Notice, [positive, negative, positive]. If the guard you directed the question to answers "NO" [negative], you have completed the correct alternating polarity, [positive, negative, positive,negative] and the door to freedom is the door you did not point out.
or you could ask it in the opposite fashion; to wit: - Would you be lying [negative], if you said that he was telling the truth [positive], if he said that this is the door to certain death [negative]? Notice [Negative, positive, negative]. If he answers Yes [positive], you have again completed the alternating polarity correctly and your door to freedom is the one you pointed out. [Negative, Positive, Negative, Positive]. In either case, if the polarity does not correctly alternate, you should proceed as indicated from the context of your interrogative. Simple

$\endgroup$
  • 4
    $\begingroup$ Welcome to puzzling.SE. "Everything should be made as simple as possible, but not simpler." - Albert Einstein $\endgroup$ – ABcDexter Jun 14 '16 at 15:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.