# Two doors, each either trapped or safe, have signs whose truth depends on certain circumstances. Each sign reads “Both doors are safe”.

A friend of mine sent me the following puzzle:

There are two doors, and behind them either a trap, or a safe passage to somewhere, and on the doors, it is written something about whether the doors are safe or not. It is known that if the first door opens up to a safe place then the what is written on that first doors is true, but it is opens up to a trap, what is written on that that first door is false. Moreover, if the second door opens up a safe place, what is written on that second door is false, and if this is a trap, what is written on that second door is true.

Now, you look at the doors, and see that on the first door, it is written that

Both doors are safe

and on the second door, it is written that

Both doors are safe

The question asks what are there behind the doors, i.e are they safe to pass or not.

I've tried making a list according to whether the given statements are correct or not, but the conditions listed in the question are not always (if the statement on the door is true) then (something), so I couldn't figure out how to approach such a problem and prove the results that I get somehow, so;

How to solve this puzzle, and prove that the results that we get are indeed correct ?

• I suggest that you post the problem in English so more people are able to help you. – Haris Gusic Feb 19 at 21:26
• Um... I couldn't help but notice that the puzzle is written in Turkish. – Jack M Feb 19 at 21:27
• Sorry, I forgot. – onurcanbektas Feb 19 at 21:27
• @HarisGusic See my edit, please. – onurcanbektas Feb 19 at 21:34
• FYI: This is equivalent to "The Fourth Trial" in the "Ladies or Tigers?" chapter of Raymond Smullyan's book of logic puzzles, The Lady or the Tiger (1982). – Blue Feb 19 at 21:44

Here's Raymond Smullyan's solution to the Fourth Trial in the "Ladies or Tigers?" chapter of his 1982 book of logic puzzles, The Lady or the Tiger. Interpret Smullyan's "Room I" and "Room II" as OP's first and second doors, respectively; moreover, a room with a lady represents a safe door, and a tiger corresponds to a trapped door.

Since the signs say the same thing, they are both true or both false. Suppose they are true; then both rooms contain ladies. This would mean in particular that Room II contains a lady. But we have been told that if Room II contains a lady, the sign is false. This is a contradiction, so the signs are not both true; they are both false. Therefore, Room I contains a tiger and Room II contains a lady.

• Why do they have to be both false or true ? Your conclusion says that one of them is true and the other is false; am I missing someting ? – onurcanbektas Feb 19 at 22:08
• @onurcanbektas: Identical statements should have identical truth values, should they not? The conclusion is not that "one of them and one of them is false"; the solution says explicitly: "they are both false". The circumstances that causes both signs to be false are that the first door is trapped and the second is safe. – Blue Feb 19 at 22:11
• You are right; thanks for the explanation. – onurcanbektas Feb 19 at 22:13

I'm going to assume that the first door's statement is true if and only if it opens to safe passage, whereas the second door's statement is true if and only if it opens to a trap.

The first door's statement can't be true. If it were, then both doors would open to safe passage which makes the second door's statement also true, contrary to the conditions of the problem. Since the first door's statement is false, we know that it opens to a trap.

The second door's statement is now known to be false. By the conditions of the problem, that tells us that the second door opens to safe passage.

Confirming this, we find that the first door opens to a trap and its statement is false, whereas the second door opens to safe passage and its statement is likewise false.

• See my edit also; there was an error. – onurcanbektas Feb 19 at 21:43
• Also, how can you do such an assumption in the first sentence of your answer. – onurcanbektas Feb 19 at 22:09
• I wrote my answer before you corrected the error in your statement of the problem. I was making explicit what I believed the correction should be. Your edit confirmed that my assumption was correct. – Robert Shore Feb 20 at 1:41

The quickest way to answer this is as follows: with both doors saying the same thing, they must lead to different outcomes, meaning that they both make a false statement, and thus door $$1$$ leads to a trap, and door $$2$$ leads to a safe place.

However, I also want to show you that you can do what you tried to do, and simply exhaust all possibilities in a 'truth-table' like manner:

Let $$D_1$$ be what's behind door $$1$$, and $$D_2$$ be what's behind door $$2$$. Also, let $$S$$ be the truth-value of the statement that both doors are safe. So, we have $$4$$ possibilities:

$$\begin{array}{l|l|l} D_1&D_2&S\\ \hline safe&safe&T\\ safe&trap&F\\ trap&safe&F\\ trap&trap&F\\ \end{array}$$

Now we can rule out certain combinations. For example, for the first row, we find that the second door is safe, but its sign is True, which goes against its sign having to be False when it is safe. Likewise, the second row can be eliminated, since door $$1$$ leads to a safe place, so its sign should be True, not False. And the last row doesn't work either: door $$2$$ leds to a trap, so its sign should be True rather than False.

The third row does work out however, and since it is the only one that works out, that myust be the answer: a trap behind door $$1$$, and a safe place behind door $$2$$

Finally, we can use boolean algebra. Let $$D_1$$ represent the claim that $$D_1$$ is safe, and $$D_2$$ for the claim that $$D_2$$ is safe. Then, focusing on door $$2$$, we have that:

$$D_2 \leftrightarrow \neg (D_1 \land D_2)$$

Simplifying:

$$=(D_2 \lor (D_1 \land D_2)) \land (\neg D_2 \lor \neg (D_1 \land D_2))$$

$$=D_2 \land (\neg D_2 \lor \neg D_1 \lor \neg D_2)$$

$$= D_2 \land \neg D_1$$

And thus, once again, door $$2$$ is safe while door $$1$$ leads to a trap.