Solution to the Black and White Hat Puzzle


Answer to Question 1: The most number of people that you can guarantee to save is 99. You cannot guarantee the first guy, guy 100.

Answer to Question 2: Here's what the 100 people need to agree to: Guy number 100, who can see everyone's hat except his own will say 'black' if he sees an even number of black hats, or he will say 'white' if he sees an odd number of black hats. This will also work if you do the same thing but in regards to the odd or even number of white hats.) If there are no black hats, he takes '0' to be an even number. So here's how it works. Imagine that there are 50 black hats and 50 white hats, starting with guy 100 having a black hat, the next guy having a white hat, with the hats continuing to alternate in this fashion--black, white, black, white, etc.,--all the way to guy 1. Guy 100 will look down the line and see 50 white hats and 49 black hats, so he will yell 'black.' Luckily, he will live, because it just so happens he has a black hat. But what everyone else down the line will know is that guy 100 sees an odd number of black hats. Guy 99, then, looks and sees 49 black hats, so he knows that he must not have a black hat, since if he did, he would see 48 black hats, not 49. So guy 99 now knows that he has a white hat, so he says 'white' and lives. Guy 98 sees 48 black hats, and so he knows that he must be one of the guys with a black hat. Guy 98 says black' and lives. And so on down the line.

Now in the example above, it just so happens that guy 100 got lucky and lived. But he could have just as well gotten the color of his own hat wrong. So you cannot guarantee guy 100's life. But if they stick to the above code, they can guarantee 99 lives, which is the best they can do.



Back to Two Puzzles
Back to Meg's Teaching Page
Back to Meg's Main Page
Page Last Updated: Jan. 11, 2006