Hat Puzzles

Three Hats PuzzleThe Three Hats Problem

Three people sit in a circle and have hats put on their heads, which may be black or white. No one can see her own hat. The players are told that if they see a black hat on another player’s head, they must raise their hand, and if any player can guess what color her own hat is, she should say so.

All three players are given black hats, so all three raise their hands. After a few minutes, one of the players says, “I am wearing a black hat.” How did she know?

See Answer
She reasoned thus: If I (Player 1) was wearing a white hat, then Player 2 would see that Player 3’s hand is raised and know that it must be because her own hat is black. Since no one is doing that, it must be that all the hats are black.

 

The Four Hats Problem

There are four people standing in a line, one behind another, although a screen hides the first in line. Each is wearing a hat she cannot see. They are told that there are two black hats and two white hats. Each person can see the hats of the person or people in front of her, except no one can see the hat of the first person in line. If any one person can say what color her own hat is, she is to say so. Who figures it out and how?

See Answer
The third person in line (who can see only the second person’s hat) reasons thus: The person behind me can see my hat and the hat of the person in front of me. If they were the same color, she would know that her own hat is a different color. Since she has not spoken, it must be that my hat is a different color than the hat of the person in front of me.

 

The Ten Hats Problem

Now ten people are in a line, one behind the other. Each person can see all the hats in front of them, but not their own hat or any of the hats behind them. They know that each of them is wearing either a black or a white hat, but they do not know the total number of black hats and white hats. Starting from the back, each person must say either “black” or “white,” trying to correctly name their own hat color.  They are allowed just one miss, so 9 out of 10 people must name their own hat correctly. Before the hats are placed, they are allowed a few minutes to discuss what their strategy will be. How do they do it?

See Answer
The person in the back of the line has to speak first, and there is no way for her to know the color of her own hat. There is simply a 50/50 chance of getting this guess wrong. So the players collectively decide that when the person in back speaks, “black” and “white” will also function as a code. The person in back will count the number of black hats she sees. If that number is odd, she will say “black” and if that number is even, she will say “white.” The person in back may or may not get her own hat right; if she misses, then that is the one miss that is allowed. However, after that, each of the other players will be able to deduce the color of their own hat. Everyone must keep track of the odd/even “count,” noting that saying “black” switches it. The system works for any arrangement of hats. Consider the scenario below:

Ten Hats Puzzle

The person in back must go first. She sees five black hats, an odd number, so she says “black.” She is wrong about the color of her own hat, so that is the one allowed miss. The ninth person now knows that the person in back could see an odd number of black hats, but she sees only four, an even number. So her hat must have be one of the black hats the person in back saw. She therefore says “black.” Now the eighth person also sees an even number of black hats, and the ninth person’s guess of “black” resolved the discrepancy, switching the “count” from odd to even, so the eight person correctly guesses “white,” and the count stays at even. Seven and six do the same. The fifth person knows that eight through six saw even, but she sees odd, so she says “black.” Four  now knows five saw odd, but she sees even, so she says “black.” Three knows four saw even, and she does too, so she says “white.” Two knows three saw even, but she sees odd, so she says “black.” Now the person in front knows two saw odd, which means two saw the person in front’s own black hat, so the person in front can confidently say “black.” 

Red Hats and Blue Hats

Red Hats Blue Hats

This puzzle was invented by Tanya Khovanova. There are three logicians, Amber, Brianna, and Carla, each wearing a hat. They can see the colors of the others’ hats but not their own. They know that their hats were drawn from a group of three red hats and two blue ones. Amber is asked what color her hat is and she responds, “I don’t know.” Brianna is asked what color her hat is and she also says, “I don’t know.” When Carla is asked what color her hat is, she answers correctly. What color is her hat and how did she know?

See Answer
To answer correctly, Carla must think about why the others answered the way they did. If Amber had seen the other two wearing blue hats, she would have known her own hat was red. Since Amber said she did not know, Brianna and Carla cannot both be wearing blue hats. Brianna must also not have seen two blue hats, for the same reason: if she did, she would know her own hat was red. Now, since Brianna knows she and Carla cannot both be wearing blue hats, if she looked at Carla and saw a blue hat, she would have known her own hat must be red. But Brianna said, “I don’t know.” Therefore, she must not have seen a blue hat on Carla. Carla considers all of this and correctly infers that her own hat is red.

Another Three Hats Problem

Three people are sitting in a circle. Hats have been placed on their heads that are either black or white. The color of each player’s hat is determined by a coin toss, so each player has a 50/50 chance of having either a black or a white hat. The players cannot see their own hat color, but they can see the colors of the others players’ hats. In this version, the players must simultaneously either state a guess as to the color of their own hat, or remain silent. If at least one person guesses their own hat color correctly, and no one guesses incorrectly, they will share a prize. If there are no correct guesses, or if there are any incorrect guesses, they lose. They are allowed to discuss a strategy before the game begins. Is there a way they can maximize their chances of winning?

See Answer
It may seem like the best the team can do is a 50/50 chance, by choosing a single player to randomly guess black or white. But there is a strategy that improves their odds. To understand it, first consider this chart of the possible outcomes:

Player 1 Player 2 Player 3
1 Black Black Black
2 Black Black White
3 Black White Black
4 Black White White
5 White White White
6 White White Black
7 White Black White
8 White Black Black

Each of these 8 outcomes is equally likely. Notice that in each scenario, at least one person will be able to observe that the hats of the other two players are the same color. However, in only two of those scenarios will the player(s) observing this be wearing a hat of the same color that she sees on the other two. This occurs only in outcomes 1 and 5, where each player sees two hats of the same color, and is also wearing that color hat. In scenarios 2, 3, 4, 6, 7, and 8, there is only one person who will see two hats of the same color, and that player will be wearing a different color hat. Therefore, the strategy that the players come up with is simply this: If you see two different color hats, remain silent. If you see two hats of the same color, say the other color. This gives the team a 75% chance of success. In scenarios 1 and 5, all three players will guess incorrectly, so the team loses. In scenarios 2, 3, 4, 6, 7 and 8, one player will guess correctly, and the team will win.

A version of this puzzle appears on the Tumblr blog The Science of Deduction and More.

Leave a Comment (it will be moderated and won't appear immediately)