### Another Hat Puzzle

Source: Stanford student Haidong Wang

A teacher puts on 10 hats of either red or blue on 10 students. Each one can see the hats on all other 9 students, but not his own. The teacher tells them that at least one of the hat is blue. The teacher asks each one to write down the color of his hat if he's sure about it, or he can write down "don't know" if he can't deduce its color. Everyone reveals their answer at the same time and all of them write "don't know". The second day, they gather again and the teacher puts on the same hats. Each one has to think about the color of his hat again. This time, still no one can figure out his hat color (i.e. everyone writes down "don't know"). This game repeats in the same way on third day, fourth day, ..., until the ninth day. Still no one figures out. However, on the tenth day, everyone writes down the correct color of his hat. So explain what happened? And what's the color they wrote down? Assume throughout the 10 days, those students do not communicate with each other. And also assume everyone is smart and knows everyone else is smart, and so on.

Update (11/12/09): Solution posted by viki in comments!!

1. 10 blue hats.....If there were n blue hats then on nth day, all the n people with blue hats can claim they are wearing blue hats.....assuming hats are not changed during the game.....not thought about the case.

2. It is specified in the question that hats are not changed during the game.

Proof:
If there are k blue hats, then all of them can tell at time k, that they are wearing blue hats. This can be proved by induction. If there is only one blue hat. He sees that no one has a blue hat. But there has to be someone with a blue hat. So, it must be him. He gets it in day 1.

If there were 2 blue hats. They will think that if there were only one blue hat, then the person would have said it on the first day. So, I must also be having a blue hat.

and so on.

So, on kth day, all k people realise that they have blue hats. Since, here k = 10, there are 10 people with blue hats.
:)

3. A similar puzzle also exists in context of husband cheating their wives.

Every man in a village of 100 married couples has cheated on his wife. Every wife in the village instantly knows when a man other than her husband has cheated, but does not know when her own husband has. The village has a law that does not allow for adultery. Any wife who can prove that her husband is unfaithful must kill him that very day. The women of the village would never disobey this law. One day, the queen of the village visits and announces that at least one husband has been unfaithful. What happens?

If k husbands have cheated, at the kth day, all k would be killed by their wives.