# Thread: Problem: The 4 prisoners

1. ## Problem: The 4 prisoners

This is my favourite challenge problem, simply because it only requires pure logic, nothing else.

Look at this diagram: http://img179.imageshack.us/img179/769/4soldiers.png

There are four prisoners, buried to their necks in the ground. Each of them is wearing a hat. They know that there are four of them. They know that each prisoner is wearing just one hat. The prisoners know that there are two black hats and two white hats. They cannot turn their heads even the slightest, they can only look straight ahead.

The arrows on the diagram indicate the direction of their heads.
Prisoner 1 can only see the brick wall.
Prisoner 2 can only see the brick wall.
Prisoner 3 can see Prisoner 2 and the brick wall.
Prisoner 4 can see Prisoner 3, Prisoner 2 and the brick wall.

From Prisoner 1 to Prisoner 4 (i.e. left to right), the hats have been arranged white-black-white-black. The prisoners do NOT know this.

The prisoners do not know what colour hat is on their head.

The guard has told the prisoner that each of them can only speak one word: either 'black' or 'white'. If what the prisoner says is the correct colour of the hat on his head, then all of them are freed. If what the prisoner says is incorrect, all four of them are killed instantly.

Only one prisoner out of the four can work out what out what colour hat is on his head.
Who is it and why?

(The answer is NOT that one of them takes a lucky guess).

2. Nice problem

Here's my solution:

Number 3.
He knows number 4 sees two different coloured hats, and what colour number 2's hat is.

3. Unenlightened - well done!

4. Originally Posted by blueirony
Unenlightened - well done!
How did prisoner 3 know that prisoner 4 sees two different colors ?

5. Otherwise Prisoner 4 would know.

Spoiler:
Immediately rule out 1 and 2. It's not possible for them to know what colour hat they have unless brick walls suddenly grow vocal chords.
So we concentrate on 3 and 4.
Now, 3 gets thinking. There is one scenario that could have 4 immediately know what colour is on their head: if 2 and 3 have the same colour. If 2 and 3 both are black, 4 knows for sure that they are white. Similarly, if 2 and 3 are white, 4 knows for sure that they are black.
But 4 doesn't say anything. So what does that mean? 2 and 3 must be different coloured. 3 knows this. So 3 looks at 2. If 2 is black, 3 is white. If 2 is white, 3 is black.

Having said that, Musab, 3 doesn't know that 4 is seeing two different colours. But you have to think about the question asked. You, the askee of the problem, know that the hats are in an alternating pattern. With this restriction, 3 is the ONLY logical answer to the problem.
If 2 and 3 were the same coloured, then 4 would be the only logical answer to the problem. But the fact is, the hats are alternating.
I don't know how much sense that makes.... but YOU know that the hats are alternating. The soldiers do not.
Wow, I'm not even sure I'm answering your question... I guess you could argue that if all the soldiers are highly intelligent and a lot of time passes, 3 could assume that 4 would have said something by now if 2 and 3 were the same.