# Three Doors Logic Puzzle

One day you wake up in a strange room with no windows and three exits (don't ask why, you just do). Between you and the doors is a very moody looking guard who will no doubt kick your ass if you try to mess with him in any way. Suffice it to say, you're a bit put out by all this nonsense and want to get home in time for dinner. You ask the guard how to get home and, gesturing toward the doors, he replies:

One of these leads to salvation,

the other two lead to damnation.

Three questions you will get to try,

but be forewarned, on two I'll lie.

Don't ask why, for I just will,

You'll have to use your wits and skill.

Hmmm...okaaay. You've certainly had better starts to the day than this. What three questions can you ask what will guarantee your safe return home.

Edit: Forgot to add, they have to be yes/no questions.

Second edit: First off, apologies for neglecting this thread. I've been on a countryside break these past few days and decided to use the time to 'unplug', so to speak. I've read through the answers and, while NH and Mike Earnest together managed to get the answer I had in mind, pretty much all the answers presented are, IMO, actually better than mine. It never even occurred to me that this could be solved in only two questions! Anyway, just for the record, here's the answer I had in mind:

Question 1:

Will you answer this question with a 'Yes'? - This forces the guard to answer truthfully. His next two answers will definitely be lies.

Question 2:

2) Is door 1 safe? - If the guard says no, that means door 1 is safe so choose that one. If he says yes, you know it's dangerous.

Question 3:

3) Is door 2 safe? - If the guard says no, choose it. If he says yes again, that means both doors 1 and 2 are dangerous and so by elimination door 3 has to be the safe door.

Hope you had fun with this one. I'll try to make the next one a bit tougher :-)

• Assuming it has to be a different question and has to be yes/no? Aug 25, 2017 at 19:56
• You haven't accepted the tricky answers, and there is a compelling argument that no non-tricky answer exists. Does this have a solution?
– user19641
Aug 31, 2017 at 16:08
• A suggestion: to make this puzzle work, you have to say that the guard will lie on two questions and tell the truth on the other. Maybe change the last two lines to "For the other, I'll be honest / You'll have to use your wits and logic." Sep 1, 2017 at 15:00
• @MikeEarnest Although, thanks to your help, my method now works with or without the assumption that that is what the guard meant.
– NH.
Sep 1, 2017 at 16:04
• Has a correct answer been given? If so, please don't forget to $\color{green}{\checkmark \small\text{Accept}}$ it :) Also, if you feel the need to post a full explanation yourself, please post it as a self-answer. The solution is not part of the question and shouldn't be included in the question post.
– Rubio
Sep 5, 2017 at 4:57

Assuming the guard was telling the truth the whole time through his shpeal:

Question 1 (Credit to @MikeEarnest for helping me repair this question):

If the guard answers "Yes" or "No", either is the truth, which forces the guard to tell the truth on this question and lie on the next two.

Question 2:

Is door 1 safe?

Question 3:

Is door 2 safe?

And then you can figure out the state of door 3 from the information you already know by

Taking the logical AND of the answers to questions 2 and 3. This is equivalent to negating them (to get the real answers) and doing a NOR.

• A liar traditionally says "No" to "Are you lying?"
– user19641
Aug 30, 2017 at 21:22
• Oops, good point. I'm going to have to find a different question that works the way I intended...
– NH.
Aug 31, 2017 at 0:22
• How about replacing Question 1 with "Are you going to answer yes to this question?" Whether or not they answer yes, they will be telling the truth. Aug 31, 2017 at 21:57
• @MikeEarnest, Perfect, thanks! I'll just modify it so that it doesn't have forward-looking language and I think it will work just great!
– NH.
Sep 1, 2017 at 15:52

This feels like it might be cheating?

Question 1:

Is exactly one of the following true?
(a) Door 1 leads to salvation.  (b) You've decided to lie on this question.

Question 2:

Is exactly one of the following true?
(a) Door 2 leads to salvation.  (b) You've decided to lie on this question.

Question 3:

You don't need a third question.

Discussion:

This is a common trick in liar puzzles which causes both truth-tellers and liars to answer truthfully. If they have decided to tell the truth, the exactly one of (a) and (b) is true if and only if (a) is true. If they have decided to lie, then exactly one of (a) and (b) is true if and only if (a) is false. Either way, the guard's answer tells you about the truth of (a), so the first two questions are enough to deduce the correct door.

About the validity of this strategy:

This assumes that the guard knows knows whether or not he is lying. If the guard does not have this knowledge, then the following proof shows no strategy exists:

There are three possible correct doors, and three possible questions the guard can choose to tell the truth on. Each of these 3•3 = 9 situations leads to a certain sequence of answers from the guard. Since 9 > 23, there must exists two situations which lead to the same answer sequence. Furthermore, the correct door in these two situations must be different, because if the only difference between the situations was the questions the guard chose to lie for, their answer sequences would be different. Since your strategy does distinguish these situations, it is possible you will not know the correct door. (The bold part is where need the assumption that the guard does not know if he is lying.)

• ^vote with a note: You might not be able to assume that they've decided ahead of time. They might even throw a die after you've asked the question, especially on the first day, when they are completely free to lie or not. That's what's been stymieing me
– humn
Aug 25, 2017 at 23:30
• @humm Yeah, this answer assumes the guard has knowledge of the die rolls. I have a proof that you cannot succeed if the guard does not have this knowledge. Aug 25, 2017 at 23:34
• I read "a very moody looking guard who will no doubt kick your ass if you try to mess with him in any way" to mean xkcd.com/246
– user19641
Aug 26, 2017 at 0:00
• There's a potential gotcha here in that although the guard did certainly say he would lie on two of the questions, at no point did he tell you he'd tell the truth on the third one. Aug 26, 2017 at 9:09
• I think your original two questions might work after all, Mike Earnest, if you just change the wording to "(b) you are lying." The surly guard wouldn't even have to know whether or not they are lying at the moment because the resultant answer is the same. The puzzle doesn't even state that we'll ever know which days were lies.
– humn
Aug 29, 2017 at 0:07

I think that this might be a trick question...

It says on two I'll lie, but it doesn't say wether it's two questions or the second question, so I think that he means door #2. So If you ask if each door leads to salvation and he responds yes/no, then you just reverse his answer of door 2 so that way you know which to go through.

• That's an ingenious twist that I wish I'd thought of! Sep 1, 2017 at 14:59
• Darn, thought I had it but thanks :) Sep 1, 2017 at 15:18

Similar to the answer provided by Jesse. Given three doors A, B, and C:

Question 1:

Do doors A or B lead to salvation? Y/N

Question 2:

Do doors A or B lead to salvation? Y/N

Question 3:

Do doors A or C lead to salvation? Y/N

Discussion:

If the answer to questions 1 and 2 remained the same, you know he must have been lying in the answer to both questions. If the answer changed, you know one of those times he was telling the truth. In either scenario, the answer to question 3 allows you to deduce which of the three doors will lead you to salvation since you are now armed with the knowledge of when he was lying and when he was telling the truth.

Edit/Update:

Since I missed the comment that you cannot ask the same question more than once, updated questions below

Question 1:

Do doors A or B lead to salvation? Y/N

Question 2:

Do doors B or C lead to salvation? Y/N

Question 3:

Do doors A or C lead to salvation? Y/N

Discussion:

Similar to the first answer posted, it allows you to ask about all 3 doors and use logic to deduce what the correct door has to be. Following getting the answers to his questions, you can make guesses as to which question he is telling the truth on and work backwards to find an answer that is consistent with a solution. E.g. If I assume answers to question 3 and 2 are lies, question 1 must therefore be true. Does this provide a consistent set of results, such as A or B being true, B or C being false, and A or C being true.

• The first comment on this question asked if they had to be different questions and he said yes. Aug 30, 2017 at 20:12
• Ah, I missed that, I only saw the edit saying it had to be a yes/no question. Aug 30, 2017 at 20:54
• In your second attempt consider "NNN" did he lie to the second or third question?
– user19641
Aug 30, 2017 at 21:56
• In the case of NNN, the solution that makes sense is lying on questions 1 and 3 and telling the truth on question 2. If he lied on questions 2 and 3 and told the truth on 1 the results do not make sense, if he told the truth on question 3 and lied on 1 and 2 the results also do not make sense. In reviewing my answer, it may make more sense to think of it in terms of 'what question is he telling the truth on?' instead of 'what questions did he lie on?' Aug 30, 2017 at 22:08
• I get NNN for door A with LTL, or B with LLT.
– user19641
Aug 30, 2017 at 22:25

I think you only need 1 2/3(on average) questions, max of two

The way of solving this for two doors is well known ("If I was to ask you which door lead to damnation, what would you say") and have it double negate or not. So, all you have to do is first choose between one door and the set of other two doors "If I was to ask you which set of {A} or {B,C} would lead to damnation 100% of the time, what would you answer" And then you could use your second question to decide between B and C, if A wasn't correct.

• This looks promising if the questions are changed to yes/no, as prescribed by the puzzle statement
– humn
Aug 30, 2017 at 5:11
• Still don't think this works. Let $X=$"Is A the correct door?" and let $Y=$"What would you say if I asked you $X$?". He can decide to lie for $X$ and tell the truth for $Y$. His lie for $X$ was only hypothetical and since you didn't really ask him, he can choose lie or truth for it. However, after the first question, if he tells the truth, he is forced to lie for the second and third. Sep 1, 2017 at 18:36

Should only need 2 questions max:

If I asked you if door 1 was the exit, would you say yes?

- If he's telling the truth, this is straight forward.
- If he's lying, this question will cause him to flip his answers. Eg. if door 1 is the exit, then he would say no, therefore he would lie about saying no, and say yes.

If he answers yes, take that door. If he answers no, repeat for door 2. If he answers no again, you can just take door 3.

• I don't think this formulation is guaranteed to work without stable truth values. If he lies exactly 2 times in the 3 real + 3 sub-questions I think you are still uncertain.
– user19641
Aug 31, 2017 at 1:38
• Agreed with @notstoreboughtdirt. Lets say door one is safe. His thinking might go like this: If you asked me that, I think I would choose to lie and say no. However, you asked a different question and I have decided tell the truth for this one. Thus I will answer no. He has used up one truth and didn't use up any lies at all, but only reasoned about what he might do if you asked him the question, which you didn't. Sep 1, 2017 at 18:31