Fermat 2 Square
Fermat 2 Square
Fermat 2 Square
Abstract. The two squares theorem of Fermat gives a representation of a prime congruent
to 1 modulo 4, as the sum of two integer squares. Fermat (1659) is credited with the …rst
proof of this result, but the …rst recorded proof is due to Euler (1749). Gauss (1801) showed
that the two squares representation is essentially unique. In 1855 the Oxford mathemati-
cian Henry Smith gave an elementary proof involving the use of continuants. This paper
discusses the Smith proof and shows how his method can be extended to give uniqueness.
There is a brief account of the life and achievements of Henry Smith recently called “The
mathematician the world forgot”.
1. Introduction
In his remarkable book “A Mathematician’s Apology” G.H. Hardy wrote, see [12, Page
97]:
“Another famous and beautiful theorem is Fermat’s ‘two square’theorem. The primes may
(if we ignore the special prime 2) be arranged in two classes; the primes
5, 13, 17, 29, 37, 41,
which leave remainder 1 when divided by 4; and the primes
3, 7, 11, 19, 23, 31,
which leave remainder 3: All the primes of the …rst class, and none of the second, can be
expressed as the sum of two squares: thus
5 = 12 + 22 ; 13 = 22 + 32
17 = 12 + 42 ; 29 = 22 + 52
but 3; 7; 11 and 19 are not expressible in this way (as the reader may check by trial).
This is Fermat’s theorem, which is ranked, very justly, as one of the …nest of arithmetic.
Unfortunately there is no proof within the comprehension of anybody but a fairly expert
mathematician.”
The history of this theorem of Fermat is given in detail by Dickson [7, Chapter VI, Pages
224-237]. Dickson names the theorem after Girard who discussed the result in 1632; however
the common practice now is to attribute the result to Fermat who stated, in 1659, that he
possessed an irrefutable proof by the method of in…nite descent; see [7, Chapter VI, Page
228] and [2, Page 89]. The …rst recorded proof is due to Euler given in 1749, see [7, Chapter
1991 Mathematics Subject Classi…cation. Primary 11A41, 11E25; Secondary 15A15.
Key words and phrases. Prime numbers, Fermat, two squares theorem.
1
2 F.W. CLARKE, W.N. EVERITT, L.L. LITTLEJOHN, AND S.J.R. VORSTER
VI, Pages 230 and 231]; Bell writes [2, Page 89] “It was …rst proved by the great Euler in
1749 after he had struggled, o¤ and on, for seven years to …nd a proof.”. The …rst proof that
the representation of such prime numbers, as the sum of squares of two positive integers, is
unique was given by Gauss in 1801; see [7, Chapter VI, Page 233]. See also the account of
the two squares theorem of Fermat in the books by Burton [4, Chapter 12, Section 2], and
Hardy and Wright [14, Chapter XX].
The last sentence in the above quotation from Hardy is signi…cant. Hardy had an interest
in the classi…cation of proof; see, in particular, [13, Page 6, Section 1.7] in connection with the
“elementary”proof of inequalities. In this context the technical use of the word elementary
must not be confused with the words obvious or easy; many of the elementary proofs in [13]
are subtle, ingenious and far from obvious. When Hardy wrote [12] he was, more than likely,
not aware that an elementary proof of this theorem of Fermat had been given in 1855 by
H.J.S. Smith, one of the predecessors in the Savilian Chair of Geometry in the University
of Oxford. This simple but remarkable proof of Smith is within the comprehension of those
with knowledge of elementary algebra, including simple properties of determinants, and the
fundamental theorem of arithmetic [6, Chapter I, section 4]. The proof is also remarkable for
being both constructable and computable for the integers of the two squares representation.
In this paper we give Smith’s proof of the theorem of Fermat and present what is, possibly,
a new elementary proof of the uniqueness of the two squares representation, but now using
Smith’s ideas and method. This uniqueness proof involves the Euler Criterion [8, Section 11]
for solutions of the quadratic equation x2 1 mod(p); we present a new existence proof
that leads to a constructable solution of this equation.
The original paper of Smith [20] is (the good news) only 2 pages long but is (the bad news
for most of us) written in Latin; see also the collected works of Smith [21], in which [20]
appears as the second contribution. The Smith proof has not gone entirely without notice;
Chrystal [5, Part II, Page 471] reproduces the proof in English, as does, in part, Dickson
[7, Chapter VI, Pages 240 and 241]; Davenport mentions the proof [6, Chapter V, Section
3, Page 122] but does not give complete details. Barnes [1] gives an exposition of Smith’s
existence theorem, and establishes the connection between the Smith palindromic continuant
and the Euler Criterion (see Theorems 1 and 2 and their proofs below).
Both Serret [19] and Hermite [17] use ideas similar to the Smith method [20] to give
an algorithm for …nding the integers in the two squares representation of the theorem of
Fermat. This method was subsequently improved by Brillhart [3] to give an impressively
fast numerical procedure to determine the representation; as an example the Brillhart method
gives
1050 + 577 = 76110653438083542454504012 + 64862689068739216422454242 :
The two squares theorem of Fermat continues to attract attention; see the recent contri-
butions by Ewell [9], Heath-Brown [16], Wagon [22] and Zagier [23].
In Section 2 we give formal statements of the results to be proved by the Smith methods. In
Section 3 we give a brief account of the life of Henry Smith. In Section 4 there is a de…nition
and statement of the properties of continuants. The remaining Sections are devoted to proofs
of the results. Lastly, in an Appendix, we reproduce the two-page paper, in Latin, of the
original Smith paper [20].
THE TWO SQUARES THEOREM 3
2. Statement of results
Let N := f1; 2; 3; g and P := fp 2 N : p is a prime numberg:
Theorem 1 (Fermat and Gauss). Let p 2 P with p 1 mod(4); then there exist two unique,
positive, co-prime integers u; v 2 N such that
(2.1) p = u2 + v 2 :
Proof. See Sections 6 and 7 below.
Theorem 2 (The Euler Criterion). Let p 2 P with p 1 mod(4): Then
1. The quadratic equation
(2.2) x2 1 mod(p)
has two unique solutions x0 ; x1 2 N such that
(2.3) 1 < x0 < (p 1)=2 and (p 1)=2 < x1 < p;
with x1 = p x0 :
2. All other solutions of (2:2) are congruent to x0 or x1 mod(p):
Proof. See Section 8 below.
Remark 1. For a detailed discussion on the Euler Criterion see the book by Dudley [8,
Section 11, Pages 85-86].
introduced; see the paper The mathematician the world forgot by Keith Hannabuss [10].
Several historians of mathematics have ranked him with Cayley and Sylvester among the
great pure mathematicians of the nineteenth century. His remarkable contributions to, and
his panoramic knowledge of, the theory of numbers can be seen in the monumental Report
on the theory of numbers, reproduced in [21]. In this area, in 1868, he shared in the Steiner
Prize of the Royal Academy of Sciences, in Berlin, for his solution of a geometric problem
but involving the representation of integers as a sum of squares.
Not so well known is Smith’s early contribution to measure theory and integration in his
paper of 1875 On the integration of discontinuous functions; see Paper 25 in [21]. In this
paper, Smith introduced the …rst example of what is now called a Cantor set; Cantor’s own
example appeared eight years later and was not presented as his own discovery. Smith’s
example divides an interval into m; with m > 2; subintervals, and then keeps repeating this
process to each remaining subinterval, except the last. Smith also seems to have been the …rst
mathematician to perceive the connection between measure and integral. However, his paper
received less attention than it deserved, owing to an inaccurate review in the Fortschritte
der Mathematik. In his history of integration, see [15, Pages 37 and 40], Thomas Hawkins
has remarked:
THE TWO SQUARES THEOREM 5
4. Continuants
Continuants are closely connected with continued fractions as is indicated by Smith at
the beginning of his paper [20]. There is a detailed and elegant account of this connection
in Chrystal [5, Chapter XXXIV]; see in particular [5, Chapter XXXIV, Sections 4 to 11].
However Smith uses only continuants in his paper and de…nes them in terms of determinants;
for this de…nition see [5, Chapter XXXIV, Section 11] and the reference therein to the
remarkable history of determinants by Muir and Metzler [18, Chapters III and XIII]. We
follow Smith and make the
De…nition 1. For n 2 N let qr 2 N (r = 1; 2; ; n); then de…ne [ ] : Nn ! N by the
determinant
q1 1 0 0 0
1 q2 1 0 0
0 1 q3 0 0
(4.1) [q1 ; q2 ; q3 ; ; qn 1 ; qn ] := .. .. .. . . .. .. :
. . . . . .
0 0 0 qn 1 1
0 0 0 1 qn
We note that
(4.2) [q1 ] = q1 ; [q1 ; q2 ] = q1 q2 + 1; [q1 ; q2 ; q3 ] = q1 q2 q3 + q1 + q3 :
Lemma 1. Let n 2 N with n 2; then continuants have the following properties:
(1) [q1 ; q2 ; ; qn ] = [q1 ][q2 ; q3 ; ; qn ] + [q3 ; ; qn ]
(2) [q1 ; q2 ; ; qn ] 2 N
(3) [q1 ; q2 ; ; qn ] = [qn ; ; q2 ; q1 ]
(4) [q2 ; q3 ; ; qn ] < [q1 ; q2 ; ; qn ]
(5) [q2 ; q3 ; ; qn ] and [q1 ; q2 ; ; qn ] are co-prime integers
(6)
[q1; ; qs 1 ; qs ; qs+1 ; qs+2 ; ; qn ] = [q1 ; ; qs 1 ; qs ][qs+1 ; qs+2 ; ; qn ]
+ [q1; ; qs 1 ][qs+2 ; ; qn ]:
Proof. Note that if in any formula in Lemma 1 an empty continuant appears then it is
convenient, and consistent, to give such a continuant the value 1:
(1) Expand the determinant (4.1) by the …rst row.
(2) Use (4.2), property 1 and mathematical induction.
(3) Standard property of determinants.
(4) Use properties 1 and 2.
6 F.W. CLARKE, W.N. EVERITT, L.L. LITTLEJOHN, AND S.J.R. VORSTER
From Algorithm 1 and from property 1 of Lemma 1, since p= > 2; it follows that, in the
representation (6.2),
(6.3) q1 2 and qn 2:
Now take one of the rational numbers p= with
(6.4) 2 f2; 3; ; 2rg;
then we have the following chain of argument, using property 3 of Lemma 1 and (6.1),
(6.5)
p [q1 ; q2 ; ; qn ] [qn ; qn 1 ; ; q1 ] p
= ) [q1 ; q2 ; ; qn ] = p = [qn ; qn 1 ; ; q1 ] ) = ;
[q2 ; ; qn ] [qn 1 ; ; q1 ]
(say). It follows from (6.3), Lemma 2 and property 1 of Lemma 1 that
1< < p=2;
so that 2 f2; 3; ; 2rg: Thus the chain of argument that gave (6.5) can be reversed,
starting with and …nishing with :
This argument pairs o¤ the elements of the set f2; 3; : : : ; 2rg giving each member of the
set a unique mate in the set. However this set contains an odd number of elements so that
there must exist at least one member, say ; that mates with itself in the chain (6.5). For
this then we obtain from (6.5)
[q1 ; q2 ; ; qn ] p [qn ; qn 1 ; ; q1 ]
(6.6) = = :
[q2 ; ; qn ] [qn 1 ; ; q1 ]
Now apply Algorithm 1 to both sides of (6.6) to give a representation
(6.7) p = [q1 ; q2 ; ; qn ];
with the palindromic property, and with (6.3) holding,
(6.8) qi = qn+1 i (i = 1; 2; ; n):
If, in (6.8), n = 2t + 1 is odd then n 3 and the representation (6.7) takes the form, for
s 2;
p = [q1 ; ; qs 1 ; qs ; qs 1 ; ; q1 ]:
Now apply property 6 of Lemma 1 to give
p = [q1 ; ; qs 1 ; qs ][qs 1 ; ; q1 ]
+ [q1 ; ; qs 1 ][qs 2 ; ; q1 ];
and then
p = [q1 ; ; qs 1 ]f[q1 ; ; qs 1 ; qs ] + [qs 2 ; ; q1 ]g
on using other properties of Lemma 1. This last result represents the prime number p as the
product of two factors that, using (6.3), are both greater than 1; this is a contradiction to
p 2 P:
Thus in (6.8) the integer n = 2t must be even and so (6.7) takes the form, for s 1,
(6.9) p = [q1 ; ; qs ; qs ; ; q1 ]
8 F.W. CLARKE, W.N. EVERITT, L.L. LITTLEJOHN, AND S.J.R. VORSTER
it follows that r = x0 : In the latter case r x0 p x0 mod(p) and since, again, r and
p x0 are least, positive residues it follows that r = p x0 :
This contradiction completes the proof of Part 2.
10. Appendix
In this appendix we reproduce the original 1855 paper [20] of Henry Smith.
Sit 1
q1 +
1
q2 +
q3 + .
..
1
+
qn
fractio continua, cujus numerator, qui determinanti
q1 ; 1; 0; 0; 0
1; q2 ; 1; 0; 0
0; 1; q3 ; 1; 0
0; 0; 1; q4 ; 0
1
0; 0; 0; 0; 1; qn
aequalis est, per hujusmodi formulam (q1 q2 q3 qn 1 qn ) exprimatur. Erit ergo
[q1 q2 qi 1 qi ] = [qi qi 1 q2 q1 ]
et
[q1 qn ] = [q1 q2 qi ] [qi+1 qn ] + [q1 q2 qi 1 ] [qi+2 qn ];
quae aequationes pendent ab illa forma determinantali, ambae autem L. Eulero debentur.
Itaque, si quantitatum q par sumatur numerus, ipsaeque ita serie symmetrica disponantur,
ut binae inter se aequales …ant, elucet, quantitatem [q1 q2 qi qi q2 q1 ] summam fore
duorum quadratorum inter se primorum; …t enim
[q1 q2 qi q i q2 q1 ] = [q1 q2 qi ]2 + [q1 q2 q i 1 ]2
Contra in numero quotientium impari, erit
[q1 qi 1 qi qi 1 q2 q1 ] = (q1 qi 1 ) f[q1 qi ] + [q1 qi 2 ]g;
unde colligis, numerum [q1 qi q1 ] primum esse non posse, nec duplicem numeri primi;
si quidem casus excipis, in quibus, aut i unitati aequatur, aut i binario, q unitati.
Sit p numerus integer datus; 1 ; 2; s series numerorum, qui ad p primi sunt, ipsiusque
p dimidio minores.
p p p
Formentur fractiones continuae ; ; ; quae omnes ita terminentur, ut is quo-
1 2 s
tiens qui in extremo loco ponatur unitatem superet. Hinc patet, quanta fuerit numerorum
12 F.W. CLARKE, W.N. EVERITT, L.L. LITTLEJOHN, AND S.J.R. VORSTER
Acknowledgement 1. Norrie Everitt thanks his three co-authors for their agreement to
dedicate this paper to Paul Halmos who, from afar, has been his guide and mentor in math-
ematics. This paper should have been completed some years ago for a volume dedicated to
Paul Halmos; apologies for the delay but I hope the paper is now the better for subsequent
collaboration and extension.
All four authors thank Keith Hannabuss, Fellow and Tutor in Mathematics of Balliol
College in Oxford, for his contribution to the Section on the life of Henry Smith; we have
been guided by and quoted from his papers [10] and [11]; additionally we have had access to,
and quoted from a yet unpublished account of the life of Henry Smith.
References
[1] C.W. Barnes. ‘The representation of primes of the form 4n + 1 as the sum of two squares.’ Enseign.
Math. (2) 18 (1972), 289-299.
[2] E.T. Bell. Men of Mathematics. (Victor Gollancz Ltd., London; 1937.)
THE TWO SQUARES THEOREM 13
[3] J. Brillhart. ‘Note on representing a prime as a sum of two squares.’Math. Comp. 26 (1972), 1011-1013.
[4] D.M. Burton. Elementary Number Theory. (The McGraw- Hill Companies, Inc., New York; 1998.)
[5] G.E. Chrystal. Algebra: I and II. (Adam and Charles Black, Edinburgh; 1889. The 6th. edition reprinted
by Chelsea Publishing Co., New York; 1959.)
[6] H.A. Davenport. The Higher Arithmetic. (Hutchinson House, London; 1952.)
[7] L.E. Dickson. History of the Theory of Numbers: II. (Chelsea Publishing Co., New York; 1966.)
[8] U. Dudley. Elementary Number Theory. (2nd. edition. W.H. Freeman and Company, New York; 1978.)
[9] J.A. Ewell. ‘A simple proof of Fermat’s two-square theorem.’Amer. Math. Monthly. 90 (1983), 635-637.
[10] K. Hannabuss. ‘The mathematician the world forgot.’New Scientist. 97 (1983), 901-903.
[11] K. Hannabuss. ‘Forgotten fractals.’The Mathematical Intelligencer. 18 (1996), 28-31.
[12] G.H. Hardy. A Mathematician’s Apology. (Cambridge University Press; 1969).
[13] G.H. Hardy, J.E. Littlewood and G. Pólya. Inequalities. (Cambridge University Press; 1952.)
[14] G.H. Hardy and E.M. Wright. An Introduction to the Theory of Numbers. (5th edition. Oxford University
Press; 1979.)
[15] T. Hawkins. Lebesgue’s Theory of Integration; Its Origins and Development. (Chelsea Publishing Co.,
New York; 1975.)
[16] D.R. Heath-Brown. ‘Fermat’s two-squares theorem.’Invariant. (1984), 3-5.
[17] C. Hermite. ‘Note au sujet de l’article précedent. J. Math. Pures Appl. 13 (1848), 15.
[18] T. Muir and W.H. Metzler. A Treatise on the Theory of Determinants. (Dover Publications. Inc., New
York; 1960.)
[19] J.-A. Serret. ‘Sur un théorème relatif aux nombres entiers.’J. Math. Pures Appl. 13 (1848), 12-14.
[20] H.J.S. Smith. ‘De Compositione Numerorum Primorum 4 + 1 Ex Duobus Quadratis.’Crelle’s Journal.
L (1855), 91-92.
[21] H.J.S. Smith. The Collected Mathematical Papers of Henry John Stephen Smith: I and II. (Edited by
J.W.L. Glaisher. The Clarendon Press, Oxford; 1894. Reprinted by Chelsea Publishing Co., New York;
1965.)
[22] S. Wagon. ‘The Euclidean algorithm strikes again.’Amer. Math. Monthly. 97 (1990), 125-129.
[23] D. Zagier. ‘A one-sentence proof that every prime p 1 (mod 4) is a sum of two squares.’Amer. Math.
Monthly. 197 (1990), 144.
L.L. Littlejohn, Department of Mathematics and Statistics, Utah State University, Lo-
gan, UT 84322-3900, USA
E-mail address: [email protected]