February 6, 2023

# can you solve it? Prisoners and boxes

Today’s puzzle involves two prisoners. Let’s call them Piper and Alex. You will be asked to come up with a strategy that gives them their freedom.

Puzzles about prison escape strategies are a relatively new type of mathematical challenge, only a few decades old. They emerged from computer science. A prison where access to information is limited is the perfect place for puzzles about how to communicate information effectively.

The solution to today’s riddle will blow your mind. If it doesn’t, lock me.

Now back to Piper and Alex.

four boxes

Piper and Alex share a cell. A guard comes and tells them that they will face a challenge where they can gain their freedom. It involves taking both prisoners one after the other into a separate cell with the same empty boxes numbered 1, 2, 3 and 4. The procedure is as follows:

i) Piper will be taken to the new cell. The guard will then take a piece of paper from his pocket and randomly place it in one of the four boxes. Piper will see which box the paper is in. The guard will close the boxes. He will flip a coin and put it in Box 1. He will flip another coin and put it in Box 2 and so on for Boxes 3 and 4. Each coin has a 50/50 chance of getting heads or tails. Piper will be able to see the faces of all coins.

ii) Piper must flip a single coin. (You can choose any of the four coins, and when it does, it becomes a head letter and vice versa.) It is then removed from the cell and taken to a third cell on its own.

iii) Alex is now taken to the cell with the boxes. He will not be able to see inside the boxes because they are closed. But he will be able to see the faces of the coins. You will be asked to open a box. If there is paper in the box, both prisoners are released. If there is no paper in it, the prisoners are sent back to their cells.

What strategy guarantees the liberation of detainees?

Prisoners are allowed to discuss their strategy and agree on a plan before Piper is taken to the cell with the boxes. But when Piper enters that cell, she has no contact with Alex except for the ‘message’ she gives by flipping a single coin.

This is a great puzzle because it seems completely impossible for Piper to have a way of communicating to Alex with a single coin which box is paper when she has to consider four possible positions and 16 possible combinations of heads and tails. . You will be amazed by the result when you see it.

As with many puzzles, the way to tackle this is to simplify the situation, to see if any insights emerge. Let’s do this. Try to solve the same puzzle when there are only two boxes in the cell. So Piper will be taken to a room with only TWO boxes. The guard goes through silly things like putting the paper in one of the boxes and placing a random coin in each box. Each coin has a 50/50 chance of getting heads or tails. Piper will be able to see the face of both coins.

When there are only two boxes, how does Piper only flip one coin to tell which box the paper is in?

In other words, what strategy will ensure that prisoners gain their freedom?

If you solve the two-box version, you’ll be doing well. If you solve the four-box version, you will be top of the class.

I’ll be back with solutions at 17:00 in the UK. NO SPOILER by the way. Instead, discuss your favorite prison movies and which two inmates you think have the best chance of solving this puzzle.

Thanks to retired computer scientist Pierre Chardaire who wrote the puzzle.

Here I do a jigsaw puzzle on a Monday every two weeks. I’m always on the hunt for great puzzles. Email me if you want to suggest one.

I give talks (online and face-to-face) about math and puzzles at school. Please get in touch if your school is interested.

#### Aoron

View all posts by Aoron →