Fermat’s Room

Most movies related to mathematics irritate me because of simplifications. I especially do not like when a movie pretends to be intelligent and then dumbs it down. I recently watched the Spanish movie Fermat’s Room, which, as you may guess, annoyed me several times. In spite of that I enjoyed it very much.

The movie opens with people receiving invitations to attend a meeting for geniuses. To qualify for the meeting they need to solve a puzzle. Within ten days, they must guess the order underlying the following sequence: 5, 4, 2, 9, 8, 6, 7, 3, 1. Right away, at the start of the movie, I was already annoyed because of the simplicity of the question. You do not have to be a genius to figure out the order, not to mention how easy it would be to plug this sequence into the Online Encyclopedia of Integer Sequences to find the order in five minutes.

The participants were asked to hide their real names, which felt very strange to me. All famous puzzle solvers compete in puzzle championships and mystery hunts and consequently know each other.

The meeting presumably targets the brightest minds and promises to provide “the greatest enigma.” During the meeting they are given seven puzzles to solve. All of them are from children’s books and the so-called “greatest enigma” could easily be solved by kids. Though I have to admit that these were among the cutest puzzles I know. For example:

There are three boxes: one with mint sweets, the second with aniseed sweets, and the last with a mixture of the two. The boxes are labeled, but all the labels are wrong. What is the minimum number of sweets you need to taste to correctly re-label all the boxes?

Another of the film’s puzzles includes a light bulb in a room and three switches outside, where you have to correctly find the switch that corresponds to the bulb, but you can only enter the room once. In another puzzle you need to get out of prison by deciding which of two doors leads to freedom. You are allowed to ask exactly one question to one of the two guards, one of whom is a truth-teller and the other is a liar.

The other four puzzles are similar to these three I have just described. To mathematicians they are not the greatest enigmas. They are nice material for a children’s math club. For non-mathematicians, they may be fascinating. Certainly it’s a good thing that such tasteful puzzles are being promoted to a large audience. But they just look ridiculous as “the greatest enigmas.”

So what is it about this film that I so enjoyed?

The intensity of the movie comes from the fact that the people are trapped in a room that starts shrinking when they take more than one minute to solve a puzzle.

I well remember another shrinking room from Star Wars: A New Hope. When Princess Leia leads her rescuers to a room, it turns out to be a garbage compactor. The bad guys activate the compactor and two opposite walls start moving in. In contrast, Fermat’s room is shrinking in a much more sophisticated way: all four walls are closing in. Each of the walls in the rectangular room is being pressured by an industrial-strength press. The walls in the corners do not crumble, but rather one wall glides along another. I was more puzzled by this shrinking room than I was by the math puzzles. I recommend that you try to figure out how this can be done before seeing the movie or its poster.

However, the best puzzle in the movie is the plot itself. Though I knew all the individual puzzles, what happened in between grabbed me and I couldn’t wait to see what would happen next. I saw the movie twice. After the first time, I decided to write this review, so I needed to check it again. I enjoyed it the second time even better than the first time. The second time, I saw how nicely the plot twists were built.

Maybe I shouldn’t complain about the simplicity and the familiarity of the puzzles. If they were serious new puzzles I would have started solving them instead of enjoying the movie. The film’s weakness might be its strength.



  1. Jenny:

    I don’t think there’s a real answer to the sweets one. You could keep pulling out the same kind out of the mixed box, and never known if it was mixed or pure.

  2. DanielC:

    Remember “The boxes are labeled, but all the labels are wrong“, that’s a very helpful thing to know.

    BTW I think the answer is “one”.

  3. Brenda:

    The answer is 1.

    Draw a mint from the box labeled “mixed”. Since the labels are all wrong, the box labeled “mixed” must not be a mixed box at all. The first mint pulled will reveal the proper label for the box.

    If sweet, then the box labeled “sweet” must be “anise” and the box labeled “anise” must be mixed.
    If anise, the box labeled “anise” must be sweet, and the box labeled “sweet” must be mixed.

  4. JBL:

    Another mathematician’s review: https://scienceblogs.com/evolutionblog/2009/08/fermats_room.php

  5. JBL:

    Sorry, I submitted too soon — the comments there are interesting because the filmmaker showed up to discuss a little.

  6. Norm M:

    Thanks for the review! I watched the movie after reading it and found it interesting. I thought, though, that it was rather cold hearted of the escapees not to turn off the hydraulic presses after they escaped.

  7. Badger:

    So it’s trivially easy to find the pattern in 5, 4, 2, 9, 8, 6, 7, 3, 1? According to The On-Line Encyclopedia of Integer Sequences, you have to put the Spanish numbers in alphabetical order starting with 1-digit numbers, then 2-digit, 3-digit etc.

    Maybe I’m just stupid, but that doesn’t seem so easy to me!

  8. Tanya Khovanova:


    It’s a Spanish movie.

  9. hi:

    I liked the movie, but the more you think about it, the more plot holes you see. What was the point of having Fermat go to the hospital? No point, you could have just kept him in the room with the others the whole time.

  10. Hamish:

    Sorry, innumerate non-nerd here intruding on a smart person’s forum, but enjoyed the film but didn’t get how Hilbert planned to escape given that they
    would all be crushed together. Still, fascinating glimpse into smart-people world. Sometimes I wish I found maths interesting.

    Just spotted a link up top to “criminal probability theorem”. Might check out what that’s about. Have thought for many years that a mathematician or
    scientist needs to quantify “reasonable doubt”, what probability the actual threshold for conviction falls on and whether this varies in accordance to
    the psychological impact of cases or the perceived consequences of wrong acquital. (about the only stat I’ve encountered is that the threshold probability of guilt for execution is Texas can be inferred to be .92)

  11. Lazar Ilic:

    Scott Duke Kominers referenced this film in one of his Conundrums puzzles. It is odd. I was recently viewing 賭博覇王伝 零 Zero: The Bravest Money Game. Funny. Kiddos envision research and trading to get money.

Leave a comment