But would they be neighbours like this?

Photo by lorenzaccio* CC BY

Photo by lorenzaccio* CC BY

The “Doors to Heaven and Hell” riddle. It’s an oldie and a goodie. I’m sure everyone’s pretty familiar with it, but in case you’re not here’s a quick recap:

Bad news, you’ve just died. You find yourself in a nondescript hallway with two identical doors, each guarded by a man. You realise you’re holding a scrap of paper. It reads:

1. One of these doors leads to Heaven, one leads to Hell.
2. The man guarding Hell’s door always lies. The man guarding Heaven’s door always tell the truth.
3. You may ask one of them one question.

(Note: You also can’t use any external reference points e.g “Does 1 + 1 = 2?” You have to limit your questions to the men and their situation. Nor can you do a Karl Pilkington and try to trick God into coming to the door to sign for his post)

So if you were to ask them, “Where does your door lead?” the man guarding Heaven would say “Heaven”, as would the man guarding hell (since he’d lie). That would be a bad question, since if you asked either of them, they would give the same answer. The aim of the riddle is to ask a question which is guaranteed to let you know which door leads to heaven and which leads to hell. The good thing is, there is a solution.

The answer is annoyingly simple once you hear it. The correct question to ask is “If I was to ask the other guy what door he was guarding, what would he say?” If you happened to ask the man guarding heaven, he’d know the other guy was guarding hell, and he’d know he’d lie, so he’d say “Heaven”. Likewise if you happened to ask the man guarding Hell what the other guy would say, he’d know the guy guarding heaven would say “Heaven”, so he’d lie and say “Hell”. The answer they give is the answer to which door they’re guarding.

In fact there are several variations of the question which you could ask (E.g. “If I was to ask the other guy what door you were guarding, what would he say?”) Another interesting variation is “If I were to ask you what door you were guarding, what would you say?”. The liar’s process would have to be:

1. OK, I’m guarding hell
2. If he was to ask me what door I was guarding, I’d say “Heaven”
3. But I need to lie about the answer to (2)

And he’d have to say “Hell”. So you’d know he was guarding hell.

The same principle behind each of these questions is the principle of chaining their systems in series. Let’s use some logic gates to show you what I mean.

So a basic NOT gate (or inverter) takes in a value and returns its opposite.

That's not a knife that's a spoon

So 0 goes in, 1 come out. Another way to put this:

Hell goes in, heaven come out. The liar in the riddle is a basic inverter. He is forced to tell the opposite of what he knows is the truth. The truth-teller, on the other hand, does nothing to the truth. The input travels unmolested through his “process”.

Asking one of these guys what the other would say guarantees that we are passing our input through both processes. And we know that one of them is an inverter, and the other does nothing to the input. So with a question structured to invoke both processes, we know the output will be the negative of the answer we really want. And again, in logic gates:

Similarly, my alternative “What would you say if I were to ask you…” example is the equivalent of passing the input twice through the inverter. In other words, the input would exit the process having been inverted twice, thereby having suffered no modifications.

Interesting stuff. And who’d have thought I’d actually find some use for my logic-gate knowledge?

Leave a Reply

Your email address will not be published. Required fields are marked *