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 many batteries would it take to power a human?
The video explores how many AA batteries it would take to power various animals and humans, using energy comparisons to illustrate biological power consumption. A human at rest requires about 30 AA batteries to run for one hour. The video concludes with a sponsored segment for the Anker Prime power bank.
How Alpha Particles Can Break Computer Chips
In 1978, Intel discovered that radioactive contamination in ceramic chip packaging was causing spontaneous bit flips in their DRAM chips. Trace amounts of uranium and thorium emitted alpha particles that created free charge carriers in silicon, flipping stored data. The findings prompted the semiconductor industry to significantly tighten controls over radioactive materials in chip manufacturing.
How does a sewing machine work?
This transcript explains how sewing machines create lock stitches using a rotating hook mechanism. It covers the historical development of the bobbin-based rotating hook system patented by Wilson in 1851, which became the foundation for most modern sewing machines.
Can the CIA really track your heartbeat from 60 km away?
This video investigates the claim that the CIA used a quantum magnetometry device called 'Ghost Murmur' to detect a downed airman's heartbeat from kilometers away during a 2026 rescue operation in Iran. The video breaks down the physics of NV diamond magnetometers and concludes that detecting heartbeats at such distances is physically implausible by roughly 18 orders of magnitude. The story is likely either CIA disinformation to conceal simpler rescue methods or sensationalized reporting by the New York Post.
How This Miracle Drug Disappeared Over Night
In 1998, Abbott Laboratories' HIV drug ritonavir suddenly failed quality control when a new, more stable crystal form (Form II) began appearing and spreading uncontrollably. This phenomenon, known as polymorphism, occurs when a compound's molecules rearrange into a different crystal structure with different physical properties. The crisis ultimately forced Abbott to abandon the original capsule formulation entirely.