# That hat at that head

It seems to me that many mysteries involve hats. Therefore, a good old hat mystery that I came across a couple of years ago.

Abraham (A), Bingchiang (B), Charly (C) and Derek (D) are sitting in a line facing the same direction in that way that A can see B, C and D. B can see C and D, C can see D and D can see no one.

> > > >
A B C D


Ernest is a rich guy that has 5 hats. He shows them 3 white hats and 2 black hats that only differ in color. Thus, they feel exactly the same way. Of those 5 hats, he randomly picks 4 hats and puts one hat on each person's head. The remaining hat is destroyed.

Ernest claims that if one can guess which color his hat is, they all will receive exactly 625000 dollar.

Ernest says that A has to go first in guessing, then B, then C and then D. If one of them miss guesses his color, all would die instantly. However, if they don't know their color, they just can say that and the next person would be able to guess.

Abraham answers first: I can't guess the color of my hat.

Bingchiang doesn't speak English so mumbles something weird which no-one could understand. Ernest decides that it doesn't count as a wrong answer but that he just lost his turn to guess.

Charly also answers that he can't guess the color of his hat.

Derek is a smart man and knows the color of his hat. He gives the answer to Ernest and they claim their prize rightfully.

Do you know what Derek's answer was? How did he know what color his hat was? Do you know even more hat colors (Abraham's? Bing's? Charly's?)?

PS: no-one is a chameleon or some sort. Every name is linked to a normal human being without super powers.

SPOILER ALERT: A lot of the answers below are not provided with the spoiler alert tag. Beware if you scroll down!

• Your hat master is generous in giving them money. Most of these hat people just let you live!! – corsiKa Nov 17 '14 at 15:36
• I know, right? I was thinking about making them the 4 Daltons or 4 other villains or some sort :P. – Valentin Grégoire Nov 17 '14 at 15:37
• It might be good to clarify B's situation, since it's not clear whether you're saying that nobody understood anything about B's utterance, or whether everyone could tell B's utterance was equivalent to "I know the color of my hat and it is blorple", but nobody knew what color "blorple" was. – supercat Nov 17 '14 at 18:19

Derek is wearing a

white

hat. One of

Bingchian and Charly

is wearing black and the other white. As for

Abraham,

he is wearing the opposite of the color that was destroyed.

Reasoning:

If A sees

3 white

hats, he knows he is wearing the opposite color. If he sees

2 black

hats, he knows he is wearing the opposite. But Abraham doesn't know, so by elimination, EXACTLY ONE of B, C, and D is wearing

black.

If D is wearing

black,

then C, reasoning as above, knows the 'exactly one' is D, so C must be wearing

white.

But C doesn't know, so D must be wearing

white.

• Your "Exactly one..." in the spoiler is certainly the clearest way of solving it. – Chris Cudmore Nov 17 '14 at 15:21
• That is correct! – Valentin Grégoire Nov 17 '14 at 15:22
• @Kami - re. your suggested edit, there is someone who sneaks around downvoting people for having too many spoilertags in their answers! Here's a deal: if you upvote my answer, I'll approve the edit :-) – Rand al'Thor Nov 17 '14 at 16:32
• @Kami - never mind; I've approved your edit anyway. Let Gilles downvote me if he wants! – Rand al'Thor Nov 17 '14 at 16:43
• I've suggested a further edit to expose all but the most essential information; although the dozen linebreaks are annoying (this site could probably use inline spoilers as a feature!), I would propose that this makes the answer better in that a reader can now follow along while still being able to work out the solution for herself. – Josh Caswell Nov 17 '14 at 20:39

Well, since there are four people and 5 hats, the combination of hats is either 3 white and 1 black or 2 white and 2 black. If A cannot answer, that means that A sees 2 white and 1 black in front of him. B most likely also sees one black hat, since if there were two black hats B would know that they had a white hat on. I can't figure out why Charly can't guess but if I had to guess by what I have now, ABC are wearing white and D is wearing black sorry I failed :(

• For all we know B might be able to guess the colour of his hat if he could speak English and understand what was going on (I think this is the intention of the question?) – Rand al'Thor Nov 17 '14 at 15:03
• You tried, that's the most important. It's wrong, but keep it up :)! – Valentin Grégoire Nov 17 '14 at 15:20

A can't guess the color of his hat. If he had seen 3 white, he would have known he's black, similarly, had he seen 2 black, he would have known he's white. Therefore, he is seeing 2 white and 1 black

B's answer is unknown. He would have seen 2 white, and guessed black, or seen one black, one white and guessed white. In any case, B would have been able to determine the colour of his own hat.

By the same logic, C does not see a single black hat, which would make C black. This tells D that he is wearing a white hat.

The order of the hats is: A - ?, B - ?, C - ?, D - W, but we do know that B and C have opposite colours.

• You mean "C does not see a single black hat, which would make D white". C can see D but not himself. Anyway I got there first! :-) – Rand al'Thor Nov 17 '14 at 15:16
• Yeah, got mixed up there at the end typing it out. Fixed. – Chris Cudmore Nov 17 '14 at 15:19
• Also you don't know B and C have to be this way round. – Rand al'Thor Nov 17 '14 at 15:21

B, C and D combined wear 2 white hats and 1 black hat regardless of which hat is destroyed, since if there were 3 white hats in front of A, or 2 black hats, then A would be able to answer.

B's answer (or lack thereof) presents two possibilities to C and D - either there are two white hats, or one black hat and one white hat.

C's answer solidifies the whole process - if he saw a black hat in front of him, then he would be able to call out that he had a white hat and the group goes away free. However, he did not.

This signals to D that he is in fact wearing a white hat.

I'm gonna try to show a visual approach for this type of problems, that can be done with pen and paper.

to make the explanation shorter and more readable, let's say that white = 1 and black = 0.

here is a list of all 16 possible combinations. obviously from left to right we have the four men ABCD. conveniently, those are 0-15 in binary.

0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111

if all you have is a pen and paper, you can make that list very quickly.
notice the pattern of the rightmost digit. it simply goes 0-1-0-1 etc.
the second rightmost digit goes 0-0-1-1-0-0-1-1 etc.
the third rightmost digit goes 0-0-0-0-1-1-1-1 etc.

next, eliminate all combinations that have more than three 1s or more than two 0s (because we only have 3 white hats and 2 black hats)

0011
0101
0110
0111
1001
1010
1011
1100
1101
1110

now is a bit trickier. ignoring the leftmost digit, eliminate all combinations that DO NOT appear twice. we do this because man A does not know his hat color, therefore, we have to find a 3 digit sequence that does not give away the fourth (leftmost) digit

0011
0101
0110
1011
1101
1110

man B gives us no information. with man C's statement, we can eliminate all combinations in which the rightmost digit would give away the second rightmost digit.

0011
0101
1011
1101

all these remaining combinations are possible, and in all of them men D has a white hat.