Three people were told to go to a cave and each pick up a hat in pitch dark. The three then came out of the cave with the hat on their heads. There were five hats in the cave. Three of them are black, the rest is white. When the first one is asked to tell the color of his hat, he said that he doesn't know. The second person told then same. But the third person said he knows. Why does he know the color of his hat based on what he heard from the other two persons? And how?

  • $\begingroup$ I first saw this problem (with different narrative) in "The Man Who Counted" by Malba Tahan (pseudonym of Júlio César de Mello e Souza). An amazing book of puzzles with delightful stories, great for the young mind and adults alike. It has wide distribution in Latin America, but is mostly unknown in the US. I wonder if it's frowned upon in the US because it's viewed as promoting religion (Muslim); it doesn't, not by a long shot. $\endgroup$ Commented Apr 27, 2014 at 5:25

4 Answers 4


Person $1$ states that he does not see $2$ white hats.

If Person $2$ sees a white hat on Person $3$, then he knows that his hat is black, because there must be at least $1$ black hat between $2$ and $3$.

So Person $2$ must have seen a black hat on Person $3$, leading to his uncertainty.

  • 4
    $\begingroup$ I guess it depends on your definition of simple. Short isn't the same as simple. In my opinion, mine is the "epiphany solution", and the straightforward enumeration of states answers of the other posters is simpler. For someone learning to solve this kind of problem, the other answers are probably better learning tools than mine. But thanks for the vote ^_^ $\endgroup$
    – DanielV
    Commented Apr 27, 2014 at 3:55
  • $\begingroup$ I think it should be noted that not only does the third person know his hat is black, so do we who have seen nothing. In particular the third person did not have to see the other two, just to be seen by them. I think the story could be somehow improved to make this aspect come out better. $\endgroup$ Commented Apr 27, 2014 at 16:48
  • $\begingroup$ We who has seen nothing, ? $\endgroup$ Commented Apr 27, 2014 at 17:25
  • $\begingroup$ After the announcements of persons 1 and 2, [that person 3 has a black hat] becomes common knowledge. Neither we nor person 3 has to see anything because the epistemic space is such that all possibilities have person 3 wearing a black hat. I'd work Marc's wonderful suggestion into the question by adding the condition: person 3 is blind (and still says that he knows). $\endgroup$ Commented Apr 27, 2014 at 18:35
  • $\begingroup$ Interesting observation, but I think red herrings are what make puzzles more interesting, as long as they are not artificially added to the problem, and it leaves behind the gem of finding this observation for yourself if you don't try to "improve" the question. $\endgroup$
    – DanielV
    Commented Apr 27, 2014 at 19:56

Initially there are $7$ possibilities:

$$ \begin{array}{|c|c|c|c|} \hline 1 & 2 & 3 \\ \hline B & B & B \\ \hline B & B & W \\ \hline B & W & B \\ \hline B & W & W \\ \hline W & B & B \\ \hline W & B & W \\ \hline W & W & B \\ \hline \hline \end{array} $$

First says that he doesn't know, so one of $2-3$ has a black, that leaves us with:

$$ \begin{array}{|c|c|c|c|} \hline 1 & 2 & 3 \\ \hline B & B & B \\ \hline B & B & W \\ \hline B & W & B \\ \hline W & B & B \\ \hline W & B & W \\ \hline W & W & B \\ \hline \hline \end{array} $$

Second says he doesn't know, that means one of the others has a black, which leaves us with:

$$ \begin{array}{|c|c|c|c|} \hline 1 & 2 & 3 \\ \hline B & B & B \\ \hline B & B & W \\ \hline B & W & B \\ \hline W & B & B \\ \hline W & W & B \\ \hline \hline \end{array} $$

Moreover, the second knows that the first has seen a black among $2$ or $3$ and he sees that $3$ has white in row $2$, so if row two is the case then the second actually does know his color, so row $2$ gets eliminated:

$$ \begin{array}{|c|c|c|c|} \hline 1 & 2 & 3 \\ \hline B & B & B \\ \hline B & W & B \\ \hline W & B & B \\ \hline W & W & B \\ \hline \hline \end{array} $$

The third knows that his color is black, because in all remaining worlds that's the case.

  • $\begingroup$ What if the second person is blind? $\endgroup$ Commented Apr 28, 2014 at 22:16
  • $\begingroup$ Then wouldn't there be two different cases? Since he always say idk. $\endgroup$ Commented Apr 28, 2014 at 22:17
  • $\begingroup$ That changes the problem. Since person 2 is blind, his announcements don't update the epistemic state at all. So the situation reduces to this. Person 1 says 'idk' means that at least one of 2 or 3 is wearing black. Person 3 cannot know whether the person wearing black is him or person 2. There isn't enough information to eliminate possibilities. $\endgroup$ Commented Apr 28, 2014 at 22:27
  • $\begingroup$ It is now one of the possibilities for a total of five $\endgroup$ Commented Apr 28, 2014 at 23:43
  • $\begingroup$ Should be six (the two new possibilities being: BBW and WBW). $\endgroup$ Commented Apr 28, 2014 at 23:51

Probably each person can see the hats of the other 2 persons. Let A,B,C denote the 3 persons. A says he doesn't know so B,C don't both wear white hats otherwise he would know that he wears a black one. So B,C wear both black or one black and one white. Same stands for B. So A,C wear both black or one black and one white. So we have the 6 cases of what each of the 3 can be wearing:

A: |x|x|x|B|B|W|
B: |B|B|W|B|W|B|
C: |B|W|B|x|x|x|

So C sees what A,B wear according to the above table (checking the right half of the table). For example if B wears white hat then C wears black hat.

So we obtain the following according to the above observations:

A: |  B   |B|W|
B: |  B   |W|B|
C: |B or W|B|B|

But in the first column C cannot wear white since then B by seeing that C wears white and that not both B,C wear white (because A doesn't know what he wears) then he would know that he wears black. So we exclude this possibility and we have:

A: |B|B|W|
B: |B|W|B|
C: |B|B|B|

So C wears a black hat.


If first person saw the two others wearing white hats, he would know that he must wear a black hat, and would have said "black". Since he said he doesn't know, at least one of the other two must wear a black hat.

The second person can look at the third. If the third is white, he knows that he himself is black (based on the first guy's answer), and must answer "black". Since he says he doesn't know, the third person must be wearing a black hat.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .