# Find the correct door!

This is my first puzzle but I hope it will work out well and that everyone can enjoy it.

While trying to get out of a dungeon, you arrive in a circular room with 5 doors at equal distances from each other. The doors are all locked, but fortunately, there is a nice guard in front of each door willing to unlock their door for you if you just ask them nicely. The problem is that only 1 of these doors is the exit while the others will send you to your certain death.

The guards are all knowing and willing to answer any questions you might ask by "yes" or "no".
Unfortunately the guards are very impatient and will only allow you to ask 4 things in total and your questions may not include multiple or conditional statements. Keep it short and sweet.

Oh yeah, one more thing, one of them always lies.

Is there a fail proof way to find the good door? If so say how you would proceed.
If not, explain why.

HINT

Read carefully what was asked of you from this puzzle.
Success can sometime be found in failure.

CONGRATULATION to Geliormth for finding the exact answer I was looking for and apologize for any mistakes or badly explained details there might have been withing my puzzle.

Please leave me comments on how you liked my puzzle and its "twists". If the twists and/or the answer were more irritating than fun, I will try to improve on that next time.

• One always lies - the others? (always tell the truth, or we don't know at all?) – Jonathan Allan Oct 6 '16 at 8:01
• The others always tell the truth. – stack reader Oct 6 '16 at 8:02
• When you "ask them nicely" to unlock their door, does that count as a question? I assume not. – Rubio Oct 6 '16 at 8:05
• @Sean there is a difference between asking a question and asking a favor. I'm sorry if it was not totally clear but i did write that they will open the door if you ask them. An action is required of them, not an answer. – stack reader Oct 6 '16 at 9:40
• How did I enter the room? It must have five doors and a passage? Six total entrances? – abbaf33f Oct 6 '16 at 17:21

For clarification, I'll repeat the exact formulation of the question asked here:

Is there a fail proof way to find the good door? If so say how you would proceed. If not, explain why.

After reading the hint I came to the following conclusion: yes, there is a fail proof way to find the good door. (multiple solutions for this are given already, my solution looks like the one given by ffao)

But as stack reader pointed out to the ones finding the good door they were still stuck inside the room. So then the answer would be: no, there is no fail proof way to find the good door and open it.

As the valid questions can only halve the numer of options we need 3 questions to find the good door out of the 5 possible doors. But in order to know what the answers we get (yes/no) actually means we need one more question to make sure we know wether the guard we are questioning is telling the truth or telling lies. (ask a guard if the guard next to him tells the truth: yes -> both tell the truth, no -> one of them lies).

This means that we need 4 questions in total to find the good door but we need a 5th question to ask the guard to open that door.

• You not only given me the answer i wanted in almost the exact words i was hoping for, but also found a mistake within my question for which i apologize. I did mean to ask a "fail proof way to leave the room safely". – stack reader Oct 6 '16 at 10:55
• The proof only works if we accept that there is no question such that it can extract a true answer from a liar; it is harder to prove that the conditions make such a question impossible… – Arkku Oct 6 '16 at 11:08
• @Arkku, he did that by stating that you can not ask conditional questions, which would be the trick to always get a honest answer without knowing if the one you question speaks the truth or not. – Hans Janssen Oct 6 '16 at 11:26
• @stackreader (and Geliomorph) this proof is not convincing. It would work if the question was "identify which is the correct door and which guard is telling the truth." Then there are 5*2 = 10 possibilities and we 3 questions is not enough. But there might still be a way to find the right door without finding out which guard is the liar, in 3 questions or less... – Nathaniel Oct 6 '16 at 13:51
• "your questions may not include multiple or conditional statements. Keep it short and sweet." is not by any means a formal criterion, but it tells you what you need to know- roughly "if a person that would work as a guard needs to think more than a second or two about the answer, it's too complicated for this puzzle" ("... also, conditionals are explicitly verbotten!"). – mr23ceec Oct 6 '16 at 14:02

Let's number the guards from 1 to 5, and the doors as well (I'll be assuming the guards know which door is which, but if they don't you can point when asking the question, or something like that). For the first question:

Ask guard 1: Is guard 2 a liar?

If he answers "yes", either 1 or 2 lies, so 3 tells the truth. If he says "no", then 1 must be a truthteller.

For the next questions:

You know a truthful guard, so go to him and ask:

Is the correct door 1, 2 or 3?
Is the correct door (two of the remaining doors)?
Is the correct door (one of the remaining doors)?

Each question eliminates half the possibilities, so this would work even if we had 8 doors.

• I like your first question, +1 for you. You found the correct door! And yet, you were still stuck in the room. What might have gone wrong!? – stack reader Oct 6 '16 at 8:23
• +1. Almost there, I think. You need one more question to ask the corresponding guard to open the door. So essentially you only have 3 questions at your disposal. (is this correct, @stackreader ?) – justhalf Oct 6 '16 at 9:44
• Excuse me, but it seems like conditional structure in questions was forbidden ? Is it right to ask if door 1, 2 OR 3 is the exit ? – Alex Oct 7 '16 at 9:23

I think this is a lot simpler than it may appear...

Choose a single guard and ask them "Is that the exit" about three of the doors.

If you picked the liar they will say "yes" either two or three times.
If you picked a truth teller they will say "no" either two or three times.

If you get two or three "yes" responses, ask another guard "please open the door to the exit"
If you get two or three "no" responses, ask the same guard "please open the door to the exit"

• Nice one, +1 for you. You found the correct door! And yet, you were still stuck in the room. What might have gone wrong!? – stack reader Oct 6 '16 at 8:23
• How is that edit? – Jonathan Allan Oct 6 '16 at 8:29
• Oh - just noticed "willing to open their door"... hmm – Jonathan Allan Oct 6 '16 at 8:34
• That was quite clever! But as you noticed, they are only willing to open their own door. – stack reader Oct 6 '16 at 8:51

This is not the intended solution, but I think there is a way to circumvent the restrictions on the questions:

1) Ask a guard: Are you equally likely to tell the truth as I am to reach the exit by taking the door behind you?

If the exit is that door, the probabilities are the same if the guard always tells the truth and different if the guard always lies. So a truthteller will answer “yes”, and the liar will lie “yes”. If the exit is not that door, the probabilities are the same for a liar – who will lie "no" – and different for a truthteller, who will answer "no".

If the answer was “yes”, go to step 4. If the answer was “no”, move to the next guard clockwise.

2) Ask: Are you equally likely to tell the truth as I am to reach the exit by taking the door behind you or the one immediately clockwise of it?

Same rationale as before, the answer is truthful about either of the doors being the exit. The possible doors are now narrowed down to two. If the answer was “yes”, stay with this guard. Else move two guards clockwise.

3) Ask: Are you equally likely to tell the truth as I am to reach the exit by taking the door behind you?

If the answer was “yes”, stay with this guard. Else move to the next guard clockwise.

4) Ask: Would you please unlock the door behind you?

Exit through the door.

To be fair, one might argue that the questions used here could violate the no-multiple-statements -restriction, depending on how it is defined. As a counter-argument, I would say that it is asking about probabilities, not logical statements, but of course the author can define the rules to exclude any counter-argument. The point of this answer is not really to be correct in the first place, as it is already known that the intended solution is different, but rather to illustrate that…

…a puzzle where the intended solution is "there is no solution" is difficult to make, since it is hard to ensure the lack of a solution and to express the conditions in a way that both keeps the puzzle unsolvable but doesn't make it obviously so.

• Although it is not the answer the author was looking for I like it! I kind of gave up looking for a nice answer that gets you out of the cave after the hint made it quite obvious that the intended answer is that there was no way out... – Hans Janssen Oct 6 '16 at 12:28

I would ask the following questions:

First question to guard 1: "Would you please open your door for me?"

Since I asked nicely he will open his door and also tell me "Yes" or "No". Which tells me if he is the liar or not. If he is the liar I simply negate his next answer to get the correct one.

Second question to guard 1: "Is door 2 or 3 the correct door?"

Assuming this is true, otherwise swap 2 with 4 and 3 with 5 in the following statements.

Third question to guard 2: "Would you please open the correct door for me?"

Again I asked nicely, so if his door is the correct one, he will open it. I am not interested in his answer. If he opens his door, it is the correct door and I will leave through it. If not:

Fourth question to guard 3: "Would you please open the correct door for me?"

Again I am not interested in the answer. If he opens his door, I will leave though it, if he does not open the door, door 1 was the correct door all along and I leave through it.

• That was very smart! +1 for you. Unfortunately the "ask to open the door" request is just that, a request. It is not meant to be answered to. Sorry for the confusion. – stack reader Oct 6 '16 at 10:27
• Nice thinking! @stack reader: But does 'asking to open a door' being a request mean that this is not a question? In that case, can you ask 4 questions and then make a request? – Hans Janssen Oct 6 '16 at 10:31
• @stackreader If I would change the first question to also be "Would you please open the correct door for me?" and it would not be the correct door, would he then answer Yes/No or just do nothing? – w l Oct 6 '16 at 10:35
• 4 things may be asked of them. asking them to open their door is one, so is asking a question. When you ask them to open their own door, it is like an order. For example, you asked "would you", as one usually would to ask for a request. If it was a question, it would be more like "can you". Nonetheless, for the sake of this puzzle I would say that asking them to open the correct door rather than their own door would result in an answer rather than an action. If their own door is the correct one they will say yes but do nothing. I hope i managed to explain it properly. – stack reader Oct 6 '16 at 10:46

Perhaps a little too lateral thinking, but one thing I noticed:

We've arrived in this room with 5 doors, so we must have come from one of them, right? So we only have to consider the other 4.

We ask one guard:

Whether the first door leads to safety, then whether the second door leads to safety, then whether the third door leads to safety.

Then

If their answers are consistent, ask the fourth door's guard to open their door, as it is different from the other doors and only one leads to safety. If they answer differently for one door, ask that door's guard to open it, as it is different from the others and only one door leads to safety

• +1 As I like the lateral thinking, although to be fair, the entrance could be a hallway without a door, or a hatch in the ceiling. =) – Arkku Oct 6 '16 at 14:41

We can just ask one of the guard following questions and determine the correct door

Assume door1 is safe

Assume Guard1(G1) at Door1(D1) is lying(F) and others are telling the truth(T)

D -> Door, G -> Guard, T -> Tells truth, F-> Tells lies

F D1 G1 --> Is door1 safe? - No, Is door2 safe? - Yes, Is door3 safe? - Yes. We come to know that this guard is lying and can determine that door1 is safe
T D2 G2
T D3 G3
T D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - Yes, Is door2 safe? - No, Is door3 safe? - No. We come to know here that this guard is telling the truth and can determine that door1 is safe.
F D2 G2
T D3 G3
T D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - Yes, Is door2 safe? - No, Is door3 safe? - No. We come to know here that this guard is telling the truth and can determine that door1 is safe.
T D2 G2
F D3 G3
T D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - Yes, Is door2 safe? - No, Is door3 safe? - No. We come to know here that this guard is telling the truth and can determine that door1 is safe.
T D2 G2
T D3 G3
F D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - Yes, Is door2 safe? - No, Is door3 safe? - No. >!We come to know here that this guard is telling the truth and can determine that door1 is safe.
T D2 G2
T D3 G3
T D4 G4
F D5 G5
__

Assume door2 is safe
F D1 G1 --> Is door1 safe? - Yes, Is door2 safe? - No, Is door3 safe? - Yes. We come to know that this guard is lying and can determine that door2 is safe
T D2 G2
T D3 G3
T D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - No, Is door2 safe? - Yes, Is door3 safe? - No. We come to know here that this guard is telling the truth and can determine that door2 is safe.
F D2 G2
T D3 G3
T D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - No, Is door2 safe? - Yes, Is door3 safe? - No. We come to know here that this guard is telling the truth and can determine that door2 is safe.
T D2 G2
F D3 G3
T D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - No, Is door2 safe? - Yes, Is door3 safe? - No. We come to know here that this guard is telling the truth and can determine that door2 is safe.
T D2 G2
T D3 G3
F D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - No, Is door2 safe? - Yes, Is door3 safe? - No. We come to know here that this guard is telling the truth and can determine that door2 is safe.
T D2 G2
T D3 G3
T D4 G4
F D5 G5
__

Assume door3 is safe

F D1 G1 --> Is door1 safe? - Yes, Is door2 safe? - Yes, Is door3 safe? - No. We come to know that this guard is lying and can determine that door3 is safe T D2 G2
T D3 G3
T D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - No, Is door2 safe? - No, Is door3 safe? - Yes. We come to know here that this guard is telling the truth and can determine that door3 is safe.
F D2 G2
T D3 G3
T D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - No, Is door2 safe? - No, Is door3 safe? - Yes. We come to know here that this guard is telling the truth and can determine that door3 is safe.
T D2 G2
F D3 G3
T D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - No, Is door2 safe? - No, Is door3 safe? - Yes. We come to know here that this guard is telling the truth and can determine that door3 is safe.
T D2 G2
T D3 G3
F D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - No, Is door2 safe? - No, Is door3 safe? - Yes. We come to know here that this guard is telling the truth and can determine that door3 is safe.
T D2 G2
T D3 G3
T D4 G4
F D5 G5
__

Assume door4 is safe

F D1 G1 --> Is door1 safe? - Yes, Is door2 safe? - Yes, Is door3 safe? - Yes, Is door4 safe? - No. We come to know that this guard is lying and can determine that door4 is safe
T D2 G2
T D3 G3
T D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - No, Is door2 safe? - No, Is door3 safe? - No, Is door4 safe? - Yes. We come to know here that this guard is telling the truth and can determine that door4 is safe.
F D2 G2
T D3 G3
T D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - No, Is door2 safe? - No, Is door3 safe? - No, Is door4 safe? - Yes. We come to know here that this guard is telling the truth and can determine that door4 is safe.
T D2 G2
F D3 G3
T D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - No, Is door2 safe? - No, Is door3 safe? - No, Is door4 safe? - Yes. We come to know here that this guard is telling the truth and can determine that door4 is safe.
T D2 G2
T D3 G3
F D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - No, Is door2 safe? - No, Is door3 safe? - No, Is door4 safe? - Yes. We come to know here that this guard is telling the truth and can determine that door4 is safe.
T D2 G2
T D3 G3
T D4 G4
F D5 G5
__

Assume door5 is safe

F D1 G1 --> Is door1 safe? - Yes, Is door2 safe? - Yes, Is door3 safe? - Yes, Is door4 safe? - Yes. We come to know that this guard is lying and can determine that door5 is safe
T D2 G2
T D3 G3
T D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - No, Is door2 safe? - No, Is door3 safe? - No, Is door4 safe? - No. We come to know here that this guard is telling the truth and can determine that door5 is safe.
F D2 G2
T D3 G3
T D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - No, Is door2 safe? - No, Is door3 safe? - No, Is door4 safe? - No. We come to know here that this guard is telling the truth and can determine that door5 is safe.
T D2 G2
F D3 G3
T D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - No, Is door2 safe? - No, Is door3 safe? - No, Is door4 safe? - No. We come to know here that this guard is telling the truth and can determine that door5 is safe.
T D2 G2
T D3 G3
F D4 G4
T D5 G5

T D1 G1 --> Is door1 safe? - No, Is door2 safe? - No, Is door3 safe? - No, Is door4 safe? - No. We come to know here that this guard is telling the truth and can determine that door5 is safe.
T D2 G2
T D3 G3
T D4 G4
F D5 G5

• Thank you for trying, I'm glad you went that far to try to solve my puzzle but I'm afraid these 4 questions won't be enough to get you out of the room. – stack reader Oct 6 '16 at 8:44
• this does nothing to distinguish between the last two cases, so you can't tell which of them is in fact the situation from the questions asked. it's also quite difficult to tell what your process is from the way you've explained it. – Rubio Oct 6 '16 at 8:45
• @Rubio : Yes, it is difficult to understand the process as I have explained. I will try to add explanations when I get time later. Also in the last two cases (door4 is safe and door5 is safe), we can easily determine which door is safe with the four questions to any one guard as far as I see. – rvd Oct 6 '16 at 9:50
• @stackreader With the three questions in first three cases and four questions in the 4th and 5th cases, we can determine which door is safe. OR am I missing something? – rvd Oct 6 '16 at 9:52
• Finding the door is only half the trouble. Read the puzzle and comments here and there and I'm sure you will understand. – stack reader Oct 6 '16 at 10:01

4 simple questions, 4 yes/no answers.

1. To a random guard, ask something obvious like "is yellow a color" - if they say yes then they're not the lying one or else it's so next one should be okay there's only 1 liar (yep i can also ask is one of door 1, 2 ,3 ,4 ,5 the good one ;) the same)

//so knowing which guard is cheating us simply asking one that we know doesn't lie

1. is 1 of the doors 1,2,3 good one

if yes then (I ask if 1 of doors 1,2 is a good one)

if no then 3 is ok,

if no then (I ask if the door 1 is a good one)

if yes then 1 door is ok

if not 2 door is ok

if not (I ask if door number 4 is the good one)

if yes then 4 door is ok,

if not 5 door is ok

So I know the door with 3 or 4 questions :)

• This is a bit of a 169 problem. you have to ASK a guard to open the door, so really you only have 3 questions. – mr23ceec Oct 6 '16 at 14:38

Answer method blatantly adapted from monoRed's answer here - https://puzzling.stackexchange.com/a/43831/30633 - which gets a truthful answer from a guard whether they are a liar or not.

Number the doors (and their guards) 1 to 5 in your head, and point to the relevant doors as you ask the guards the following questions ...

Ask guard 1 [question 1],

How would you answer the question, is the safe exit an odd numbered door?

If guard 1 says no, ask guard 2 [question 2],

How would you answer the question, is the safe exit yours?

If guard 2 says yes, ask him [question 3] to open his door, and exit safely.
If guard 2 said no, ask guard 4 [question 3] to open his door, and exit safely.

However, if guard 1 said yes, ask guard 2 [question 2],

How would you answer the question, is the safe exit a prime numbered door?

If guard 2 says no, ask guard 1 [question 3]

... to open his door, and exit safely.

If guard 2 said yes, ask guard 3 [question 3]

How would you answer the question, is the safe exit yours?

If guard 3 says yes, ask him [question 4]

... to open his door, and exit safely.

If guard 3 said no, ask guard 5 [question 4]

... to open his door, and exit safely.

That accomplishes the task. The questions are not overly complex, and are technically not conditional nor multi-part.

• how can you answer with yes/no to "Who is the liar?" ? – Marius Oct 6 '16 at 7:57
• @Marius "no". (Who is not a liar, he is Gallifreyan of excellent moral character.) Jokes aisde, I don't see it being needed for the puzzle. – mr23ceec Oct 6 '16 at 17:52