Pages

Bookmark and Share
Showing posts with label hat. Show all posts
Showing posts with label hat. Show all posts

Wednesday, November 5, 2014

Prisoners With Hats Again

This is a generalization of the latest logic problem in MIT's Technology Review, November/December 2014 There are $n$ prisoners, $a_1, a_2, \dots, a_n$ where each prisoner is a perfect logician. Also, $a_n$ is blind but the other ones can see.

Initially they're all blindfolded. There are $n$ white hats and $n-1$ black hats, and out of those $2n-1$ hats, $n$ hats are randomly selected, and the rest hidden. Each prisoner is then given one of those $n$ hats to wear. At the same time, all the blindfolds are taken off.

Then the prisoners said the following things, in this order:
$a_1$ said: "I don't know my hat color."
$a_2$ said: "I don't know my hat color."
$a_3$ said: "I don't know my hat color."
...
$a_{n-1}$ said: "I don't know my hat color."
$a_n$ said: "I know my hat color."

What is $a_n$'s hat color?

Solution

If $a_1$ saw all black hats, then he would know that his hat is white, because there are at most $n-1$ black hats in the room. Because he doesn't know his hat color, then at least one of $a_2,\dots,a_n$ is white.

Likewise, if $a_2$ saw all black hats among $a_3, \dots, a_n$, given the information that at least one of $a_2, \dots, a_n$ is white, he would know that his hat is white. Because $a_2$ doesn't know his hat color, then at least one of $a_3, \dots, a_n$ is white.

We can continue this line of reasoning via induction. The hypothesis is that at least one of $a_k, \dots, a_n$ is white. If $a_{n-1}$ saw that $a_n$ has black, he would know that he has white. Because $a_{n-1}$ doesn't know his hat color, that means $a_n$ has white.

Friday, October 2, 2009

Prisoners and hats

2047 prisoners are kept in a dungeon. One day, the King decided to do an experiment. They will each be given either a blue hat or a red hat and then collected in a room. Each prisoner can see the color of everyone else's hats but not his own. No form of communication is allowed. After a few minutes, the warden will come and ask each of them individually what he thinks the color of his hat is. They can answer "red" or "blue." Each prisoner must answer by whispering to the warden's ear, so that the other prisoners can't hear his answer. Those who can answer correctly will be freed, but those who answer incorrectly will be executed on the spot. The prisoners found out about this experiment the night before, so they had some time to devise a scheme to ensure they can save as many people as possible.

Question 1: What is the scheme that allows everyone to live in this case?

Suppose now the King decided to alter the experiment a little bit. The warden will come to the room immediately after everyone get their hats. Each prisoner is allowed to answer "red", "blue", or "I don't know." If everyone answers "I don't know", they will all be executed. If someone answers "red" or "blue" and he is wrong, they will all be executed. Otherwise, everyone is freed at the same time. In other words, in order for them to live, at least one person must answer "red" or "blue" and he must be right. As before, the prisoners can't hear everyone's answers, and the release or execution is delayed until everyone had given their answers.

Question 2: What is the scheme that allows everyone to live with the highest probability? What is that probability?