Can you solve the hat riddle?
A logic puzzle involving four prisoners buried in sand and wearing colored hats is presented and solved. The solution hinges on prisoner B using the silence of prisoner A as information. A bonus connection is made to a real-world hacking technique called timing attacks.
Summary
The transcript presents a classic logic puzzle in which four prisoners are buried neck-deep in sand. Three face a wall in a line, while the fourth is on the other side of the wall. Each prisoner can only see the hats of those in front of them. There are two black and two white hats distributed among them, and the prisoners must correctly identify their own hat color to go free.
After a minute of silence, prisoner B shouts the correct answer. The explanation is rooted in logical deduction: if prisoners B and C had been wearing the same color hat, prisoner A — who could see both — would have immediately known their own hat color by process of elimination and spoken up. A's silence therefore signals to B that B and C must be wearing different colors. Since B can see that C is wearing white, B deduces that their own hat must be black.
The transcript then draws a surprising real-world parallel: timing attacks used by hackers to steal passwords. Some servers validate passwords by checking each character sequentially. If a server takes slightly longer to reject a password, it may indicate that more characters were correct before a mismatch was found. Hackers exploit this timing difference — measured in fractions of a millisecond — to iteratively determine each character of a stored password, illustrating that the absence or delay of a response can itself carry meaningful information.
Key Insights
- Prisoner A's silence is the critical piece of information — it tells prisoner B that B and C cannot be wearing the same color hat, because if they were, A would have immediately known their own hat color.
- Prisoner B solves the puzzle not by seeing their own hat, but by reasoning about what another prisoner's inaction logically implies about the hat distribution.
- The narrator explicitly frames this as 'a strange case where silence carries information,' connecting the abstract puzzle to a broader principle about negative or absent signals conveying meaning.
- Some servers check password characters sequentially one by one, and hackers exploit the resulting timing differences — where a longer delay suggests more correct characters — to reconstruct passwords letter by letter.
- The timing attack analogy directly mirrors the hat riddle's logic: just as A's silence reveals information, a server's response delay reveals how many password characters are correct before a mismatch.
Topics
Transcript
[0:00] Here's the problem. You and three amigos are buried neck deep in sand in a prison yard facing a life sentence. The guards offer you a deal. Guess your hat color and you all go free. There are two black hats and two white hats. Three of you are in a line facing a wall and the fourth is on the other side of the wall. Each of you can only see the hats of the people buried in front of you. A minute passes in silence and suddenly one of you shouts out the correct answer and it's not a guess. You guys all go free. So, which one of you was it and how did you know?…
Full transcript available for MurmurCast members
Sign Up to AccessMore from Veritasium
Why does this place get the most Total Solar Eclipses?
A deep dive into total solar eclipses featuring NASA observations during Spain's 2026 eclipse, explaining why the Northern Hemisphere experiences more total eclipses, the physics of eclipse phenomena like shadow bands and Bailey's beads, and the historical discovery of helium through eclipse observations.
How do submarines know where they are?
Submarines cannot use GPS underwater because radio waves are absorbed by seawater. Instead, they navigate using sonar mapping, fiber optic gyroscopes to determine orientation, and accelerometers to measure movement and distance traveled.
Can you actually swing from spider silk?
Spider silk is stronger than steel by weight and tougher than Kevlar due to its unique combination of rigid nanocrystals and stretchy amorphous regions. Scientists have successfully created transgenic silkworms that produce spider silk proteins, enabling the first-ever swing from artificial spider silk, though the material's thinness creates practical challenges.
How much LSD should you give an elephant?
The video explores why drug dosage doesn't scale linearly with animal mass, using the tragic case of Tusco the elephant to introduce scaling laws in biology. It explains Kleiber's law (metabolic rate scales as mass^3/4), the WBE theory that explains this through fractal network geometry, and how similar scaling principles apply to cities and human lifespans.
The Most Controversial Thought Experiment In Physics
This transcript explains Schrödinger's Cat, a famous quantum mechanics thought experiment where a cat in a sealed box exists in a superposition of being both alive and dead simultaneously until the box is opened and measured. The experiment illustrates the counterintuitive nature of quantum superposition when scaled up to macroscopic objects.