Fermat's Last Theorem

Pythagorean triples give infinitely many whole-number solutions to a^2 + b^2 = c^2(3,4,5), (5,12,13), (8,15,17), and on forever. So it is a completely natural question to ask: what happens if you swap the little 2 for a 3, or a 4, or any bigger whole number? Surely cubes, or fourth powers, work just as generously?

They don't. Around 1637, the French lawyer and amateur mathematician Pierre de Fermat was reading his copy of Diophantus's Arithmetica — right next to the very problem about Pythagorean triples — and scrawled a note in the margin: he had discovered that no such triples exist once the exponent climbs past 2, and he had "a truly marvellous proof of this, which this margin is too narrow to contain." He never wrote the proof down anywhere else. That one sentence, and the silence that followed it, kept the finest mathematicians in the world busy for 358 years.

Why should n = 2 be so special? Geometrically, a Pythagorean triple is a right triangle whose three side lengths are all whole numbers — a picture you can draw. There is no equally simple picture for "a cube's worth of side length plus another cube's worth equals a third cube's worth"; volumes don't stack together the way areas of squares on the sides of a triangle do. That loss of a friendly geometric picture is a hint — though nowhere near a proof — of why the equation's behaviour changes so completely once the exponent climbs past 2.

The statement

For any integer exponent n > 2, the equation

a^{n} + b^{n} = c^{n}

has no solution in positive integers a, b, c.

Notice exactly where the door slams shut: at n = 2 there are infinitely many solutions; the instant you step to n = 3, there are zero. Nothing in between softens the blow — no near-misses that quietly turn into exact hits if you search long enough. It is one of the most abrupt "yes, forever" to "no, never" transitions in all of mathematics, and it is exactly that abruptness which makes the claim so hard to believe — and, it turned out, so hard to prove.

Worked check: hunting for a counterexample

Before trusting a sweeping claim like "never, for any exponent above 2," it's worth trying to break it — that's exactly what generations of mathematicians did. Start with the smallest interesting case, n = 3, and the smallest numbers around:

3^3 + 4^3 = 27 + 64 = 91.

Is 91 a perfect cube? The cubes near it are 4^3 = 64 and 5^3 = 125 — and 91 falls squarely between them, matching neither. No luck.

Try a pair that looks more promising:

6^3 + 8^3 = 216 + 512 = 728.

That is agonisingly close to 9^3 = 729 — just one short! It is the kind of near-miss that makes you wonder if a cleverer pair might land exactly on target. Fermat's theorem says no pair ever will, no matter how hard you search or how close you get. Run the search yourself below and see how the near-misses behave as the numbers grow.

// Search for a,b,c with a^3 + b^3 = c^3, and report the closest near-misses found. function closestCube(sum: number): number { return Math.round(Math.cbrt(sum)); } let bestGap = Infinity; for (let a = 1; a <= 15; a++) { for (let b = a; b <= 15; b++) { const sum = a ** 3 + b ** 3; const c = closestCube(sum); const gap = Math.abs(sum - c ** 3); if (gap <= bestGap) { bestGap = gap; console.log(`${a}^3 + ${b}^3 = ${sum} nearest cube: ${c}^3 = ${c ** 3} gap = ${gap}`); } } } console.log("No exact hit anywhere in the search — exactly as Fermat's Last Theorem predicts.");

Every single pair misses. That is weak evidence, not a proof — a counterexample could in principle be hiding at some astronomically large a, b, c that no search will ever reach. Ruling that out completely needed real mathematics, not a bigger search box.

Centuries of partial progress

The theorem was chipped away exponent by exponent, each attack borrowing tools from the last. Fermat himself actually left behind a real proof for one case, n = 4, using a technique he invented called infinite descent — assume a solution exists, then show it forces a smaller solution to exist too, and a smaller one again, forever, which is impossible for positive whole numbers. Leonhard Euler settled n = 3 about a century later. Since every exponent bigger than 2 is a multiple of 4 or of an odd prime, proving the odd-prime exponents one at a time chips steadily away at the whole theorem.

The really ambitious attacks tried to factor a^n + b^n using algebraic integers — number systems built by throwing in roots of unity alongside the ordinary integers. It looked promising until it ran aground on a shocking discovery: unique factorisation can fail in those larger rings, the very property that makes ordinary whole-number arithmetic work the way we expect. Ernst Kummer's repair — inventing "ideal numbers" to patch the gap — didn't finish off Fermat's Last Theorem, but it did found an entire field, algebraic number theory. The failed assaults on one 17th-century margin note built modern mathematics almost as a side effect.

Progress wasn't only European or only male, either — one striking contribution came from Sophie Germain in the early 1800s. Barred from officially enrolling at the École Polytechnique because she was a woman, she studied in secret and corresponded with leading mathematicians (including Gauss) under a male pseudonym, Monsieur Le Blanc, before her real identity was discovered. Germain proved a powerful general result: for a whole class of exponents (now called Sophie Germain primes), if a solution to Fermat's equation existed, one of a, b, c would have to be divisible by the exponent itself — ruling out huge swathes of possible counterexamples in one stroke, decades before Kummer's work.

The resolution

The proof finally arrived in 1994, from the British mathematician Andrew Wiles, by a route Fermat could never have imagined even existed. Wiles didn't attack the equation directly at all. Instead he proved a large chunk of the Taniyama–Shimura conjecture, a deep statement linking two seemingly unrelated worlds of 20th-century mathematics: elliptic curves (smooth curves defined by cubic equations) and modular forms (highly symmetric functions from complex analysis). Earlier work by Gerhard Frey and Ken Ribet had shown that if Fermat's Last Theorem were false, the counterexample could be turned into an elliptic curve so strange it couldn't possibly correspond to a modular form — contradicting Taniyama–Shimura. Prove that conjecture (for the cases that matter here), and Fermat's theorem falls out as a consequence. The final argument runs to well over a hundred pages of dense, modern machinery.

Put honestly: the tools Wiles used — elliptic curves, modular forms, Galois representations — did not exist in any form in Fermat's century. They are entirely 20th-century mathematics, built up over generations by many hands. That gap is the whole reason mathematicians are almost unanimous that Fermat's own "marvellous proof" could not have been correct — see the vignette below. Fermat's Last Theorem stands as the perfect emblem of number theory: a question a curious teenager can understand, whose true answer required inventing centuries of new mathematics no one alive in 1637 could have guessed would be needed.

The announcement made front-page news around the world — a rare thing for a pure-mathematics result. Part of the appeal is exactly this contrast: the statement is something a ten-year-old can understand (Wiles himself first read about it as a child in his local library), while the proof sits at the very frontier of professional mathematics, readable in full by only a small community of specialists. Few results bridge "everyone can ask the question" and "almost no one can follow the answer" so dramatically.

It is tempting to imagine Fermat really did have a short, elegant proof that was simply lost to history. Almost every historian of mathematics thinks that's wishful thinking. The strongest piece of evidence is the one you just read: the eventual proof needed elliptic curves, modular forms, and Galois representations — machinery invented in the 1950s–1990s, more than three centuries after Fermat died. It is essentially inconceivable that a 17th-century mathematician, however brilliant, stumbled onto a correct short-cut around all of that.

There's supporting evidence too: Fermat wrote proudly about many of his other results in letters to fellow mathematicians over the following decades, boasting and challenging his rivals to match them — but he never once mentioned this "marvellous proof" again, not even when directly discussing special cases of the very same problem. Historians generally believe Fermat briefly thought he had a valid argument (perhaps an extension of the infinite-descent method that works perfectly for n = 4 but subtly fails to generalise), realised it privately, and simply moved on. The margin note was never meant for publication — it was Fermat's son who found and published his father's marginal scribbles decades later, long after Fermat could clarify or retract anything.

Andrew Wiles had been fascinated by Fermat's Last Theorem since he was ten years old, reading about it in his local library. As an adult mathematician, he took an extraordinary gamble: starting in 1986, he worked on the proof almost entirely alone, in the attic of his house, for seven years, telling almost no one — not because he was secretive by nature, but because a problem this famous attracts a crowd the moment word gets out, and he wanted the space to think without an audience.

In June 1993, he announced his proof in a series of three lectures at Cambridge, triggering global front-page news — this was math's equivalent of a moon landing. Then, during the routine process of other experts checking the details, a serious gap turned up in one key step. Wiles spent another gruelling year, eventually working with his former student Richard Taylor, before finding a way to repair it in September 1994. The corrected proof was published in 1995. Few results in the history of mathematics have had such a dramatic, public, nail-biting path from announcement to acceptance.

Fermat scattered dozens of claims through his letters and margin notes, and mathematicians spent the 18th and 19th centuries confirming almost all of them one by one — Fermat was careful, and nearly everything he claimed turned out to be true. This particular claim about a^n+b^n=c^n was the very last of his assertions to be either proved or disproved, which is simply where the nickname "Fermat's Last Theorem" comes from — it isn't about it being his final piece of work, but about it being the final one left standing, unresolved, for centuries after everything else he claimed had been settled.

See it explained