Imagine being the only person in the entire world with the answer to a centuries-old question. Andrew Wiles doesn’t have to imagine. When he was 10 years old, he came across a puzzle that had baffled mathematicians for over three hundred years, and it become his life-long obsession until he found the solution thirty years later. It’s known as Fermat’s Last Theorem.

### Too big a problem

Pierre de Fermat was a French civil servant in the 17^{th} century who devoted all his spare time to studying maths. One day he was reading a book about Pythagoras’ theorem, the same one you learn in school. Pythagoras said the three sides of every right-angled triangle, a, b, and c, are related by the equation a^{2} + b^{2} = c^{2}. Fermat was particularly interested in triangles with sides that are whole numbers, such as 3^{2} + 4^{2} = 5^{2}. There are an infinite number of these triangles, known as “Pythagorean triples”.

Fermat made a slight change to Pythagoras’ theorem. Instead of a^{2} + b^{2} = c^{2}, he tried to find whole numbers that would fit the equation a^{3} + b^{3} = c^{3}. Easy, you might think, but Fermat couldn’t find any numbers that worked. He tried a^{4} + b^{4} = c^{4} and a^{5} + b^{5} = c^{5}, but they didn’t have any solutions either.

In fact, Fermat decided that there were no whole numbers that would fit the equation a^{n} + b^{n} = c^{n} if n was any number greater than 2. He wrote this in the margin of his book, before adding a sentence that would torment mathematicians for generations:

“I have a truly marvellous demonstration of this proposition which this margin is too narrow to contain.”

### No solutions

This was how Fermat worked; he didn’t like to share his proofs with anyone else because he wanted people to figure problems out for themselves. When Fermat died his eldest son published a book of his father’s notes, and mathematicians proved nearly all of his theorems. There was just one left; Fermat’s Last Theorem, his brief scribble in the margin.

No one could crack it. Fermat left behind a proof for n = 4, and a century later the Swiss mathematician Leonhard Euler used his method to prove n = 3. Another seventy-five years passed until Sophie Germain, a French mathematician, figured out a proof for when n is a particular type of number.

Mathematicians aren’t happy to just prove a few special cases of a theorem though. Fermat’s Last Theorem was meant to be true for any n great than 2, so only a proof for every number would do. People began to think it would never be proved, until in 1986 a possible solution emerged.

### This might just work…

Maths is all about making connections. In 1986 an American named Ken Ribet connected Fermat’s Last Theorem to a seemingly unrelated area of maths called the Taniyama-Shimura conjecture. He realised proving the Taniyama-Shimura conjecture would automatically prove Fermat’s Last Theorem, but this was also very tough and no one thought it could be done. No one, except Andrew Wiles.

Encountering Fermat’s Last Theorem as a child fuelled Wiles’ interest in maths, and after leaving school he went on to study it at university, eventually becoming a professor at Princeton University. When he heard about the connection between Taniyama-Shimura and Fermat, he decided to devote his life to solving it.

He began to work in secret, a very unusual decision. Though you may not think it, maths is an extremely social subject, and mathematicians thrive on new ideas gained from conversations with others. Wiles was worried that someone else might beat him to a solution though, so kept his work hidden from everyone but his wife.

### The lecture of a lifetime

Eventually in 1993, after seven years hard work, Wiles had the proof. He decided to announce it at a lecture in Cambridge, where rumours of his discovery began to circulate. The room was full to capacity, and some mathematicians had to press their nose up against the windows just to get a peek. Wiles read out the proof and wrote the Theorem on the board, then turned to the audience and said “I think I’ll stop here”. The room exploded with applause.

Newspapers and television spread news of the proof, and Andrew Wiles quickly became the most famous mathematician in the world. He was even approached by Gap to model their new line of jeans – an offer he declined. His work wasn’t over yet. The 200-page proof had to be fully checked by other mathematicians before it was accepted as valid and published in a mathematical journal, and it wasn’t long before someone found an error.

### Not-so-quick fix

Wiles was devastated, but determined to fix his proof – and this time he wasn’t alone. Enlisting the help of Richard Taylor, one of his former students, he worked for over a year attempting to correct the mistake. They made almost no progress. Wiles was ready to give up on nearly eight years of work, but Taylor suggested they try for one more month. On the 19^{th} September 1994, Wiles had a flash of inspiration, and realised he could fix the proof. It was eventually published in May 1995.

The centuries-long journey was over, but the story of Fermat’s Last Theorem isn’t quite finished. Wiles’ proof uses advances in modern maths that Pierre de Fermat couldn’t possibly have known about. Some mathematicians believe that Fermat’s “marvellous demonstration” of a simpler proof might still be rediscovered. Others say he was just mistaken, and never had a proof. Even with his Last Theorem solved, Fermat’s secrets remain hidden.