Nov 8, 2009

Prisoners and Hats

There are N prisoners, but there is 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:
I will put a hat, either white or black, on the head of each of you. You can see others' hats, but you can't see your own hat. You are given 20 minutes. I will place at least one white hat and at least one black hat. All of you should tell me the colour of the hat on your head. You can't signal to others or give a hint or anything like that. You should say only WHITE or BLACK. You can go and discuss for a while now.
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, what strategy could the prisoners have applied??


  1. Listening to what colour the other prisoners say to them.

  2. No but that wouldn't mean that every prisoner who says a colour survives because that may not necessarily be the same as the colour of his own hat (since essentially, every prisoner is saying the colour of another prisoner)

  3. even and odd marking of the hats..let choose black hat will be marked as even or odd...code for even and and white resp.

    the last prisoner will speak out in front of him thr are even no. of black the N-1th can see how many black hats are thr..and know the color of his hat by getting even or odd....
    everyone else will get the same thing..
    so we can save N-1 for sure and N if lucky