- Hat puzzle
The hat puzzle is a classic
logic problem , attributed toTodd Ebert , in his1998 Ph.D.thesis at theUniversity of California, Santa Barbara . It is a strategy question about acooperative game , which has been shown to have connections toalgebraic coding theory .Question
A team of players, where is at least three, are randomly assigned
hat s that are equally likely to bewhite orblack , under conditions such that:# Each team player can see the hats of the other team members, but cannot see their own hat;
# Team members cannot communicate in any way.Hypothetically, there are prisoners, but as there was not enough space for all of them. The jailer decides to give them a test, and if all of them succeed in answering it, he will release them, whereas if any one of them answers incorrectly, then he will kill all of them. He describes the test as follows:
All of them go and discuss for some time. And after they come back, he starts the test. Interestingly, each of them answers correctly and hence all are released.
The question is, is there a pre-agreed team
strategy for guessing, which will improve on anexpected value of 0.5, for the score of the team, when it is awarded as 1 if there is at least one correct hat colour guess and no incorrect guess, and 0 otherwise?Answer
Each prisoner counts the number of white hats and black hats they see, and waits for seconds, where is the lower of the two numbers. After that time, (providing the other prisoners are all doing the same thing), he must be wearing the hat of the colour which he is seeing fewer of.
* Everyone wearing a white hat will see white hats and black hats.
* Everyone wearing a black hat will see black hats and white hats.* If then all white hats will say 'White' at the same time ( seconds), and everyone else knows they are wearing black.
* If then all black hats will say 'Black' at the same time ( seconds), and everyone else knows they are wearing white.
* If then all prisoners will know their colour at the same time. ( seconds, or seconds, they are equivalent).Explanation
Four Prisoners
Suppose that there are 4 prisoners, among which two wear black hats and other two wear white.
W W W W "' or "' W B B B
Now, the first one sees two black hats, and a white hat. Had he seen three black hats, he could have easily told that his hat is a white hat, since there should at least be one white hat. Same is true for the second person who is also wearing a white hat. So, all of them are in dilemma. After 10 seconds, each of them thinks that, since the others are not able to deduce their own hat colour, he must be wearing a white hat. So they say WHITE. At about the same time, by similarity, the other two persons say BLACK.
ix Prisoners
Consider that there are 6 prisoners, among which three wear black hats and other three wear white.
W W W "' B B B W W W "' or or "' B B B B B B "' B B B
Now, the first one sees three black hats, and two white hats. Had he seen five black hats, he could have easily told that his hat is a white hat.Also, if he had seen 4 black hats, and a white hat, after 10 seconds, he could have guessed that he must be wearing a white hat since the other person wearing white hat is unable to deduce his hat's colour. (See Four Prisoners). But now he is still in dilemma and is unable to judge the colour even after 20 seconds. So, after 20 seconds, all the persons wearing white hats say WHITE and all the prisoners wearing black hats say BLACK.
Hamming Codes
There is a variation of the puzzle in which the players can answer 'I don't know' as a third choice. In this version there is no relevance in the order, or at what time the players give their answer. One strategy for solving this version of hat problem employs
Hamming code s, which are commonly used to detect and correct errors indata transmission . Here, one can't solve the problem in the sense that the players will win in any case, but the probability for winning will be much higher than 50%, depending on the number of players in the puzzle configuration (e.g. winning probability of 87.5% for 7 players when usingHamming code s.)This strategy can be applied to team sizes of (e.g. 3, 7, 15) and achieves an expected value of . Notably, the Hamming code strategy yields greater expected values for larger values of .
ee also
*
Induction Puzzles
*Prisoners and hats puzzle
Wikimedia Foundation. 2010.