BrainDen.com - Brain Teasers
• 1

# Hats on a death row!! One of my favorites puzzles!

## Question

If you don't already know this one, I'm sure you will find it very interesting and fun to solve! And if you do find the answer (or already know it) please put it under a spoiler tab so that you don't take the fun from the rest of the intelligent people in this forum....

Here we go....

You are one of 20 prisoners on death row with the execution date set for tomorrow.

Your king is a ruthless man who likes to toy with his people's miseries. He comes to your cell today and tells you:

“I’m gonna give you prisoners a chance to go free tomorrow. You will all stand in a row (queue) before the executioner and we will put a hat on your head, either a red or a black one. Of course you will not be able to see the color of your own hat; you will only be able to see the prisoners in front of you with their hats on; you will not be allowed to look back or communicate together in any way (talking, touching.....)

(The prisoner in the back will be able to see the 19 prisoners in front of him

The one in front of him will be able to see 18…)

Starting with the last person in the row, the one who can see everybody in front of him, he will be asked a simple question: WHAT IS THE COLOR OF YOUR HAT?

He will be only allowed to answer “BLACK” or “RED”. If he says anything else you will ALL be executed immediately.

If he guesses the right color of the hat on his head he is set free, otherwise he is put to death. And we move on to the one in front of him and ask him the same question and so on…

Well, good luck tomorrow, HA HA HA HA HA HA!”

Now since you all can communicate freely during the night, can you find a way to guarantee the freedom of some prisoners tomorrow? How many?

Note that solution for this puzzle is already given in the following post by bonanova.

• Created

## Recommended Posts

• 0

since the last person is gonna be executed first and he can see the the hat of the previous person h can tell the hat colour of of the next person to be executed i.e, the 20th person on queue can say the hat colour of 19th person, so that the first person to be executed will have 50% chance of survival and the rest will have 100% chance.... so 19 or even 20 prisoners can escape death.

##### Share on other sites

• 0

oh sorry about the number not all can survive at least half or more than half can survive that way.....

##### Share on other sites

• 0

On the same train of thought: The 20th person can tell the tenth person and the 19th can tell the ninth person, and so on. It makes for pretty much the same odds but it seems that this way your giving the first ten to be executed a higher chance. If you did alternating people telling the person in front of them what the color of the hate is then the said person is also relying on the chance that his hat is the same. And unless the king did two black then two red then two black etc. then not everyone could be saved. By saving the last half, there is a better chance that the first half is the same if the king was following any sort of a pattern, whatever it be.

Ps: I know that I'm really bad at explaining things, and I probably made that sound much more complicated then it is.

##### Share on other sites

• 0
I'm quite sure there's no winning strategy with 20+ possible hat colors, of course. What's the limit?

Actually it would work for 20 hat colors if they knew all of the colors beforehand, they just have to remember what colors have been said. Each prisoner could tell their color by those in front of him, it would just be the color he hasn't heard and can't see. They would need a good memory though.

##### Share on other sites

• 0
Actually it would work for 20 hat colors if they knew all of the colors beforehand, they just have to remember what colors have been said. Each prisoner could tell their color by those in front of him, it would just be the color he hasn't heard and can't see. They would need a good memory though.

In the spirit of the OP, though, using 20 colors would only mean each hat could be any of the 20 colors.

Whether there are "two colors" or "twenty colors", all the hats could be black, for example.

That is, not all the colors need be used.

Check here for a multi-color method that makes no assumptions about using all the colors.

##### Share on other sites

• 0

They could just look up. if these were the days when they hung people the brimms would be visible to you, the king only said they couldn't look back.

##### Share on other sites

• 0

well a circle consits of a line

##### Share on other sites

• 0

I think i stated this in another similar thread but will repeat cause I was ignored. BUT

forget all the crazy math and binary what if you assigned each hat a tone, for example red=you shout your hat color, black= you use a normal voice, and for anyother hat you wisper.

THis satisfies all the rules, regardless of the number of hats, or people.

If there is a flaw, please piont it out

• 0

this again?

##### Share on other sites

• 0
If you don't already know this one, I'm sure you will find it very interesting and fun to solve! And if you do find the answer (or already know it) please put it under a spoiler tab so that you don't take the fun from the rest of the intelligent people in this forum....

Here we go....

You are one of 20 prisoners on death row with the execution date set for tomorrow.

Your king is a ruthless man who likes to toy with his people's miseries. He comes to your cell today and tells you:

“I’m gonna give you prisoners a chance to go free tomorrow. You will all stand in a row (queue) before the executioner and we will put a hat on your head, either a red or a black one. Of course you will not be able to see the color of your own hat; you will only be able to see the prisoners in front of you with their hats on; you will not be allowed to look back or communicate together in any way (talking, touching.....)

(The prisoner in the back will be able to see the 19 prisoners in front of him

The one in front of him will be able to see 18…)

Starting with the last person in the row, the one who can see everybody in front of him, he will be asked a simple question: WHAT IS THE COLOR OF YOUR HAT?

He will be only allowed to answer “BLACK” or “RED”. If he says anything else you will ALL be executed immediately.

If he guesses the right color of the hat on his head he is set free, otherwise he is put to death. And we move on to the one in front of him and ask him the same question and so on…

Well, good luck tomorrow, HA HA HA HA HA HA!”

Now since you all can communicate freely during the night, can you find a way to guarantee the freedom of some prisoners tomorrow? How many?

Easy the first will sacrifice and be trust full on his luck, but is he maid as question, BLACK?, is a key for the next be said Black, if he just said BLACK!, then the next is Red,,, and on the red options will be RED? means black for the next and RED! means RED for next one,,,,

I'm a math lover, but I don't really believe that maths will save me,, communications is the best here just find out how communicate based on the rules, looks my answer just 19 had 100% possibilities to be saved and 1 had 50%,,, is a good number from a math point of view.

See you !!

##### Share on other sites

• 0

It may be simple. The prisoners can guess the color of their hat by looking through the kings eyes or the person who asks the color of the prisoner's hat. Bcause its not that hard to differentiate between Red and Black colors by seeing the eyes of a person standing opposite to us.The colour would be easily visible.

##### Share on other sites

• 0

Karthi: nice ;D the only 20/20 answer, lol (haha no pun intended with the eyes-thing and 20/20)

##### Share on other sites

• 0

O.K., I fully understand how this works with the "even/odd" solution, but what I just cant get past is the actual distribution order, op say's its irrealevent, I dont get that, I would think that has everything to do wih it, what I would like would be for someone to give me an example (or two) of the conversation the prisoners had the night before to come up with a strategic solution. The ONLY way this puzzle would work is if in fact there are an equal amount of black hats to red period. Perhaps the prisoners figured out that any other distribution order would never work, and it would soley be a guessing game with no strategy if the hats were NOT 10 r 10 b, (Hmmm, this may also be why its irrealevent <_< )

so that would be when they come up with "even/odd" scheme. Right?

##### Share on other sites

• 0

Garunteed to save ALL prisoners except 1 (50%luck), no matter how many prisoners the king may have.

P = Prisoner

1) The first P will say the colour of the hat of the P in front of him and has 50% chance he is wearing the same hat.

2) The next prison will know the colour of his hat and can see the hat in front of him, all he has to do is say the colour of his own hat

3) But at the same time, tell the next guy his hat, how? well

If its the same colour he says hes hat colour LOUD and

If its different hes it quietly.

4)Now the next guy knows his colour and we just have to repeat the process until all except maybe 1 are free

Edited by MasterJediBob
##### Share on other sites

• 0
Garunteed to save ALL prisoners except 1 (50%luck), no matter how many prisoners the king may have.

P = Prisoner

1) The first P will say the colour of the hat of the P in front of him and has 50% chance he is wearing the same hat.

2) The next prison will know the colour of his hat and can see the hat in front of him, all he has to do is say the colour of his own hat

3) But at the same time, tell the next guy his hat, how? well

If its the same colour he says hes hat colour LOUD and

If its different hes it quietly.

4)Now the next guy knows his colour and we just have to repeat the process until all except maybe 1 are free

I said the samething twice and no one has made a comment, but i like the guy who talks about using eye reflections

##### Share on other sites

• 0
I said the samething twice and no one has made a comment, but i like the guy who talks about using eye reflections

I like the way you have given the answer. I think it will be the easiest and better one among all answers.

##### Share on other sites

• 0
I like the way you have given the answer. I think it will be the easiest and better one among all answers.

Actually this solution has been "replied" to, a couple of times, "you will not be able to communicate with each other in ANY way"

so the high pitch, low pitch voice would be a form of communication, same thing goes for the long reeeddddd or short black....again form of communication.

##### Share on other sites

• 0

Take off the hat and LOOK at it ?

##### Share on other sites

• 0

this is like the classic interveiw puzzle with the black and white dot on the forehead. But there is something missing here. Where in the puzzles did it ever mention there is 10 red and 10 black hats? What if there is 9 red and 11 black? How will the solution apply? With the information given, I will say everyone have a 50% chance of guessing correctly.

##### Share on other sites

• 0
this is like the classic interveiw puzzle with the black and white dot on the forehead. But there is something missing here. Where in the puzzles did it ever mention there is 10 red and 10 black hats? What if there is 9 red and 11 black? How will the solution apply? With the information given, I will say everyone have a 50% chance of guessing correctly.

From what other people have said in their posts, guessing the odd number works with the first person as the scape goat. In your example of 9 red and 11 black, let's say person 1 has a R. He counts 8R, 11B therefore guesses the odd (B), and dies (poor guy). P2 now knows that P1 saw an odd number of B, and there is now one less R. So if P2 counts 7R and 11B, he can guess R, and live. If he sees 8R and 10B, he can guess B and live.

So say P2 has R. P3 knows that the first guess of the odd B was wrong, so 1P had R, 2P had R, therefore there should be an odd number of R(7), and an odd number of B (11). Depending on what color he sees an even number of, he is wearing that color. He doesn't have to know the number, just the even or odd.

Guess P1 B of odd was wrong, so after that, there was an even R, and an odd B. Guess P2 of R showed he saw an odd R and an odd B, knowing B was odd before, and R is even, he can guess with the even and be safe. Then P3 knows that R is again odd and B is still odd (because there has been no change in B). Whatever color he sees as an even, he is wearing the last one, making it odd.

I hope that helps!

What an interesting solution, and kudo's to everyone that figured it out!

##### Share on other sites

• 0
From what other people have said in their posts, guessing the odd number works with the first person as the scape goat. In your example of 9 red and 11 black, let's say person 1 has a R. He counts 8R, 11B therefore guesses the odd (B), and dies (poor guy). P2 now knows that P1 saw an odd number of B, and there is now one less R. So if P2 counts 7R and 11B, he can guess R, and live. If he sees 8R and 10B, he can guess B and live.

So say P2 has R. P3 knows that the first guess of the odd B was wrong, so 1P had R, 2P had R, therefore there should be an odd number of R(7), and an odd number of B (11). Depending on what color he sees an even number of, he is wearing that color. He doesn't have to know the number, just the even or odd.

Guess P1 B of odd was wrong, so after that, there was an even R, and an odd B. Guess P2 of R showed he saw an odd R and an odd B, knowing B was odd before, and R is even, he can guess with the even and be safe. Then P3 knows that R is again odd and B is still odd (because there has been no change in B). Whatever color he sees as an even, he is wearing the last one, making it odd.

I hope that helps!

What an interesting solution, and kudo's to everyone that figured it out!

I'm not sure that I understand your logic, from the beginning, how exactly would P2 "know" what P1 saw or what he was thinking for sure? With the example "11 / 9" there is no viable way to come up with any kind of logical "even odd" scheme, (that I can see <_< ) and believe me, I'm trying real hard to try and get my head around it, but I seriously believe that no other way except for 10R 10B would work for even odd. Given your solution, try to imagine what the conversation was the night before by the prisoners, (their plan of action.)

##### Share on other sites

• 0
I'm not sure that I understand your logic, from the beginning, how exactly would P2 "know" what P1 saw or what he was thinking for sure? With the example "11 / 9" there is no viable way to come up with any kind of logical "even odd" scheme, (that I can see <_< ) and believe me, I'm trying real hard to try and get my head around it, but I seriously believe that no other way except for 10R 10B would work for even odd. Given your solution, try to imagine what the conversation was the night before by the prisoners, (their plan of action.)

I think from earlier posts it was implied that the prisoners would agree the first person would guess the odd number of whatever color he would see, so his guess tells the other prisoners the what the "odd" color to him is, and the result of his guess gives them another clue onto what his hat color is. The next person can guess based on what he sees, and get it right using the even and odd amount of hats, what was even/odd, and the color of the previous persons hat. I have it worked out in my head, but it's difficult to explain, to put into words.

##### Share on other sites

• 0
I think from earlier posts it was implied that the prisoners would agree the first person would guess the odd number of whatever color he would see, so his guess tells the other prisoners the what the "odd" color to him is, and the result of his guess gives them another clue onto what his hat color is. The next person can guess based on what he sees, and get it right using the even and odd amount of hats, what was even/odd, and the color of the previous persons hat. I have it worked out in my head, but it's difficult to explain, to put into words.

Well ok, so lets use the same example 11R 9B.........What's the "odd" one? there both odd. The easiest way (for me) is visual, so I drew 20 prisoners standing in a line and randomly chose which ones would wear the red hats and which ones would wear the black hats, (using the famous 11R 9B theory) you will be able to see right away there is no possible way for P1 to make a logical determination, he looks down the line and see's for example 10R and 9B (his own hat would make 11R, however he doesn't know that) so he see's an odd # of black hats, using your example he would say "black" and then get beheaded . Even if he were to have chosen to say the even # of hat color, all it would have been was a "lucky guess" because there would be no logical explanation to back it up.

##### Share on other sites

• 0

I found a slightly different solution. Assign a number to the two colours.

Lets say '+1' to RED and '-1' to BLACK.

The last person then sums the hats he sees through multiplication.

e.g. He sees RED, BLACK, BLACK, ... , etc.

So, he calculates RED(+1)*BLACK(-1) is BLACK(-1).

The sum 'BLACK(-1)' in this case is then multiplied with the value of the colour of the next hat, or BLACK(-1) in the example, yielding RED(+1).

He continues doing so until he has multiplied all the colours of the hats in front of him.

He then shouts out the colour of the value (either +1 or -1) that he gets.

The second last prisoner will just have to calculate the product value of the eighteen hats in front of him and divide it with the value the last guy shouted to get the colour of his hat.

The third last will then divide the values given by the last and second last prisoners to get a new value, which will be used to be divided with the product value of the seventeen guys in front of him.

And so on, until the first prisoner answers.

##### Share on other sites

• 0
I found a slightly different solution. Assign a number to the two colours.

Lets say '+1' to RED and '-1' to BLACK.

The last person then sums the hats he sees through multiplication.

e.g. He sees RED, BLACK, BLACK, ... , etc.

So, he calculates RED(+1)*BLACK(-1) is BLACK(-1).

The sum 'BLACK(-1)' in this case is then multiplied with the value of the colour of the next hat, or BLACK(-1) in the example, yielding RED(+1).

He continues doing so until he has multiplied all the colours of the hats in front of him.

He then shouts out the colour of the value (either +1 or -1) that he gets.

The second last prisoner will just have to calculate the product value of the eighteen hats in front of him and divide it with the value the last guy shouted to get the colour of his hat.

The third last will then divide the values given by the last and second last prisoners to get a new value, which will be used to be divided with the product value of the seventeen guys in front of him.

And so on, until the first prisoner answers.

UMMM...HUH??? ...That really didn't clarify anything, leme guess, you a math teacher?

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.