Fermat's theorem on sums of two squares

# Fermat's theorem on sums of two squares

Discussion
 Ask a question about 'Fermat's theorem on sums of two squares' Start a new discussion about 'Fermat's theorem on sums of two squares' Answer questions from other users Full Discussion Forum

Encyclopedia
In number theory, the specialty additive number theory studies subsets of integers and their behavior under addition. More abstractly, the field of "additive number theory" includes the study of Abelian groups and commutative semigroups with an operation of addition. Additive number theory has...

, Pierre de Fermat
Pierre de Fermat
Pierre de Fermat was a French lawyer at the Parlement of Toulouse, France, and an amateur mathematician who is given credit for early developments that led to infinitesimal calculus, including his adequality...

's theorem on sums of two squares states that an odd
Even and odd numbers
In mathematics, the parity of an object states whether it is even or odd.This concept begins with integers. An even number is an integer that is "evenly divisible" by 2, i.e., divisible by 2 without remainder; an odd number is an integer that is not evenly divisible by 2...

prime
Prime number
A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. A natural number greater than 1 that is not a prime number is called a composite number. For example 5 is prime, as only 1 and 5 divide it, whereas 6 is composite, since it has the divisors 2...

p is expressible as

with x and y integers, if and only if
If and only if
In logic and related fields such as mathematics and philosophy, if and only if is a biconditional logical connective between statements....

For example, the primes 5, 13, 17, 29, 37 and 41 are all congruent to 1 modulo
Modular arithmetic
In mathematics, modular arithmetic is a system of arithmetic for integers, where numbers "wrap around" after they reach a certain value—the modulus....

4, and they can be expressed as sums of two squares in the following ways:

On the other hand, the primes 3, 7, 11, 19, 23 and 31 are all congruent to 3 modulo 4, and none of them can be expressed as the sum of two squares.

Albert Girard
Albert Girard
Albert Girard was a French-born mathematician. He studied at the University of Leiden. He "had early thoughts on the fundamental theorem of algebra" and gave the inductive definition for the Fibonacci numbers....

was the first to make the observation (in 1632) and Fermat was first to claim a proof of it.
Fermat announced this theorem in a letter to Marin Mersenne
Marin Mersenne
Marin Mersenne, Marin Mersennus or le Père Mersenne was a French theologian, philosopher, mathematician and music theorist, often referred to as the "father of acoustics"...

dated December 25, 1640; for this reason this theorem is sometimes called Fermat's Christmas Theorem.

Since the Brahmagupta–Fibonacci identity implies that the product of two integers that can be written as the sum of two squares is itself expressible as the sum of two squares, this shows that any positive integer, all of whose odd prime factors congruent to 3 modulo 4 occur to an even exponent, is expressible as a sum of two squares. The converse also holds.

## Proofs of Fermat's theorem on sums of two squares

Fermat usually did not prove his claims and he did not provide a proof of this statement. The first proof was found by Euler after much effort and is based on infinite descent
Infinite descent
In mathematics, a proof by infinite descent is a particular kind of proof by contradiction which relies on the fact that the natural numbers are well ordered. One typical application is to show that a given equation has no solutions. Assuming a solution exists, one shows that another exists, that...

. He announced it in a letter to Goldbach
Christian Goldbach
Christian Goldbach was a German mathematician who also studied law. He is remembered today for Goldbach's conjecture.-Biography:...

on April 12, 1749. Lagrange
Joseph Louis Lagrange
Joseph-Louis Lagrange , born Giuseppe Lodovico Lagrangia, was a mathematician and astronomer, who was born in Turin, Piedmont, lived part of his life in Prussia and part in France, making significant contributions to all fields of analysis, to number theory, and to classical and celestial mechanics...

gave a proof in 1775 that was based on his study of quadratic forms. This proof was simplified by Gauss
Carl Friedrich Gauss
Johann Carl Friedrich Gauss was a German mathematician and scientist who contributed significantly to many fields, including number theory, statistics, analysis, differential geometry, geodesy, geophysics, electrostatics, astronomy and optics.Sometimes referred to as the Princeps mathematicorum...

in his Disquisitiones Arithmeticae
Disquisitiones Arithmeticae
The Disquisitiones Arithmeticae is a textbook of number theory written in Latin by Carl Friedrich Gauss in 1798 when Gauss was 21 and first published in 1801 when he was 24...

(art. 182). Dedekind
Richard Dedekind
Julius Wilhelm Richard Dedekind was a German mathematician who did important work in abstract algebra , algebraic number theory and the foundations of the real numbers.-Life:...

gave at least two proofs based on the arithmetic of the Gaussian integer
Gaussian integer
In number theory, a Gaussian integer is a complex number whose real and imaginary part are both integers. The Gaussian integers, with ordinary addition and multiplication of complex numbers, form an integral domain, usually written as Z[i]. The Gaussian integers are a special case of the quadratic...

s. There is an elegant proof using Minkowski's theorem
Minkowski's theorem
In mathematics, Minkowski's theorem is the statement that any convex set in Rn which is symmetric with respect to the origin and with volume greater than 2n d contains a non-zero lattice point...

about convex sets. Simplifying an earlier short proof due to Heath-Brown
Roger Heath-Brown
David Rodney "Roger" Heath-Brown F.R.S. , is a British mathematician working in the field of analytic number theory. He was an undergraduate and graduate student of Trinity College, Cambridge; his research supervisor was Alan Baker...

(who was inspired by Liouville's idea), Zagier
Don Zagier
Don Bernard Zagier is an American mathematician whose main area of work is number theory. He is currently one of the directors of the Max Planck Institute for Mathematics in Bonn, Germany, and a professor at the Collège de France in Paris, France.He was born in Heidelberg, Germany...

presented a one-sentence proof of Fermat's assertion.

## Related results

Fermat announced two related results fourteen years later. In a letter to Blaise Pascal
Blaise Pascal
Blaise Pascal , was a French mathematician, physicist, inventor, writer and Catholic philosopher. He was a child prodigy who was educated by his father, a tax collector in Rouen...

dated September 25, 1654 he announced the following two results for odd primes :

He also wrote:
If two primes which end in 3 or 7 and surpass by 3 a multiple of 4 are multiplied, then their product will be composed of a square and the quintuple of another square.

In other words, if p, q are of the form 20k + 3 or 20k + 7, then pq = x2 + 5y2. Euler later extended this to the conjecture that

Both Fermat's assertion and Euler's conjecture were established by Lagrange.