Fermat's Last Theorem

Squares split into two squares in endless ways, as in 32 + 42 = 52. Cubes and higher powers never do. Here is how that claim began in a book margin, how Fermat proved one case, and how it was finally proved more than 350 years later.

By the PythagoreanTheorem.net teamUpdated 11 min read

Fermat's Last Theorem says that the equation an + bn = cn has no solutions in positive whole numbers when n is greater than 2. For n = 2 there are infinitely many solutions, the Pythagorean triples such as 3-4-5. Pierre de Fermat claimed the theorem around 1637; Andrew Wiles proved it in 1994, and the proof was published in 1995.

It is simple enough for a 10-year-old to understand (Wiles first read about it at that age), yet it resisted the best mathematicians for three and a half centuries.

From Pythagorean triples to aⁿ + bⁿ = cⁿ

A Pythagorean triple is a solution of a2 + b2 = c2 in whole numbers. There are infinitely many, and Euclid's formula produces all of them: 32 + 42 = 52, 52 + 122 = 132, 82 + 152 = 172, and so on forever.

The natural next step is to try cubes, looking for whole numbers with a3 + b3 = c3. You can search for a long time and find only near misses. The closest small one is

63 + 83 = 216 + 512 = 728 = 93 − 1
+ vs 1 left over 6³ = 2168³ = 5129³ = 729 216 + 512 = 728 = 729 − 1
Cubes of side 6 and 8 hold 728 unit cubes between them, one short of filling a cube of side 9. Near misses like this are as close as cubes ever get.

Another is 93 + 103 = 1729 = 123 + 1. Fermat's Last Theorem says the misses never become hits, for cubes or any higher power:

Fermat's Last TheoremFor every whole number n ≥ 3, there are no positive whole numbers a, b, c with an + bn = cn.

The word "two" matters. With three cubes it can work: 33 + 43 + 53 = 63, a cousin of the 3-4-5 triangle. Adding a term is also how Pythagorean quadruples such as 12 + 22 + 22 = 32 arise.

Fermat's margin note (c. 1637)

Pierre de Fermat (died 1665) was a lawyer and magistrate in Toulouse, France, who did mathematics in his spare time and became one of the founders of number theory. He studied a Latin edition of the Arithmetica of Diophantus, a Greek mathematician of Alexandria, published by Claude-Gaspard Bachet in 1621, and wrote comments in its margins. Next to Problem 8 of Book II, which asks how to split a given square into two squares, he wrote, probably around 1637:

Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et generaliter nullam in infinitum ultra quadratum potestatem in duos eiusdem nominis fas est dividere cuius rei demonstrationem mirabilem sane detexi. Hanc marginis exiguitas non caperet.

"It is impossible to separate a cube into two cubes, or a fourth power into two fourth powers, or in general any power higher than the second into two like powers. I have discovered a truly marvelous proof of this, which this margin is too narrow to contain."

Fermat's own copy of the book is lost. We know the note because his son, Clément-Samuel de Fermat, published a new edition of the Arithmetica in 1670 that included his father's comments. The claim became known as Fermat's "last" theorem because it was the last of his stated results to be either proved or disproved.

Fermat almost certainly did not have a correct proof. None was found among his papers, and the proof that finally worked uses 20th-century mathematics. Most historians think he was mistaken, probably about a general argument with a hidden flaw, as so many later attempts had. He did have a complete proof for one exponent.

Fermat's proof for fourth powers

For n = 4, Fermat's method of infinite descent works, and it is built entirely out of Pythagorean triples. The idea: show that any solution would produce a smaller solution. Then that one would produce a smaller one still, and so on forever. But positive whole numbers cannot keep getting smaller forever, so there was never a solution to begin with. (The same style of argument proves that the square root of 2 is irrational.)

zwsmallerw′smaller stillw″… floor: whole numbers can’t go below 1 impossible
Infinite descent: if every solution gives a smaller one, you get an endless staircase of smaller and smaller positive whole numbers, which cannot exist.

It is actually easier to prove something slightly stronger: x4 + y4 = z2 has no solutions in positive whole numbers. That settles n = 4, because a solution of a4 + b4 = c4 would give one of the stronger equation with z = c2. Here is the descent, step by step.

  1. Take the smallest solution. Suppose solutions exist and pick the one with the smallest z. Then x and y share no common factor, or we could divide it out and get a smaller solution.
  2. Spot a triple. Since (x2)2 + (y2)2 = z2, the numbers x2, y2, z form a primitive Pythagorean triple. Say x is odd and y is even. Euclid's formula gives coprime m > n, one odd and one even, with x2 = m2 − n2, y2 = 2mn and z = m2 + n2.
  3. Spot a second triple. Rearranged, x2 + n2 = m2, so x, n, m form another primitive triple, and n is its even leg. Euclid's formula again gives coprime r and s with n = 2rs and m = r2 + s2.
  4. Find squares. Now y2 = 2mn = 4rs(r2 + s2). The three numbers r, s and r2 + s2 share no common factors, and their product is the perfect square (y/2)2, so each of them must itself be a perfect square: r = u2, s = v2, r2 + s2 = w2.
  5. Descend. Substituting gives u4 + v4 = w2, a brand-new solution. But w ≤ w2 = m < m2 + n2 = z, so it is smaller than the smallest solution. That is impossible, so no solution exists.

Fermat wrote out this kind of argument to show that the area of a right triangle with whole-number sides can never be a perfect square, one of the very few complete proofs he left, and the n = 4 case follows from the same idea. It also means you only ever need to worry about prime exponents. Any n ≥ 3 is either a multiple of 4 or a multiple of an odd prime p. If n = 4k, a solution would give (ak)4 + (bk)4 = (ck)4, which Fermat ruled out; if n = pk, it would give (ak)p + (bk)p = (ck)p. So it is enough to prove the theorem for n = 4 and for every odd prime.

Three and a half centuries of partial progress

Proving the theorem prime by prime was brutally hard. Each new exponent needed new ideas, and those ideas built large parts of modern number theory.

WhenWhat happened
c. 1637Fermat writes his margin note in Bachet's Arithmetica.
1670His son publishes the note; Fermat's descent settles n = 4.
1770Leonhard Euler publishes a proof for n = 3. It has a gap, which can be filled with his own methods.
1820sSophie Germain develops a general method that settles a large part of the problem for many primes.
1825Peter Gustav Lejeune Dirichlet and Adrien-Marie Legendre prove n = 5.
1839Gabriel Lamé proves n = 7.
1847Lamé's claimed general proof fails; Ernst Kummer proves the theorem for all "regular" primes, including every prime below 100 except 37, 59 and 67.
1908Paul Wolfskehl leaves 100,000 marks as a prize for a complete proof.
1983Gerd Faltings proves that for each n ≥ 4 there can be at most finitely many essentially different solutions.
1984–1986Gerhard Frey links the problem to elliptic curves; Ken Ribet proves that a solution would contradict a famous conjecture about them.
1993Andrew Wiles announces a proof in a lecture series in Cambridge, England. A gap is found months later.
1994Wiles, with his former student Richard Taylor, repairs the gap.
1995The proof is published in the Annals of Mathematics.

Lamé's failed proof shows why the problem was hard. He factored an + bn using special complex numbers and assumed, as with ordinary whole numbers, that the factorization was unique. Kummer had already found that in these number systems it often is not, and repairing that failure led him to "ideal numbers", one of the foundations of modern algebra.

How Andrew Wiles proved it

Wiles, an English mathematician working at Princeton, spent about seven years on the problem, mostly in secret. His proof fills over a hundred pages, but its plan fits in four steps. It connects whole-number equations to two other kinds of objects:

  • An elliptic curve is the set of solutions of an equation like y2 = x3 + Ax + B. Despite the name it is not an ellipse; it is a curve whose points can be "added" to one another in a surprising way.
  • A modular form is a function with an enormous amount of symmetry, studied for completely different reasons. An elliptic curve is called modular if it matches up with a modular form.
  1. The conjecture. In the 1950s and 1960s, Yutaka Taniyama, Goro Shimura and others suggested that every elliptic curve (with whole-number coefficients) is modular. Nobody knew how to prove it.
  2. The strange curve. Frey noticed that a solution ap + bp = cp with p an odd prime would produce the elliptic curve y2 = x(x − ap)(x + bp), which would have properties so unusual that it seemed it could not be modular.
  3. Ribet's theorem. In 1986 Ribet proved it: the Frey curve really cannot be modular. So if the conjecture is true, the Frey curve cannot exist, and neither can the solution that produced it.
  4. Wiles's theorem. Wiles proved the conjecture for a large class of elliptic curves, the "semistable" ones, which includes every Frey curve. Therefore no solution exists, for any odd prime p, and Fermat's Last Theorem is true.

The rest of the conjecture, now called the modularity theorem, was completed in 2001 by Christophe Breuil, Brian Conrad, Fred Diamond and Richard Taylor. Wiles received the Wolfskehl Prize in 1997 and the Abel Prize in 2016. A question about whole numbers was settled by proving something about curves and symmetric functions.

Why squares are special

The exponent 2 has infinitely many solutions and every larger exponent has none. Several facts show how differently squares behave.

The circle can be unwrapped by straight lines

Divide a2 + b2 = c2 by c2 and you get x2 + y2 = 1 with x = a/c and y = b/c. So every Pythagorean triple is a point with fraction coordinates on the unit circle: 3-4-5 gives the point (3/5, 4/5) and 5-12-13 gives (5/13, 12/13). Now draw a line through the point (−1, 0) with a fraction slope t. It meets the circle at exactly one more point, with coordinates

x = 1 − t2 over 1 + t2,   y = 2t over 1 + t2

and these are fractions too. Slope t = 1/2 gives (3/5, 4/5); slope t = 2/3 gives (5/13, 12/13). Every fraction slope gives a triple, and every triple comes from one: this is Euclid's formula in disguise.

(3/5, 4/5)(12/13, 5/13) x² + y² = 1 x³ + y³ = 1 110
Every Pythagorean triple a-b-c is a point (a/c, b/c) with fraction coordinates on the circle. A solution of a3 + b3 = c3 would be such a point on the dashed curve x3 + y3 = 1, and there are none apart from the points on the axes.

The same equation for cubes, x3 + y3 = 1, describes a different kind of curve, an elliptic curve. A straight line usually meets it in three points, not two, and the "draw a line through a known point" trick no longer generates new fraction points. For n ≥ 4 the curves xn + yn = 1 are more twisted still, which is the geometric heart of Faltings's theorem.

Differences of squares factor neatly

The algebra that finds triples relies on c2 − b2 = (c − b)(c + b): two simple factors whose product must be the square a2. For cubes, c3 − b3 = (c − b)(c2 + cb + b2), and that second factor is the kind that tripped up Lamé.

More terms change everything

Fermat's theorem is about exactly two terms on the left. Euler guessed that you would need at least n terms to make an nth power, but that guess is false. In 1966 Leon Lander and Thomas Parkin found four fifth powers that add up to a fifth power, and in the 1980s Noam Elkies found three fourth powers that add up to a fourth power:

275 + 845 + 1105 + 1335 = 14452,682,4404 + 15,365,6394 + 18,796,7604 = 20,615,6734

Powers are full of surprises, and the case understood completely is n = 2: see the list of Pythagorean triples or the history of the Pythagorean theorem.

Frequently asked questions

What is Fermat's Last Theorem in simple terms?

You can split a square number into two square numbers, as in 25 = 9 + 16, but you can never split a cube into two cubes, a fourth power into two fourth powers, or any higher power into two powers of the same kind, if all the numbers are positive whole numbers.

Who proved Fermat's Last Theorem, and when?

Andrew Wiles announced a proof in June 1993. A gap was found, and Wiles fixed it in September 1994 with help from Richard Taylor. The complete proof was published in the Annals of Mathematics in 1995.

Did Fermat really have a proof?

Almost certainly not a correct one for every exponent. He never published one, none was found in his papers, and the proof that works uses 20th-century mathematics. He did prove the case n = 4 using infinite descent.

Why does it not apply to n = 2?

Because a2 + b2 = c2 has infinitely many whole-number solutions, the Pythagorean triples, such as 3-4-5 and 5-12-13. The theorem is precisely the statement that n = 2 is the only exponent above 1 with solutions.

What does Fermat's Last Theorem have to do with Pythagoras?

It generalizes the equation of the Pythagorean theorem from squares to higher powers. Fermat wrote his note next to a problem about Pythagorean triples, and his proof for fourth powers uses Euclid's formula for triples twice.

Sources and further reading

  1. Andrew Wiles, "Modular elliptic curves and Fermat's Last Theorem", Annals of Mathematics 141 (1995), 443–551; and Richard Taylor and Andrew Wiles, "Ring-theoretic properties of certain Hecke algebras", same volume, 553–572.
  2. Simon Singh, Fermat's Last Theorem (1997; published in the US as Fermat's Enigma), a non-technical history.
  3. J. J. O'Connor and E. F. Robertson, "Pierre de Fermat", MacTutor History of Mathematics.
  4. "Fermat's Last Theorem", Wikipedia.

Keep exploring