# Fermat’s Room

You can imagine my dismay upon discovering that I had forgotten to deposit my latest Netflix offerings in the mail. Bereft of quality home entertainment to take my mind off the looming return of the students, I hopped into the Jasonmobile and sallied forth to the local Blockbuster Video.

Typically I rent back episodes of television shows. If I have the attention span for a movie, I simply go to a movie, you see. Nonetheless, I browsed the new releases and discovered an intriguing little film called Fermat’s Room.

So I picked up the box, noticed the first two words of the plot description were “Four mathematicians…” and read no further. I rented it at once.

The story involves four mathematicians who are lured to a room on an island in the middle of nowhere. They have been enticed by the allure of solving some great, but unspecified problem. Sadly, the whole thing turns out to be a trap. They are locked in their room, with their mysterious host feeding them a series of mathematical brainteasers they must solve within a specified amount of time. If they do not, the walls to the room begin collapsing in on each other. The story revolves around them trying to solve the brainteasers before the walls crush them to death. Inevitably, information about the four comes dribbling out, until finally it becomes clear what is really going on.

Pretty farfetched, I grant you. But the mathematics is impeccable; the movie opens with an admirably clear explanation of Goldbach’s conjecture, for example.

If you are the kind of person who is intrigued by a movie about four mathematicians trapped in a shrinking room, then it is likely you are already familiar with the brainteasers in the movie. Here are three of them, for your solving pleasure:

1. You have three boxes of candy, one containiing choclates, one containing peppermints, and one containing a mixture of both. Each box contains a sign announcing its contents. Alas, all of the boxes are labelled incorrectly. You are permitted to remove candies one at a time from any of the boxes. What is the fewest number of candies you must examine to determine for certain which box is which?
2. There are three switches on the wall in front of you. One of them controls a lightbulb in a neighboring room, while the other two are not connected to anything. You are allowed to flip the switches in any manner you want. You can then enter the room to see what effect your moves had. What is the fewest number of times you will need to enter the room to determine which switch is connected to the bulb?
3. You have a four minute hourglass and a seven minute hourglass. How can you use them to time a period of exactly nine minutes?

You may protest at this point that there is something implausible in the image of studly, professional mathematicians struggling over such problems, but here I think we can grant the writers some dramatic license. The viewer, after all, needs to be able to follow what they are doing. This really isn’t the time for a problem about Frobenious algebras or bifurcation theory.

A fourth puzzle, involving a sequence of numbers, had its amusing elements. The problem was to determine the next number in the sequence. I had paused the film at this point to try to solve it for myself. One possibility I considered was that the numbers were written in alphabetical order, but it was easy to verify that was not the case. Eventually I gave up. Alas, I had forgotten that this was a Spanish movie (with English subtitles). When the digits were written in Spanish, they were, indeed, in alphabetical order. D’oh!

The movie also played in to another of my favorite things in fiction: fair-play detective stories. This is definitely one of those films where seemingly insignificant details from early in the film get referred to later.

In addition to the suspense and generlaly good acting, there are also some impressive visuals. I was almost inclined to ignore the sheer physical impossibility of all four walls of the room closing in on each other simultaneously because the overhead shots of the room were so striking. There is also an impressive and strangely moving car accident, which I will not try to describe.

It may seem an odd thing to say about a movie with so much mathematics in it, but it’s very enjoyable so long as you don’t think too hard about it. There is definitely a James Bond villain aspect to the proceedings. If you are close enough to lure your enemy into an elaborate and very expensive death trap, you are close enough to shoot him. But what can you do? Definitely worth seeing.

1. #1 JimV
August 10, 2009

I got the answers (I think) within five minutes, so it seems to me that harder problems could be found which could explained to the viewers. The “Pirate Puzzle” is a bit harder than any of those, for example, but should make sense once the answer is explained. Why not the Monty Hall problem? Or a problem they could solve by Monte Carlo simulation (tossing coins).

This is my perennial complaint, but why does everything have to be dumbed down past the point of plausibility? why can’t we have good drama, good special effects if necessary, and a plot that is grounded in reality? Wouldn’t that be one way to foster less contempt for science and more respect for it?

2. #2 Phaedrus
August 10, 2009

Netflix has a pretty good streaming video selection of both movies and old TV series. NBC does as well – not sure about the other networks, but I’d be willing to bet they do.

Wife and I have found ourselves in a similar situation and have dug up some gems for instant viewing.

3. #3 The Science Pundit
August 10, 2009

OK, I skipped everything between “(Warning, some minor spoilers ahead)” and the last paragraph because I’m thinking I want to see it myself.

4. #4 Jason Rosenhouse
August 10, 2009

JimV –

Five minutes? In the movie they generally only had one! How’s that for hard?

5. #5 Fraser
August 11, 2009

Hmmmm. The first one seems more like a “did you really read all of the question properly?” while the second one requires using physical properties in what is otherwise presented as an abstract problem. Neither is terribly mathematical is it? Not that I’ve seen the movie, maybe that wasn’t the point.

I sure wish we had netflix in this country!

6. #6 Soren
August 11, 2009

SPOILER:

Here are my solutions – I am not sure of the last one, I spent less than 5 minutes on it, but didn’t time it I’m afraid.

1. 1
2. 2
3. This I can only do, if I am allowed to use more than 9 minutes to measure out the time, in fact I need to use 16 minutes, the last 9 of these being measured accurately.

The full explanation will follow, when others have had a chance to try.

7. #7 Fraser
August 11, 2009

Soren: the answer to #2 is also 1 (but see my earlier comment)

8. #8 Rodrigo Sopeña
August 11, 2009

Hello!

I’m Rodrigo Sopeña, I directed the movie. (Sorry for my english level).

Here you have a picture drawn by a movie fan. It explains how four walls may move without collapsing:

http://i123.photobucket.com/albums/o292/childbirth/fermat.gif

We built it in the set, I was inside it, and -believe me- It’s possible to have a shrinking room with four walls moving.

9. #9 Soren
August 11, 2009

Damn youre right.

I knew I was thinking wrong for that one.

Have you got a quicker solution for problem 3?

10. #10 Fraser
August 11, 2009

Nah, I also need 16 minutes to measure nine.

11. #11 John Wendt
August 11, 2009

“I got the answers (I think) within five minutes, so it seems to me that harder problems could be found which could explained to the viewers.”

You didn’t have a room collapsing around you!

Crisp solution for #3:

1. Start both timers.
2. When the 4-minute timer times out, flip it.
3. When the 7-minute timer times out, flip it.
4. When the 4-minute timer times out again, flip the 7-minute timer.
5. When the 7-minute timer times out, the 9 minutes is up.

Explanation: After two timeouts of the 4-minuter, 8 minutes have elapsed. The 7-minuter has been flipped, and now has one minute of sand in the bottom. Flipping lets the one minute drain out. Since this one minute started at the 8-minute mark, the total is 9 minutes.

12. #12 windy
August 11, 2009

I agree, the answer to both #1 and #2 is 1, but you need to make one additional assumption in both… (I’ve heard a slightly different version of the lightbulb problem before)

And for the hourglass, I also went for the 16 minute answer, unless a little cheating is allowed, in which case you could do it in 9… 😉 (they can’t expect atomic clock accuracy from a hourglass measurement anyway)

And wow, the director is here! The movie sounds very interesting. Looks like it will be on Netflix next month.

13. #13 apaeter
August 11, 2009

Spoilerage

Here’s what I got for 3:

Flip both hourglasses, time = 0 mins
HG1        HG2
4 left_____7 left

when HG1 is empty, flip it; time = 4 mins
4 left_____3 left

when HG2 is empty, flip it; time = 7 mins
1 left_____7 left

when HG1 is empty, flip HG2 (which has been running for 1 min, so there’s 1 min in the lower chamber); time = 8 min
0 left_____1 left

after HG2 is empty, 9 mins have passed

does that work?

14. #14 windy
August 11, 2009

I didn’t see John’s hourglass answer as I was typing mine, so I stand corrected, no cheating required for the 9 minute answer!

15. #15 apaeter
August 11, 2009

damnit, too slow 🙂
At least it seems I hit on the right one.

16. #16 Soren
August 11, 2009

Damn

I just knew it could be done in 9 minutes flat.

2 out of 3 wrong answers.

17. #17 Jason Rosenhouse
August 11, 2009

Rodrigo –

Thanks for the comment, and thanks for making such an interesting film. I was picturing the presses being placed perpendicular to the walls. Obviously I need more imagination.

There is one thing that is still bothering me. Since the bad guy was in the room along with the other characters, who was it that was actually phoning in the problems and verifying that the answers were correct?

18. #18 JimV
August 11, 2009

I meant I got all of three them within five minutes total and just reading the questions took a little time … but okay, I didn’t realize the questions had a one-minute time-limit, my bad. I stand corrected. I would still like to see a movie involving mathematicians that showed some semblance of what they actually do.

19. #19 Dtis
August 11, 2009

Confused here. Problem #2:
1. do you know the state of the light at the start?
2. is there a prescribed start state for the switches?
3. are you assuming that switch = up = on for all switches?

Assuming that non-specified = DC, do not see how can be solved in one. It takes one visit just to establish the state of the light.

DTis

20. #20 Rodrigo Sopeña
August 11, 2009

Jason:

Imagine an intelligent software. It reads every answer and recognizes it as correct or wrong. Something like a google search.

R.-

21. #21 Jason Rosenhouse
August 11, 2009

Rodrigo –

I figured it was something like that, but that would have to be an awfully sophisticated piece of software, given the complexity of some of the solutions (the lightbulb problem in particular).

A bigger problem I had was that if a young mathematician claims to have a proof of Goldbach’s conjecture, he is going to have to show that proof to quite a few experts before anyone else gets excited about it. I think it is safe to say that if he is being lionized in the press and has a big public presentation planned, someone else must have seen the proof. And if the young mathematician knows he does not really have a proof, then it is unlikely that sabotaging his own presentation is likely to buy him enough time to come up with one.

As I said, though, I enjoyed the film very much. It was a far more realistic depiction of how mathematicians think and of what excites us than I have seen in just about any American movie. There is a desire to solve big problems no matter what it takes, but there is also a nagging doubt (represented by the character who made a popcorn popper in the shape of a duck) that maybe these problems aren’t really so important.

I would love to know where the idea for the film came from. Have you made other films with mathematical themes?

22. #22 JimV
August 11, 2009

In the interests of accuracy, I have to report that I got #2 wrong (the light bulb problem).

To Dtis #19:

Assume that the light bulb is off at the start, before any of the switches are toggled. (I wish this had been included in the problem statement). Also assume that it is an incandescent light bulb.

23. #23 Soren
August 12, 2009

The two first problems are well known riddles, I guess a google search would bring tons of variants of them up.

the last one is a variation of a well known set of riddles. I’ve most often seen them stated with containers with water, rather than hourglasses, but the same principles should apply. In fact I am quite sure, that had I considered the problem as water containers instead of hourglasses I would have found the right solution.

24. #24 Jr
August 12, 2009

I am happy to say that I thought about the problem for about 5 minutes and solved 1 and 3. Nr 2 I solved under a wrong interpretation of the problem, even though I had heard the problem many times before.

25. #25 gingerbaker
August 12, 2009

The movie reminds of Cube, where a group of unrelated folks wind up in a huge cubic arrangement of interconnected smallish cubic rooms, many of which are gruesomely booby-trapped. Mathematics also plays a role in how they escape.

26. #26 JimV
August 12, 2009

The plot is also a variant of the one in Diamond Dogs, Turquoise Days by Alastair Reynolds.

http://en.wikipedia.org/wiki/Diamond_Dogs,_Turquoise_Days

27. #27 Rodrigo Sopeña
August 12, 2009

Hi, Jason.

Here you have an interview published on british press. It’s translated, and contains answers about how the film was conceived. About your question, it’s very difficult to me to explain in english what you want to know:

En el libro de Simon Singh titulado “Fermat’s last theorem” se cuenta la historia de un investigador que trata de descubrir un misterio matemático. De repente, recibe un mail rebotado de otro remitente que notifica que ese misterio ya está resuelto. Se deprime, está a punto de abandonar, y entonces descubre que la fecha del mail original corresponde con el día que se hacen bromas (en España sería el 28 de diciembre), por lo tanto, lo que dice el mail es mentira. En la película pasa algo similar, el matemático mayor cree lo que publica una revista universitaria sobre el matemático joven, sin embargo todo se basa en una simple mentira. Es irónico que algo tan banal y adolescente como mentir para ganarse a una chica se le pase por alto a un científico serio que ha perdido el contacto con la vida.

R.-

28. #28 Rodrigo Sopeña
August 12, 2009
29. #29 KeithB
August 13, 2009

Rodrigo:
You let us down. I thought you had encoded the URL for the interview in your text!

30. #30 Jason Rosenhouse
August 13, 2009

Rodrigo –

I was able to understand the Spanish well enough. I had thought of Fermat’s Last Theorem as I watched the film, so I wasn’t surprised that it had influenced the script.

I’m also not surprised that you are an admirer of Agatha Christie and Sidney Lumet. As I mentioned in the opening post, there was definitely an element of fair-play detection. And the claustrophobic feel of the film was much like Twelve Angry Men.

Thank you for stopping by and providing all of this information.

31. #31 hiphop
August 15, 2009

McCulloch accuses Steig et al. of appropriating his ‘finding’ that Steig et al. did not account for autocorrelation when calculating the significance of trends. While the published version of the paper didn’t include such a correction, it is obvious that the authors were aware of the need to do so, since in the text of the paper it is stated that this correction was made. The corrected calculations were done using well-known methods, the details of which are available in myriad statistics textbooks and journal articles. There can therefore be no claim on Dr. McCulloch’s part of any originality either for the idea of making such a correction, nor for the methods for doing so, all of which were discussed in the original paper. Had Dr. McCulloch been the first person to make Steig et al. aware of the error in the paper, or had he written directly to Nature at any time prior to the submission of the Corrigendum, it would have been appropriate to acknowledge him and the authors would have been happy to do so. Lest there be any confusion about this, we note that, as discussed in the Corrigendum, the error has no impact on the main conclusions in the paper.

32. #32 JimR
August 17, 2009

Fermat’s Room is on the Sundance channel at 11:30PM ET on Monday, August 17. There is no indication of any repeat for the next 2 weeks.

33. #33 Josh
August 18, 2009

I had seen the light bulb one recently, couldn’t figure out the hour glass one (though it’s obvious once you see the solution!), and I think I have the candy one…

But I am probably wrong 🙁

34. #34 Soren
August 20, 2009

SPOILER:

Problem 1:
It all rests on the fact that ALL boxes are labelled incorrectly. This means that the one labelled as mixed candies must contain only one kind of candy. Pick one candy from that box. Assuming it is a chocolate, you have found the box of chocolates!
Put the chocolate label on this box.

You now have a mixed label in your hand, an unlabelled box, and a box labelled peppermints. But wait – you now the box labelled peppermints was labelled wrong. You now it cannot contain only chocolates, since you have found that box, so it must contain a mix. Label the box with the mixed label, and the last box must be peppermints.

Problem 2.

We must assume that the bulb is not lit to begin with, that it is a standard old fashioned bulb, and that it has not been lit for a longer period of time, for this solution to work.

Toggle switch 1.
Wait 2 minutes.
Toggle switch 1 again
Toggle switch 2.
Hurry into the room.
If the bulb is lit, switch 2 is the one.
If not, feel the bulb with your fingers. If it is warm, Switch 1 is the one.
If it is cold, switch 3 is the one.

Problem 3 is solved above.

35. #35 pac
January 9, 2012

Hi,

I loved the movie, and think there should be a sequel!

Two reasons why there should be a sequel: (SPOILERS)

1) We don’t know that Hilbert died.

2) It appears that Pascal was Hilbert’s accomplice. I have re-watched the movie many times, and noticed that it wasn’t Hilbert who wrote “LIBERTAD” on the blackboard. It was Pascal. How would Pascal know to write it exactly where the escape hatch would be? That’s too much of a coincidence. Also, if Pascal knew that David Hilbert died in his 80s, then why didn’t he say anything earlier in the movie? It wouldn’t make sense for him to wait until the end to mention it. These two things strongly suggest Pascal was in on the plot. So even if Hilbert died, Pascal can come back in a sequel.