Fermat's Room (Spanish: La habitación de Fermat) is a 2007 Spanish thriller film directed by Luis Piedrahita and Rodrigo Sopeña. Three mathematicians and one inventor are invited to a house under the premise of solving a great enigma, and told to use pseudonyms based on famous historical mathematicians. At the house, they are trapped in a room. They must solve puzzles given by the host, who calls himself "Fermat", in order to escape the slowly closing walls of the room.
Fermat's Room  

Directed by 

Written by 

Produced by 

Starring  
Cinematography  Miguel Ángel Amoedo 
Edited by  Jorge Macaya 
Music by  Federico Jusid 
Production companies 

Distributed by 

Release date 

Running time  89 minutes 
Country  Spain 
Language  Spanish 
A stranger using the alias "Fermat" invites several people to attend a convention of the country's best mathematicians. To accept the invitation, each must solve a math puzzle. Upon receipt of the correct solution, each receives as an alias the name of a famous mathematician or philosopher; they are forbidden to reveal their true identities. Each is instructed to arrive at a specific place and time, alone and without a cell phone, to work on "the greatest enigma".
At the appointed time, four individuals converge at a riverbank: a serious young man using the alias Galois, an older man using Hilbert, a selfeffacing young man using Pascal, and a stylish young woman using Oliva. At dusk, a car on the far side of the river flashes its headlights. In the car they find a PDA with GPS coordinates and travel instructions. These direct them to an abandoned warehouse, where a back room is set up as an elegant parlor stocked with books and a large dining table set for five.
An elderly man enters and introduces himself as Fermat. They socialize and discuss academia, mathematics, and puzzles. After dinner, Fermat receives a phone call about his daughter, whom he claims is in a coma at a nearby hospital. Mobile reception is poor, and Fermat is unclear about the meaning of the call. Insisting it might be dire news, he leaves hurriedly and forgets his coat. Fermat's wallet drops out of a pocket in the confusion. Pascal picks it up and notices a photo of a girl.
The PDA displays a math puzzle, with a time limit of one minute. Hilbert, Oliva, and Galois work on the problem but exceed the deadline. Pascal calls it an old cliché and solves it easily. The walls contract when the deadline is exceeded. Pascal finds a sales order for four industrial presses. The group intuits that the presses are set to compress the room each time they fail to solve a puzzle by the time limit. The door has been blocked, and there is no escape. The PDA periodically displays new puzzles. As the occupants of the room work to solve the puzzles, it is revealed that Oliva and Galois had a romantic history, and that Oliva cheated on him with Hilbert.
They pile the furniture in the room to hold the moving walls, but the furniture is broken as the walls continue to contract. Pascal identifies the girl in the photo as someone that he severely injured with his car. He proposes that Fermat is trying to kill him in revenge, and that the others are collateral victims. When they discover an invitation addressed to Fermat with different instructions than theirs, they realize that Fermat was not their host after all, but another pawn of the true host; if this is a revenge plot, the person wanting revenge would want to see it happen. As there are no visible cameras or viewpoints, the person trying to kill them must be in the room with them.
Galois, who previously gained press attention for allegedly proving Goldbach's conjecture, confesses that he lied to win back Oliva; the publicized sabotage of his presentation was staged to hide his failure. Hilbert reveals that he is the mastermind, that he has spent his entire professional life trying to prove Goldbach's conjecture and was insanely jealous that Galois beat him to the proof; he staged this "convention" to avenge himself. Fermat was a diversion who will be killed when undetectable poison gas is released in his car.
Hilbert announces that he has succeeded in proving Goldbach. He hands a folder to Galois. Galois admits that Hilbert's proof is brilliant. Frustrated by their impending doom, Galois becomes angry and strikes Hilbert, rendering him unconscious. Pascal realizes that the real Oliva, Galois, Fermat and Pascal each died at the same age as the current age of the guests using those names, but the real Hilbert died at 81, much older than the unconscious man before them. They conclude that Hilbert had an escape plan and did not intend to die with them. The three find a breakable wall panel and escape with Hilbert's proof.
As they return to their cars, Galois is conflicted about releasing Hilbert's solution: releasing it under Hilbert's name would let Hilbert "win", while releasing it under his own name would be unethical but would solve his professional problems. Pascal grabs the folder and scatters the pages upon the river, remarking that the world is still the same with or without the proof.
Fermat's Room was originally released in Spain on November 16, 2007. It grossed approximately 284,000 USD in its opening weekend there.^{[1]} The movie was released in the United States in international film festivals in early 2009, before going directly to DVD. Blockbuster Inc. acquired a temporary exclusive license for its rental release in the United States.^{[2]}