Three prisoners tell a warden they have been wrongly convicted and they are mere academic logicians who would never commit a crime. The warden suspects they may be innocent so he offers them a chance at freedom.
The prisoners are lined up facing a brick wall, with person 1 seeing persons 2 and 3, person 2 seeing person 3, and person 3 only seeing the brick wall. The warden explains he has randomly chosen 3 hats from a group of 3 red hats and 2 blue hats. Each prisoner has a hat placed on his head.
The warden says, “If any one of you can deduce your hat color, with proper justification, I will let all of you free. Otherwise you will stay my prisoner.” Then the warden asks each prisoner in turn.
Warden: “Prisoner 1, do you know the color of your hat?”
Prisoner 1: “I do not know.”
Warden: “Prisoner 2, do you know the color of your hat?”
Prisoner 2: “I do not know.”
Warden: “Prisoner 3, do you know the color of your hat?”
Prisoner 3: “I know!”
What was prisoner 3’s hat color, and why?