3 prisoners in a line


3 prisoners are brought to a room with 3 red hats and 2 blue hats. They are told to line up single file facing forward, so that each prisoner can only see those in front of them. They are blindfolded and a hat is placed on each prisoners head. The remaining hats are disposed of.

The blindfolds are removed and the prisoners are told that the first person to correctly call out the colour of their hat will go free. They have one minute.

For a while the prisoners stand silent, but just before the minute is over the prisoner at the front correctly names the colour of their hat.

What was the colour of the hat on the prisoner at the front?

The prisoner at the front had a red hat.

Proof

The prisoner at the back can see the colours of the other two prisoners. If the hats were both blue then the prisoner could deduce that their own colour was red, and they would instantly say this. Since the prisoner at the back remained quiet we (and the two prisoners in front) know that least one of the front two prisoners has a red hat.

The middle prisoner can only see the colour of the front prisoner’s hat. If it was blue then the prisoner could deduce that their own hat colour was red. However, they do not speak. This means that the colour of the hat on the front prisoner must be red.