The Game of the Prisoners

The game of the six prisoners with blue and red hats is a logic challenge where the prisoners have to guess the color of their own hats based on the colors of the hats of the prisoners in front of them in a line.

Description:
Six prisoners condemned to death find themselves in a cell. They are then informed that they will have the following opportunity to save themselves:

  • The prisoners will be placed in a line; then, each will receive a hat, which can be blue or red. Each prisoner can see the hats of all those in front of them in the line, but not the hats of all the others;
  • Starting from the last in line and then moving to the next, a guard will ask each prisoner:

What is the color of your hat?

  • The answer, to be given aloud for everyone to hear, must be only the word blue or red.
  • Prisoners cannot communicate with each other in any way, except to make a guess about the color of their own hat.
  • If at least five prisoners guess the colors of their hats correctly, they will all be released. Otherwise, they will go to the gallows.

How can they save themselves?

The key question is: What strategy can the prisoners use to maximize their chances of correctly guessing the color of their hats?

Learn more

GENDLER, Alex. Você consegue resolver o enigma dos prisioneiros e dos chapéus?. TED-Ed.
https://www.youtube.com/watch?v=N5vJSNXPEwA

Other interesting problems that use the concept of parity:
https://poti.impa.br/uploads/material_teorico/65suiubdebggo.pdf

How to do it at home/school

The problem can easily be simulated with a group of people arranged in ascending order, using birthday hats (for example). A person chosen to act as a “guard” should put the hats on everyone and then question each one, after the rules have been properly presented and time is reserved for the “prisoners” to devise a strategy together.

On page 291, a proposal for a classroom dynamic about the presented puzzle is detailed:

DUTRA, Dayana. Ferramentas Práticas para o Ensino da Probabilidade e Estatística na Educação Básica. Dissertação. Mestrado Profissional em Matemática em Rede Nacional – PROFMAT. Universidade Federal de Viçosa. 2021.
https://sca.profmat-sbm.org.br/profmat_tcc.php?id1=6184&id2=171053489

Skip to content