Home › Reference Information › Mathematics Theory › Fermat's theorem

Fermat's Theorems: The Last Theorem and the Little Theorem — statements, proofs, and history

Fermat's theorem is one of the most famous theorems in the history of mathematics. On this page, you will find everything about Fermat's Last Theorem and Fermat's Little Theorem: statements, proofs for special cases, the history of the search for a solution, and modern developments.


Fermat's Last Theorem: statement

Fermat's Last Theorem (also known as Fermat's Last Theorem) was formulated by Pierre de Fermat in 1637 in the margins of Diophantus's Arithmetica.

Statement of the theorem

Xn + Yn = Zn

The assertion: for n > 2, the equation has no solutions in natural numbers.

Fermat made the following note in the margin of a book:

"Conversely, it is impossible to separate a cube into two cubes, 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."

The simplicity of its formulation made the theorem incredibly popular — it is understandable to any schoolchild, yet a proof remained elusive to the world's greatest minds for over 350 years.

Reduction to prime exponents

To prove the theorem, it suffices to consider the cases where n is a prime number p > 2 and the case where n = 4. If the theorem is proven for all prime p and for n = 4, it automatically holds true for all composite values of n.

History of Fermat's theorem: from Fermat to Wiles

Year Mathematician Achievement
1637Pierre de FermatFormulated the theorem in the margins of Diophantus's Arithmetica
X векal-KhujandiAttempted to prove the case for the third power, but the proof has not survived
~1659Pierre de FermatPublished a proof for the fourth power (method of infinite descent)
1770Leonhard EulerProved the theorem for the case of the third power
1825Dirichlet and LegendreIndependently proved it for the fifth power
1839Gabriel LaméProved it for the seventh power
1847Ernst KummerProved it for all prime exponents less than 100 (except 37, 59, and 67)
1908WolfskehlBequeathed 100,000 marks for a proof
1986RibetProved that the Taniyama–Shimura conjecture implies Fermat's Last Theorem
1993Andrew WilesAnnounced a proof (a gap was discovered)
1994–1995Wiles and TaylorFixed the gap and published the final proof

Andrew Wiles devoted seven years of intense work at Princeton University to proving the theorem. His 130-page proof was published in 1995 in the journal Annals of Mathematics.

"Fermat's Last Theorem holds the record for the number of incorrect proofs proposed for it."

Proof for the case n = 4

The case of the fourth power was proved by Fermat himself using the method of infinite descent. This is the only case for which Fermat left a complete proof.

Theorem

The equation has no solutions in natural numbers.

Proof idea (method of infinite descent):

  1. Assume that a solution to the equation exists in natural numbers.
  2. From this solution, one can construct another solution with smaller variable values.
  3. By repeating this process, we obtain an infinite descending sequence of natural numbers, which is impossible.

The absence of solutions for one equation implies the absence of solutions for the other.

Special cases: n = 3, 5, 7 and n < 100

The case of the third power

Proven by Leonhard Euler in 1770. Euler used the method of infinite descent and number theory involving numbers of the form a + b√-3.

The case of the fifth power

Proven independently by Dirichlet and Legendre in 1825.

The case of the seventh power

Proven by Gabriel Lamé in 1839.

The case of exponents less than 100

In 1847, Ernst Kummer proved the theorem for all prime exponents less than 100, with the exception of the so-called irregular primes 37, 59, and 67.

"Kummer showed that the theorem holds for all prime exponents less than 100, with the possible exception of the so-called irregular primes 37, 59, and 67."

Kummer introduced the concept of ideal numbers and laid the foundations of modern algebraic number theory.

Fermat's Little Theorem: statement and proofs

Fermat's Little Theorem was formulated by Pierre de Fermat in 1640. Unlike the Great Theorem, it was proven during Fermat's lifetime and is a fundamental result in number theory.

Statement

Let p be a prime number and a be an integer.

Equivalent statements:

ap ≡ a (mod p)

ap-1 ≡ 1 (mod p)

Proof 1 (using the binomial theorem; induction on a)

This is the most elementary proof, accessible to a high school student.

Base case: for a = 0, the statement is obvious.

Inductive step: assume the statement holds for a. We prove it for the next value.

All binomial coefficients for intermediate values are divisible by p. Therefore:

For negative a, it suffices to note that the statement holds for odd p, while for p = 2 it is obvious.

Proof 2 (using the group of non-zero residues)

A more abstract, yet very elegant proof.

Consider the field of residues modulo p. The non-zero elements of this field form a multiplicative group of order p - 1.

By Lagrange's theorem, the order of a group element divides the order of the group. For any a not divisible by p, its order in this group divides the group's order; consequently:

Which was to be proved.

Proof 3 (using a system of residues)

Another elementary proof.

Consider the numbers a, 2a, 3a, …, (p - 1)a. They yield all non-zero residues modulo p.

Multiplying them together, we obtain an equality of products modulo p.

Canceling out (p - 1)!, we arrive at the desired statement.

Proof 4 (combinatorial; Petersen, 1872)

An original proof using bead coloring.

Suppose there are p objects arranged in a circle, each to be colored in one of a colors. The total number of colorings is a^p.

There are a single-color colorings. The remaining colorings are grouped into classes of size p (where each coloring in a class is obtained from another by rotation).

It follows that the difference is divisible by p; thus, the required congruence holds.

Applications of Fermat's Little Theorem

  • Primality testing (Fermat test)
  • Cryptography (RSA algorithm)
  • Computing modular inverses
  • Solving high-degree congruences

Frequently asked questions about Fermat's theorems

What is the difference between Fermat's Last Theorem and Fermat's Little Theorem?

Fermat's Last Theorem states that an equation involving three variables has no solutions in natural numbers for an exponent greater than 2. Fermat's Little Theorem establishes a congruence involving a prime number p. The Little Theorem was proved during Fermat's lifetime, whereas the Last Theorem was not proved until 1995, by Andrew Wiles.

Did Fermat himself prove his Last Theorem?

Most likely not. Fermat left a note in the margin of a book claiming he had a marvelous proof, but that the margin was too narrow. However, he published a proof only for the specific case of the fourth power. Most historians of mathematics believe that Fermat was either mistaken or possessed a proof only for a specific case.

Who proved Fermat's Last Theorem, and when?

The theorem was finally proved by Andrew Wiles in 1994 (published in 1995). The proof relies on the Taniyama–Shimura conjecture and spans approximately 130 pages.

Which specific cases of Fermat's Last Theorem were proved before Wiles?

The third degree (Euler, 1770), the fourth (Fermat himself), the fifth (Dirichlet and Legendre, 1825), the seventh (Lamé, 1839), and all prime exponents less than 100 (Kummer, 1847). Proofs have also been established for all exponents up to several million using computer calculations.

Where is Fermat's Little Theorem applied?

Fermat's Little Theorem is widely used in cryptography (the RSA algorithm), for primality testing (the Fermat test), for calculating modular inverses, and in other areas of number theory.
  • Quick facts
  • Tables
  • Formulas
  • Geometry formulas
  • Math theory