Hat Colour Puzzles: How to Reason From What Others See
This article was written with AI and may contain mistakes. Found one? Tell us.
In a hat colour puzzle, each player can see the hats of the other players but not their own, and has to work out or guess their own colour. You solve one by listing every colour pattern that could be on the heads, then asking what each player sees and what each answer, or each silence, rules out.
There are two kinds. In deduction puzzles, players speak in turn and the last speaker becomes certain. In strategy games, players agree a plan in advance and try to be right as often as possible. This guide covers both, with a full worked example, the classic three-player game, what happens with many colours, and a practice puzzle with its answer.
What is a hat colour puzzle?
A hat colour puzzle puts a coloured hat on each player. The colours come from a known set, such as red and blue. Each player can look at some or all of the other hats, but nobody can see their own, and nobody may simply tell another player what they see.
The twist is that a player who says nothing useful still gives information away. When one player says I do not know, everyone who hears it can strike out every pattern in which that player would have known. Hat puzzles are, at heart, puzzles about knowledge: who knows what, and what they learn from each other.
What are the two kinds of hat colour puzzle?
Most hat puzzles fall into one of two groups, and they call for different ways of thinking.
| Feature | Deduction puzzle | Strategy game |
|---|---|---|
| Who can see what | Often a line, each player seeing those in front | Usually everyone sees every other hat |
| What players say | Whether they know their colour, in a fixed order | A guess or a pass, all at the same moment |
| Talking allowed | Only the announced answers | None once the hats are on; a plan is agreed beforehand |
| What you are asked | The exact colour of every hat | The plan that succeeds in the most patterns |
| Style of answer | One certain pattern | A success rate, such as six patterns out of eight |
| Main tool | Striking out patterns after each statement | Counting winning and losing patterns |
Both kinds share one habit: write down every possible pattern first. Hat puzzles are small enough that a full list is the surest way to stay honest.
How do you solve a deduction hat puzzle step by step?
Use the same five steps every time.
- List the patterns. Write every way the hats could be coloured, taking into account how many hats of each colour exist.
- Note who sees what. For each player, mark which hats are visible to them.
- Read the first statement. If a player says I do not know, cross out every pattern in which that player, seeing what they see, would have been certain. If they say I know, keep only those patterns.
- Repeat with the shorter list. Each later speaker reasons from the list that survives, because they heard everything said before them.
- Read off the answer and check it. When one pattern is left, run through every statement again and make sure each one is true in that pattern.
The key question at step 3 is always the same: in this pattern, does the speaker see enough to rule out every other colour for their own hat? If yes, they would know. If no, they would not.
How does the method work on a four-player line?
Here is an original puzzle. Four players, A, B, C and D, stand in a line, all facing the same way. A is at the front and sees nobody. B sees A. C sees A and B. D, at the back, sees A, B and C. Everyone knows the hats were taken from a box holding two red hats and four blue hats, and the two leftover hats are hidden.
The players then speak in this order:
- C says: I do not know my colour.
- B says: I do not know my colour.
- D says: I know my colour.
What colour is each hat? Try it before reading on.
Step 1: list the patterns. At most two hats can be red. There is one pattern with no red hats, four with one red hat and six with two red hats, so eleven patterns in all.
Step 2: C speaks. C sees A and B. The only way C could be certain is if A and B were both red, because then no red hat is left and C must be blue. C is not certain, so A and B are not both red. That strikes out one pattern and leaves ten.
Step 3: B speaks. B sees only A, but B heard C and now knows that A and B are not both red. So if A were red, B would be sure to be blue. B is not sure, so A must be blue. Every pattern with a red hat on A goes, and seven patterns remain.
Step 4: D speaks. D sees A in blue and can also see B and C. If B and C were both red, both red hats would be used up and D would know they are blue. In any other case, D's own hat could still be either colour, because a red hat and a blue hat would both still be available. D does know, so B and C are both red, and D is blue.
Step 5: check. The answer is A blue, B red, C red and D blue. C sees a blue hat and a red hat, so C cannot tell. B sees a blue hat, so B cannot tell either. D sees both red hats in use, so D knows. Every statement holds, and an exhaustive computer check of all eleven patterns confirms that no other pattern fits.
Why does saying I do not know give anything away?
A statement of ignorance is a statement about the world. I do not know means that the world is not one of the patterns in which the speaker would have known. In the line above, the two silences did most of the work, and the final I know only had to pick out one pattern from the seven that were left.
This is also why the order of speakers matters. B could only use C's answer because C spoke first. Swap the order and the same words can lead to a different answer, or to none at all.
How does the classic three-player hat game work?
The best-known strategy hat game works like this. Three players each get a red or blue hat, each colour equally likely. Everyone sees the other two hats but not their own. At the same moment, each player either names a colour for their own hat or passes. The team wins if at least one player names the right colour and nobody names a wrong one.
Passing every time loses, since someone has to guess. If one agreed player always guesses and the other two always pass, the team wins half the time. A paper published on 13 November 2014 recalls that this simple version already has a proven best plan, which wins with a chance of 3/4 [1]. The plan is short: if the two hats you see match, name the other colour; if they differ, pass [1].
Why does the three-player plan beat a single guess?
List the eight patterns and follow the plan. When all three hats match, every player sees a matching pair, everyone names the other colour, and all three are wrong. Those are the only two losing patterns. In each of the other six, exactly one player sees a matching pair, that player is right, and the other two pass.
Here is the clever part. Over the eight patterns, the plan makes six right guesses and six wrong ones, so each single guess is still right only half the time. What the plan does is bunch the wrong guesses together. Three wrong guesses land on the same pattern, while the right guesses are spread out, one per pattern. A wasted pattern full of wrong guesses costs the team no more than a pattern with one wrong guess.
What changes when there are more than two colours?
The same game can use any number of colours. The 2014 paper proves that with three players and more than two colours, the best plan wins in exactly 3k² − 6k + 6 of the k³ equally likely patterns, where k is the number of colours [1]. The table puts that count next to the classic two-colour game [1].
| Colours | Equally likely patterns | Best number of winning patterns | Best winning share |
|---|---|---|---|
| 2 | 8 | 6 | 0.75 [1] |
| 3 | 27 | 15 | about 0.56 [1] |
| 4 | 64 | 30 | about 0.47 [1] |
| 5 | 125 | 51 | about 0.41 [1] |
| 6 | 216 | 78 | about 0.36 [1] |
The success rate drops as colours are added, but it stays well above what a single guess would give. With two players and k colours, the paper gives the best plan as a winning share of 2(k − 1)/k² [1]. Both players agree on one colour, name it if they cannot see it, and pass if they can [1].
For games in which there are no more than twice as many players as colours, the paper builds a plan around a simple ladder rule [1]. Number the colours. Look at colour one: if you see no hat of that colour, name it; if you see exactly one, pass; if you see two or more, move on to the next colour and ask the same questions [1].
With that limit on players, nobody can see two or more hats of every colour, so the ladder always stops with a guess or a pass before the colours run out.
With three players and two colours, this ladder is the classic plan in disguise. Work through it on the eight patterns and you will see the same matching-pair moves as before.
Is there a limit to how well any plan can do?
Yes. For n players and k colours, with at least three of each, the 2014 paper proves that no plan can win in more than (n × kⁿ − 1)/(n + k − 1) of the kⁿ patterns, rounded down [1]. The paper's general plan comes as close to that limit as you like once the number of colours grows large, for any fixed number of players [1].
In plain words, the share of winning patterns can never be much more than n/(n + k − 1) [1]. Many players and few colours leave room for a high success rate. Few players and many colours do not. A helpful way to picture good plans is the trick from the three-player game: pack the wrong guesses into as few patterns as you can, and spread the right guesses across as many as you can.
Why are puzzles about knowledge hard to write down formally?
A paper published on 18 July 2023 describes another puzzle about what people know, the sum and product puzzle, as a challenge for automated reasoning: it has to be stated in a formal declarative language so that a tool can find or confirm the answer [2].
That paper then ran an answer set solver on the puzzle [2].
Hat puzzles are also about what people know. Every I do not know is a claim about the other patterns that could have been on the heads, and the pattern list in this guide is a hand-made way of keeping track of them.
What mistakes trip people up?
- Forgetting the box. In the four-player line, the number of red hats available is what lets anyone be sure. Ignore it and nobody could ever know.
- Using information a player does not have. A player can only reason from what they see and what was said before they spoke.
- Treating silence as empty. I do not know removes patterns, often more than I know does.
- Judging a plan by one guess. In strategy games, count winning patterns for the whole team, not the success of single guesses.
- Skipping the final check. Read every statement again against your answer before you call it done.
Can you solve this practice puzzle?
Four players, A, B, C and D, stand in a line as before: A at the front sees nobody, B sees A, C sees A and B, and D sees A, B and C. This time the hats came from a box holding two red hats and three blue hats.
- C says: I do not know my colour.
- B says: I know my colour.
- D says: I know my colour.
What colour is each hat?
Answer: A is red, B is blue, C is red and D is blue. With only three blue hats, at least one of the four must be red. C would only know if A and B were both red, so they are not.
B then knows the rule too, and B could only be sure if A were red, which forces B to be blue.
D sees A red and B blue. If C were red, both reds would be used and D would know they are blue. If C were blue, D could still be either colour. D knows, so C is red and D is blue. A computer search of all ten possible patterns confirms this is the only one that fits.
Where can you try a related riddle?
Hat puzzles reward the habit of asking which statements can all be true at once. This live riddle uses the same skill with labels instead of hats: there are three chests, gold, silver and bronze, exactly one of the labels is true, and you have to find which chest holds the treasure.
References
- Tantipongpipat, U. (2014, November 13). A Combinatorial Approach to Ebert's Hat Game with Many Colors. The Electronic Journal of Combinatorics, 21(4), P4.33. DOI 10.37236/4375
- Lifschitz, V. (2023, July 18). On Program Completion, with an Application to the Sum and Product Puzzle. Theory and Practice of Logic Programming, 23(4), 664-677. DOI 10.1017/S1471068423000224