Girish Mahajan (Editor)

Proofs of Fermat's theorem on sums of two squares

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

Fermat's theorem on sums of two squares asserts that an odd prime number p can be expressed as

Contents

p = x 2 + y 2

with integer x and y if and only if p is congruent to 1 (mod 4). The statement was announced by Girard in 1625, and again by Fermat in 1640, but neither supplied a proof.

The "only if" clause is easy: a perfect square is congruent to 0 or 1 modulo 4, hence a sum of two squares is congruent to 0, 1, or 2. An odd prime number is congruent to either 1 or 3 modulo 4, and the second possibility has just been ruled out. The first proof that such a representation exists was given by Leonhard Euler in 1747 and was complicated. Since then, many different proofs have been found. Among them, the proof using Minkowski's theorem about convex sets and Don Zagier's short proof based on involutions have appeared.

Euler's proof by infinite descent

Euler succeeded in proving Fermat's theorem on sums of two squares in 1749, when he was forty-two years old. He communicated this in a letter to Goldbach dated 12 April 1749. The proof relies on infinite descent, and is only briefly sketched in the letter. The full proof consists in five steps and is published in two papers. The first four steps are Propositions 1 to 4 of the first paper and do not correspond exactly to the four steps below. The fifth step below is from the second paper.

1. The product of two numbers, each of which is a sum of two squares, is itself a sum of two squares.

2. If a number which is a sum of two squares is divisible by a prime which is a sum of two squares, then the quotient is a sum of two squares. (This is Euler's first Proposition).

3. If a number which can be written as a sum of two squares is divisible by a number which is not a sum of two squares, then the quotient has a factor which is not a sum of two squares. (This is Euler's second Proposition).

4. If a and b are relatively prime then every factor of a 2 + b 2 is a sum of two squares. (This is Euler's Proposition 4. The proof sketched below includes the proof of his Proposition 3).

5. Every prime of the form 4 n + 1 is a sum of two squares. (This is the main result of Euler's second paper).

Lagrange's proof through quadratic forms

Lagrange completed a proof in 1775 based on his general theory of integral quadratic forms. The following presentation incorporates a slight simplification of his argument, due to Gauss, which appears in article 182 of the Disquisitiones Arithmeticae.

An (integral binary) quadratic form is an expression of the form a x 2 + b x y + c y 2 with a , b , c integers. A number n is said to be represented by the form if there exist integers x , y such that n = a x 2 + b x y + c y 2 . Fermat's theorem on sums of two squares is then equivalent to the statement that a prime p is represented by the form x 2 + y 2 (i.e., a = c = 1 , b = 0 ) exactly when p is congruent to 1 modulo 4 .

The discriminant of the quadratic form is defined to be b 2 4 a c . The discriminant of x 2 + y 2 is then equal to 4 .

Two forms a x 2 + b x y + c y 2 and a x 2 + b x y + c y 2 are equivalent if and only if there exist substitutions with integer coefficients

x = α x + β y y = γ x + δ y

with α δ β γ = ± 1 such that, when substituted into the first form, yield the second. Equivalent forms are readily seen to have the same discriminant, and hence also the same parity for the middle coefficient b , which coincides with the parity of the discriminant. Moreover, it is clear that equivalent forms will represent exactly the same integers, because these kind of substitutions can be reversed by substitutions of the same kind.

Lagrange proved that all positive definite forms of discriminant −4 are equivalent. Thus, to prove Fermat's theorem it is enough to find any positive definite form of discriminant −4 that represents p . For example, one can use a form

p x 2 + 2 m x y + ( m 2 + 1 p ) y 2 ,

where the first coefficient a = p was chosen so that the form represents p by setting x = 1, and y = 0, the coefficient b = 2m is an arbitrary even number (as it must be, to get an even discriminant), and finally c = m 2 + 1 p is chosen so that the discriminant b 2 4 a c = 4 m 2 4 p c is equal to −4, which guarantees that the form is indeed equivalent to x 2 + y 2 . Of course, the coefficient c = m 2 + 1 p must be an integer, so the problem is reduced to finding some integer m such that p divides m 2 + 1 . This is possible by Euler's criterion, but we reproduce the argument below to finish the proof.

As said, it suffices to find a root m of the polynomial P ( x ) = x 2 + 1 modulo p = 4n+1. What we do know, by Fermat's Little Theorem, is that each z not congruent to 0 modulo p is a root of the polynomial Q ( z ) = z p 1 1 = z 4 n 1 = ( z 2 n 1 ) ( z 2 n + 1 ) . Then it must be a root of either z 2 n 1 or z 2 n + 1 , since the integers modulo p form a field. Moreover, by a theorem of Lagrange, the number of roots modulo p of a polynomial of degree d is at most d (this follows again since the integers modulo p form a field). So the 4n nonzero classes 1, 2, …, p − 1 must split into exactly 2n of them that are roots of z 2 n 1 , and the other 2n that are roots of z 2 n + 1 . Choosing any z of the second kind and setting m = z n completes the proof.

Dedekind's two proofs using Gaussian integers

Richard Dedekind gave at least two proofs of Fermat's theorem on sums of two squares, both using the arithmetical properties of the Gaussian integers, which are numbers of the form a + bi, where a and b are integers, and i is the square root of −1. One appears in section 27 of his exposition of ideals published in 1877; the second appeared in Supplement XI to Peter Gustav Lejeune Dirichlet's Vorlesungen über Zahlentheorie, and was published in 1894.

1. First proof. If p is an odd prime number, then we have i p 1 = ( 1 ) p 1 2 in the Gaussian integers. Consequently, writing a Gaussian integer ω = x + iy with x,y ∈ Z and applying the Frobenius automorphism in Z[i]/(p), one finds

ω p = ( x + y i ) p x p + y p i p x + ( 1 ) p 1 2 y i ( mod p ) ,

since the automorphism fixes the elements of Z/(p). In the current case, p = 4 n + 1 for some integer n, and so in the above expression for ωp, the exponent (p-1)/2 of -1 is even. Hence the right hand side equals ω, so in this case the Frobenius endomorphism of Z[i]/(p) is the identity. Kummer had already established that if f ∈ {1,2} is the order of the Frobenius automorphism of Z[i]/(p), then the ideal ( p ) in Z[i] would be a product of 2/f distinct prime ideals. (In fact, Kummer had established a much more general result for any extension of Z obtained by adjoining a primitive m-th root of unity, where m was any positive integer; this is the case m = 4 of that result.) Therefore the ideal (p) is the product of two different prime ideals in Z[i]. Since the Gaussian integers are a Euclidean domain for the norm function N ( x + i y ) = x 2 + y 2 , every ideal is principal and generated by a nonzero element of the ideal of minimal norm. Since the norm is multiplicative, the norm of a generator α of one of the ideal factors of (p) must be a strict divisor of N ( p ) = p 2 , so that we must have p = N ( α ) = N ( a + b i ) = a 2 + b 2 , which gives Fermat's theorem.

2. Second proof. This proof builds on Lagrange's result that if p = 4 n + 1 is a prime number, then there must be an integer m such that m 2 + 1 is divisible by p (we can also see this by Euler's criterion); it also uses the fact that the Gaussian integers are a unique factorization domain (because they are a Euclidean domain). Since pZ does not divide either of the Gaussian integers m + i and m i (as it does not divide their imaginary parts), but it does divide their product m 2 + 1 , it follows that p cannot be a prime element in the Gaussian integers. We must therefore have a nontrivial factorization of p in the Gaussian integers, which in view of the norm can have only two factors (since the norm is multiplicative, and p 2 = N ( p ) , there can only be up to two factors of p), so it must be of the form p = ( x + y i ) ( x y i ) for some integers x and y . This immediately yields that p = x 2 + y 2 .

Proof by Minkowski's Theorem

For p congruent to 1 mod 4 a prime, 1 is a quadratic residue mod p by Euler's criterion. Therefore, there exists an integer m such that p divides m 2 + 1 . Let u = i ^ + m j ^ and v = 0 i ^ + p j ^ . Consider the lattice S = { a u + b v a , b Z } . If w = a u + b v = a i ^ + ( a m + b p ) j ^ S then w 2 a 2 + ( a m + b p ) 2 a 2 ( 1 + m 2 ) 0 ( mod p ) . Thus p divides w 2 for any w S .

The area of the fundamental parallelogram of the lattice is p . The area of the open disk, D , of radius 2 p centered around the origin is 2 π p > 4 p . Furthermore D is convex and symmetrical about the origin. Therefore, by Minkowski's theorem there exists a nonzero vector w S such that w D . Both w 2 < 2 p and p w 2 so p = w 2 . Hence p is the sum of the squares of the components of w .

Zagier's "one-sentence proof"

If p = 4k + 1 is prime, then the set S = {(x, y, z) ∈ N3: x2 + 4yz = p} (here the set N of all natural numbers can be taken to include 0 or to exclude 0, and in both cases, x, y and z must be positive for any (x, y, z) ∈ S, as p is an odd prime) is finite and has two involutions: an obvious one (x, y, z) → (x, z, y), whose fixed points, (x, y, y), correspond to representations of p as a sum of two squares, and a more complicated one,

( x , y , z ) { ( x + 2 z ,   z ,   y x z ) , if x < y z ( 2 y x ,   y ,   x y + z ) , if y z < x < 2 y ( x 2 y ,   x y + z ,   y ) , if x > 2 y

which has exactly one fixed point, (1, 1, k). The cardinality of S has the same parity as the number of fixed points of an involution on that set. Thus, from the second involution we know that the cardinality of S is odd and therefore the number of fixed points for the first involution cannot be zero, proving the existence of fixed points for the first involution and consequently that p is a sum of two squares.

This proof, due to Zagier, is a simplification of an earlier proof by Heath-Brown, which in turn was inspired by a proof of Liouville. The technique of the proof is a combinatorial analogue of the topological principle that the Euler characteristics of a topological space with an involution and of its fixed point set have the same parity and is reminiscent of the use of sign-reversing involutions in the proofs of combinatorial bijections.

References

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