The prisoners and hats puzzle tests your logical thinking
4 Prisoners and Hats Puzzle: Alien chief offered a game of freedom or death to his 4 prisoners. Each will wear a hat and guess its color. Can anyone win?
The logic puzzle
Aliens have captured 4 humans all of whom happens to be logicians. One day in a playful mood, the Alien Chief offers a way of freedom to the prisoners through a game.
The prisoners are lined up in a queue so that the tallest in the back can see the heads of all others in front and the same for the others. Naturally, the shortest prisoner is placed right in the front.
The prisoners are now blindfolded and a hat is placed on the head of each.
Preparation for the test being over, blindfolds are removed and the Chief tells the prisoners about the game.
Details of the Game: 4 prisoners and hats puzzle
- Out of a total 7 hats, 3 black and 4 white, one hat is placed on the head of each.
- Each prisoners will be asked a question starting from the back, "What is the color of your hat?".
- The prisoner has two options: either to tell the color of his hat, or stay silent. If the answer is correct, the prisoner will be set free, but if wrong he will die.
- If a prisoner is silent, he won't die or earn his freedom either. Same question will be asked to the next one in the queue and the game will continue.
- Every prisoner must not look behind and must not pass any kind of hint to the others except say the valid allowed answers which all can hear.
The Alien Chief finally rubs his tentacles and says, "Any questions?" All were silent.
"Okay, let's start the game." The alien Chief ambles towards the prisoner at the back, the first one in the queue, and asks his first question.
Result of test
The happy news is: The shortest prisoner, the fourth in the queue, could correctly tell the color of his hat and got his freedom after the first three remained silent.
Can you say what has been the color of the hat of the prisoner who earned his freedom? And why do you think it is so?
Time for you solve the riddle: 10 minutes.
Solution to the 4 prisoners and hats puzzle by implication analysis and reasoning
Think like the logician prisoners. At each step with each answer, ALL PRISONERS YET TO BE QUESTIONED must deduce the IMPLICATION OF ALL PREVIOUS ANSWERS.
Okay, that being clear, can you say what is the implication of the first response of silence?
Implication of the SILENCE of the first prisoner at the back: 4 prisoners and hats puzzle
He could see all three hats in front of him and couldn't be sure of the color of his own hat. He knew that there are 3 black hats and 4 white hats.
LOGIC 1: If any of three prisoners in front had a single white hat, it implies, number of black hats worn by the other two can at most be 2, and so hats left might well be 1 black and 3 white. His own hat could be ANY OF THE TWO COLORS.
On the other hand, he would have surely known the color of his own hat and earned his freedom only if all three hats in front were black. In this case, the hats left would have been exactly 4 white ones. His hat color would surely be white.
As it happened the prisoner at the back couldn't respond simply because ALL THE HATS IN FRONT WERE NOT BLACK, AT LEAST ONE WAS WHITE.
Let's move on to the second prisoner from the back.
Implication of the SILENCE of the second prisoner from the back: 4 prisoners and hats puzzle
He could see two hats in front and also knew from the answer of the first prisoner that at least one of the three hats including his own must be white.
LOGIC 2: If the second prisoner saw two hats in front were black, he would have been sure that the single white hat SEEN BY THE FIRST PRISONER AT THE BACK MIUST BE ON HIS OWN HEAD.
And he would have earned his freedom.
In reality, it was not so.
That means, ONE OF THE TWO HATS IN FRONT OF THE SECOND PRISONER FROM THE BACK MUST HAVE BEEN WHITE.
Let's move on to the next prisoner who stood third from the back.
Implication of the SILENCE of the third prisoner from the back: 4 prisoners and hats puzzle
He could see only one head in front but knew that both of his fellow prisoners couldn't be sure of the color of their own hats and the implications.
LOGIC 3: If he could see a black hat in front, he would have been sure that his own hat is white simply because the man behind him had seen at least one white hat in front, remember?
And he would have been the happiest person in the whole prison to earn his freedom at that moment.
But it didn't happen that way. The third prisoner from the back couldn't be sure of the color of his own hat, simply because THE HAT HE SAW IN FRONT WAS WHITE.
We know at this point why and how the fourth prisoner could earn his freedom. By the implications of the answers of the first three prisoners behind him, he knew that his own hat must be white.
Still not exhausted? Okay, we'll leave a small piece of food for thought for you.
What would be the color of hats of the third and the fourth prisoner from back if both of them answered correctly?
Prisoners and hats puzzle is a classic logic puzzle that appears in more than one variation. You can form your own variation and solve it.
Puzzles you may enjoy
Logic analysis puzzles
4 Prisoners and Hats Puzzle