Site map 

 Contact Graeme 

 Skip Navigation LinksMath Help > Number Theory > Fermat's Theorems

Fermat's Theorems

Fermat's Last Theorem

The Diophantine equation an + bn = cn has no solutions when n > 2.

This is easy to prove for various specific values of n (proof when n=3; when n=4), and has been proved recently for all n (but that was a very difficult proof that required the use of a computer).

A section on "Springfield Theory" (named after the Simpsons' home town) at the bottom of this page gives near counterexamples to Fermat's Last Theorem.

Fermat's Little Theorem

Fermat's "Little" Theorem is sometimes abbreviated FLT, which is confusing because the same abbreviation might mean his "Last" theorem.  This "little" theorem is a special case of Euler's Totient Theorem, and the proofs are almost identical.

ap-1 = 1 (mod p), where p is prime and a≠0 (mod p)

Proof: take a to be any positive integer coprime to p.
Consider the set {a, 2a, 3a, ..., (p-1)a}.
No two elements of this set are congruent mod p (see below*), so their residues mod p must be {1, 2, 3, ..., p-1} in some order.
By equating the product of the numbers in the first set with the product of those in the second set, mod p,
ap-1(p-1)! = (p-1)! (mod p)
Since (p-1)! is coprime to p, we can divide both sides by (p-1)!, mod p, proving Fermat's Little Theorem.

* Why are no two elements of {a, 2a, 3a, ..., (p-1)a} congruent, mod p?
Suppose a is a number coprime to p, and b and c are two different numbers in the range [1,p-1] and ab=ac, mod p.
Then ab-ac=pk, where k is an integer.
a(b-c)=pk, and since b-c is smaller than p in absolute value, a must be larger than k in absolute value.
a and p have no factors in common, so a|k, but a can't divide k, since a is larger than k, a contradiction.

Other "Fermat" Theorems

An odd prime number is a sum of two squares if and only if it is congruent to 1 modulo 4.  This is given amongst a bunch of theorems and definitions about Ring Theory, and explained in great detail in the Sum of Four Squares page.

Springfield Theory

In the 1995 Halloween episode of The Simpsons, while Homer accidentally visits a world with three dimensions rather than his usual two, one of the strange things that flash by him is


David X. Cohen, the writer responsible for this amazing-looking (but false) disproof of Fermat's Last Theorem lamented its obvious falsity, and proposed this alternative,


which is true (mod 10), and thus not quite as obviously false.  This refined version of the equation appeared in a 1998 episode on a blackboard in Homer's basement.

The left side of the first equation is higher than the right side by 0.00000003%, and the left side of the second equation is lower than its right side by 0.000000002%.

Related Pages in this website

Euler's criterion for determining whether a number is a quadratic residue (mod p), or in other words, if a number is the square of some other number (mod p).

Proof of Fermat's Last Theorem for n=3, attributed to Euler

Proof that there is no solution to the Diophantine equation A4+B4=C2, which means Fermat's last theorem is true for n=4. 


Euler's Totient Theorem -- a generalization of Fermat's Little Theorem

The proof that primes of the form 4k+3 can be expressed as the sum of four squares uses Fermat's Little Theorem.

Group - a set closed under one operation.

A bunch of Ring Theory theorems and definitions.


The webmaster and author of this Math Help site is Graeme McRae.