Can you solve the prisoner hat riddle? – Alex Gendler


You and nine other individuals
have been captured by super intelligent alien overlords. The aliens think humans look quite tasty, but their civilization forbids eating
highly logical and cooperative beings. Unfortunately, they’re not sure
whether you qualify, so they decide to give you all a test. Through its universal translator, the alien guarding you
tells you the following: You will be placed in a single-file line
facing forward in size order so that each of you can see
everyone lined up ahead of you. You will not be able to look behind you
or step out of line. Each of you will have either a black
or a white hat on your head assigned randomly, and I won’t tell you
how many of each color there are. When I say to begin, each of you must
guess the color of your hat starting with the person in the back
and moving up the line. And don’t even try saying words
other than black or white or signaling some other way,
like intonation or volume; you’ll all be eaten immediately. If at least nine of you guess correctly,
you’ll all be spared. You have five minutes to discuss
and come up with a plan, and then I’ll line you up,
assign your hats, and we’ll begin. Can you think of a strategy guaranteed
to save everyone? Pause the video now
to figure it out for yourself. Answer in: 3 Answer in: 2 Answer in: 1 The key is that the person
at the back of the line who can see everyone else’s hats
can use the words “black” or “white” to communicate some coded information. So what meaning can be
assigned to those words that will allow everyone else
to deduce their hat colors? It can’t be the total number
of black or white hats. There are more than two possible values, but what does have two possible values
is that number’s parity, that is whether it’s odd or even. So the solution is to agree
that whoever goes first will, for example, say “black” if he sees
an odd number of black hats and “white” if he sees
an even number of black hats. Let’s see how it would play out
if the hats were distributed like this. The tallest captive sees three black
hats in front of him, so he says “black,” telling everyone else
he sees an odd number of black hats. He gets his own hat color wrong,
but that’s okay since you’re collectively allowed
to have one wrong answer. Prisoner two also sees an odd
number of black hats, so she knows hers is white,
and answers correctly. Prisoner three sees
an even number of black hats, so he knows that his must be
one of the black hats the first two prisoners saw. Prisoner four hears that and knows that she should be looking for
an even number of black hats since one was behind her. But she only sees one, so she deduces
that her hat is also black. Prisoners five through nine are each
looking for an odd number of black hats, which they see, so they figure out
that their hats are white. Now it all comes down to you
at the front of the line. If the ninth prisoner saw
an odd number of black hats, that can only mean one thing. You’ll find that this strategy works
for any possible arrangement of the hats. The first prisoner has a 50% chance of
giving a wrong answer about his own hat, but the parity information he conveys allows everyone else
to guess theirs with absolute certainty. Each begins by expecting to see an odd
or even number of hats of the specified color. If what they count doesn’t match,
that means their own hat is that color. And everytime this happens, the next person in line will switch
the parity they expect to see. So that’s it, you’re free to go. It looks like these aliens
will have to go hungry, or find some less logical
organisms to abduct.


100 Responses

  1. Govi Carol

    October 3, 2019 7:04 pm

    WHAT!? How is no one seeing this: THE GUY IN THE BACK JUST TELLS THE PERSON IN FRONT WHAT COLOR THEIR HAT IS IN THE FIRST PLACE, AND SO ON DOWN THE LINE! Or the opposite color! Did i fast-forward too much and miss something?!

  2. breon wilson

    October 5, 2019 7:42 pm

    I understand the idea, but in a world full of idiots, they’d all be dead. Counting on the intellectual deduction of a group of people is foolishish. Honestly, I’d just try and make a run for it.

  3. v Bremont

    October 6, 2019 11:14 pm

    internet MAGNA CARTA for banks & regulations transparency and facts/ Getting the Barons to agreed/ / the charter is done. 👽 EVEN the UN needs a MAGNA CARTA FOR THE WEB/ / MAGNA CARTA/ benefit to police & plotters/ search engines dispute, from Bing to bing & google & Bing/ all on the google store / 🐣🐣/ a good gesture for clean air/ a philosophical change of climate on practical terms 😇 the amazons of information & applications/ edge DEV/ 👽.

  4. Keith West

    October 9, 2019 1:29 am

    If i were the last one and it was all up to me, I would probably panic and shout "Uhh… uhh. WHITE!" and doom us all.

  5. Mepnet

    October 11, 2019 11:28 pm

    imagine if you want to relax in your swimming pool, but flesh-eating aliens want to make you guess hat colors with other people.
    now THATS relatable

  6. Alecks Skcela

    October 16, 2019 2:13 pm

    Orrrr, the first person can just say out loud the colour chronogically. Since he can say the colour, he can say all the hats' colour that he sees, from second colour to tenth. Theres no rule say he can only say one word right

  7. Planet Arcade

    October 24, 2019 4:51 pm

    If their are 10 of them then they come up with a plan that the tallest one says the colour he sees and then says it after that it doesn't matter of he is wrong or right because he told the colour of the one in front of him meaning that the one in front knows the colour of their hat

  8. Planet Arcade

    October 24, 2019 4:52 pm

    The digits of pi are 3.1415926535891639163016381937474666829193744748282746572001011047491003847474728191037475929475721000374662929474768291010374662920104887263332373737476372919110024847562929945649292762819014747747299466572829497477391914665729191

  9. Very_Very_ Kondor

    October 25, 2019 9:21 pm


  10. 「 ItzMøcha 」

    October 26, 2019 1:13 am

    OR you take off the hat because the aliens will let you go since they see that you’re able to use obvious situations

  11. First World Problems

    October 28, 2019 10:54 pm

    I mean, like no offence to humanity but I wouldn't trust that most people would understand the reasoning and therefore some people would be completely unable to do it.

  12. Dillon Young

    October 31, 2019 5:30 pm

    The problem with these riddles is that its unlikely to have a group of competent and willing individuals. It doesnt matter the size of the group.

  13. ThisIsSolution

    November 2, 2019 7:39 pm

    False: 1:44 this answer is assuming that the others know the pre conceived notion that he is describing an even or odd number instead of a hat color. Unless they use telepathy to convey that info they are eaten for speaking out of rule parameters

  14. Chinelo Alegre

    November 7, 2019 1:56 am

    I would make the tallest one to say the color the he sees in front of him and then the next one would know the color of his hat

  15. ShikasiXMS

    November 7, 2019 3:22 pm

    In reality we probably need an hour to convince everyone that this strategy works, so nobody fucks it up

  16. Pedro Santos

    November 9, 2019 12:32 am

    Aliens: "you have to prove you're rational beings"

    Also aliens: "You can't use 99% of possible rational solutions"

  17. Sharon Hilder

    November 9, 2019 1:38 am

    Hey ted Ed just in case your having a bad day I love you and please never quit I watch you everyday and you are amazing!

  18. Vikas Mehra

    November 10, 2019 2:23 am

    person behind should tell the colour who is infront of him, this way they can have 9 correct… its_halwa

  19. Joshua Kohler

    November 11, 2019 7:56 pm

    You can just say the colours in the order you can see them (ur the tallest) and then everyone else will know their colour and it doesn’t matter if you get yours wrong because if 9 people get theirs right then everyone lives


Leave a Reply