1. Home
  2. TED-Ed

Oct 4, 2015

Guess your own hat color or aliens eat you

4 min → 1:19

Overview

Alex Gendler presents a logic riddle where ten prisoners captured by aliens must devise a strategy to guess their own black or white hat colors so at least nine survive.

Quotes

“But what does have two possible values is that number's parity, that is, whether it's odd or even.”

▶ Watch at 2:07

“If at least nine of you guess correctly, you'll all be spared.”

▶ Watch at 1:19

Full summary

Episode Overview

  • Ten people are captured by aliens and must pass a logic test to avoid being eaten.
  • They are lined up by height, each wearing a randomly assigned black or white hat, and can only see the people in front of them.
  • Starting from the person at the back, each must guess their own hat color aloud.
  • To survive, at least nine out of the ten people must guess their hat color correctly.
  • They have five minutes to devise a strategy before the test begins.

Key Concepts

  • The puzzle is a classic example of using limited communication to convey complex information.
  • The solution hinges on the mathematical concept of parity—whether a number is even or odd.
  • The first person in the line (at the back) sacrifices their own guess to provide a crucial piece of coded information to the rest of the group.
  • By listening to the initial "parity" announcement and the subsequent guesses, each person can deduce their own hat color with 100% certainty.

Quotes

  • At 01:19 - "If at least nine of you guess correctly, you'll all be spared." - The narrator explains the critical condition for the group's survival, allowing for a single incorrect guess.
  • At 02:07 - "But what does have two possible values is that number's parity, that is, whether it's odd or even." - The narrator reveals the key insight that allows the group to encode information using only the words "black" or "white."

Takeaways

  • The first person to speak should not guess their hat color but instead convey the parity (even or odd) of the black hats they see.
  • The group must pre-agree on a code, such as "black" for an odd number of black hats and "white" for an even number.
  • Each subsequent person uses the initial parity information, combined with the hats and guesses they observe, to deduce their own hat color.
  • This strategy guarantees that everyone except the first person will guess correctly, ensuring the group's survival.
  • A single bit of shared information can be enough to solve a seemingly impossible problem for a coordinated group.

Watch the full episode 4 min

Read along with the audio summary

Ten people are captured by aliens and must pass a logic test to avoid being eaten, a puzzle the narrator raises. In this episode that came out on October 4, 2015, the narrator explains the classic puzzle. By the end, you will know how a single bit of shared information can save the entire group.

To survive the test, at least nine of the ten prisoners must guess their randomly assigned black or white hat color aloud. Lined up by height, the person at the back sacrifices their guess to announce the parity, meaning whether the number of black hats ahead is odd or even. By agreeing that black means odd and white means even, the group uses that clue and the hats and guesses they observe to deduce their own hat color with one hundred percent certainty, guaranteeing the nine correct answers needed to survive.

A coordinated group can solve a seemingly impossible problem when the first speaker uses a simple odd or even code instead of guessing. "If at least nine of you guess correctly, you'll all be spared."

Related Episodes