Can You Figure Out the Answer to This Clever Prisoner Hat Puzzle?

Here’s another classic maths riddle for you: if people were lined up from tallest to shortest (meaning a person can see everything in front of them) and all wearing black or white hats, can you figure out which colour hat you were wearing even if you had no idea how many black or white hats there were total? The answer is yes, you can!

Alex Gendler explains for Ted-Ed how simple it is to do. But first, the problem: there are 10 people lined up from tallest to shortest each wearing a different hat colour (black or white). The entire group doesn’t know how many black or white hats there are and you can only see the people in front of you but you have to guess what colour your hat is. In fact, the entire group needs to guess 9 of the 10 hat colours correctly.

How does a group do it? Watch the video below.

It requires a bit of code and trickery but if you assign odd and even to the terms black and white for the tallest person that’s furthest back, it all makes sense.

This article originally appeared on Sploid, Gizmodo's blog of delicious brain candy