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
How Dangerous Are Non-Stick Pans?
Non-stick pans present three main concerns: Teflon itself is chemically inert and harmless if ingested, but overheating above 300°C can release harmful fumes; the chemicals used to manufacture the coating (PFAs or 'forever chemicals') are more dangerous and can leak into the environment; and research on whether these manufacturing chemicals end up on pans and their health effects as microplastics remains incomplete.
We're trying something new...
Veritasium launches a new channel called Ingenious focused on social science stories. The first video explores how Malcolm McLean's shipping container invention revolutionized global commerce, starting with his observation of inefficient cargo loading in 1954 and leading to the creation of the SS Ideal X in partnership with engineer Keith Tantinger.
What happens to these balloons when you open the valve?
A demonstration shows that when a valve opens between a large and small balloon, the large balloon gets bigger while the small one gets smaller—counterintuitively because the smaller balloon actually has higher pressure. This occurs because polymer chains in rubber are tangled when the balloon is small and unexpanded, making it stiffer, but relax as the balloon inflates, resulting in lower pressure in larger balloons.
The Insane Real Engineering of the Nazis' Enigma
This video explains how the Enigma encryption machine worked, why it was initially unbreakable, and how British codebreakers at Bletchley Park—led by Alan Turing—developed the Bombe machine to systematically crack Nazi messages by exploiting mathematical principles and human operator errors. The breakthrough intelligence shortened World War II by an estimated two years.
How An Orbit Can Heat A Moon
Europa's eccentric orbit around Jupiter, caused by orbital resonance with Io and Ganymede, results in constant tidal flexing that generates internal heat through friction. This tidal heating mechanism is strong enough to keep Europa's subsurface ocean liquid, with the effect being even more pronounced closer to Jupiter, explaining Io's extreme volcanic activity.