A logical puzzle: Four prisoners of war are caught and taken to a prison camp. The prison is full up and the warden doesn’t know how to accommodate the four prisoners. Ever the prankster, he hits upon an idea to deal with his problem – he decides to test them. But there is a catch: if they gave the right answer, they would be set free; but if they failed, they would be executed.

The warden digs four holes in a line and erects a wall between the first and second holes. Three of the men are put in the three holes on one side of the wall with just their necks out and facing the wall. The fourth man is put in the only hole on the other side of the wall, also facing it. He then puts a white hat each on the heads of two of the prisoners and a black hat each on the heads of the other two. The warden then explains to the prisoners that each of them was wearing either a white or a black hat, equally divided. He also makes sure that each of the prisoners is able to see the hats in front of him but not on himself or behind. The fourth man behind the screen can’t see or be seen by any other prisoner. No communication between the prisoners is allowed.

If any prisoner can figure out and mention to the jailer (within 30 seconds) the colour of the hat that he himself has on his head, all the four prisoners would be set free. If any prisoner gave an incorrect answer, all the four would be executed.

Who answers and why?

.

.

.

.

.

.

.

.

.

.

.

.

.

Solution

The prisoners know that there are only two hats of each colour. So if the last prisoner amongst the three (C) observes that A and B have hats of the same colour, he would deduce that his own hat is of the opposite colour and would answer immediately. However, if A and B have hats of different colours, then C would be stumped. Logically, that is the way the warden would have put the hats on the prisoners so that prisoner C sees opposite coloured hats in front of him.

When, after a period of, let’s say, 20 seconds, prisoner C does not say anything, prisoner B KNOWS that prisoner C is in a dilemma – the two in front of him are wearing opposite coloured hats. Being able to see prisoner A’s hat, prisoner B can deduce the colour of his own hat – it would be the opposite colour of what prisoner A is wearing. (The fourth prisoner (D) is irrelevant to the puzzle: his only purpose is to wear the fourth hat).