Can you solve the prisoner hat riddle? - Alex Gendler

TED-Ed TED-Ed Oct 04, 2015

Audio Brief

Show transcript
This episode covers a classic logic puzzle where ten people must coordinate to guess their hat colors and survive an alien challenge. There are three key takeaways. First, the solution hinges on communicating the parity of observed hat colors. Second, the first person speaking sacrifices their guess to announce this crucial parity information. Third, subsequent individuals deduce their own hat color using this initial cue, combined with observed hats and prior guesses. The group must pre-agree on a code, such as "black" for an odd number of black hats seen, or "white" for an even number. This initial announcement provides the critical data point for everyone else. Each person down the line then updates their understanding based on the hats they still see in front of them and the guesses made by those before them. This allows them to eliminate possibilities and deduce their own hat color. This strategy guarantees that everyone except the first person will guess correctly, ensuring the required nine out of ten correct answers for survival. It demonstrates how a single bit of shared information can solve a complex problem.

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.