19. The Fermt-Euler Prime Number Theorem Every prime number of the form 4n 1 cn be written s sum of two squres in only one wy (side from the order of the summnds). This fmous theorem ws discovered bout 1660 by Pierre de Fermt (1601-1665), the gretest French mthemticin of the seventeenth century. It ws not published, however, until 1670, when it ppered, unfortuntely without proof, in the notes of the works of Diophntus, edited by Fermt s son. It is not certin whether or not Fermt hd obtined proof. The first proof of the theorem ws presented lmost 100 yers lter by Leonhrd Euler in his tretise "Demonstrtio theoremtis Fermtini, omnem numerum primum forme 4n 1 esse summm duorum qudrtorum" (Novi Commentrii Acdemie Petropolitne d nnos 1754-1755, vol. V), fter yers of fruitless ttempts t its proof. Tody there re severl proofs of the theorem. The following one is noted for its simplicity. It does however use fir number of results from number theory, some of which will be need in No. s well. In the following, ll vribles represent integers (whole numbers). Definition Two numbers nd b (ccording to Guss), re congruent mod m, m being positive integer, written Notes Theorem 1. q bmod m nd red is congruent to b mod m, if their difference is divisible by m, i.e., m Ÿ"b. Every number is congruent to its reminder, or residue, when divided by m. For exmple 65 q mod 7, but lso 65 q 9mod 7, thinking of 65 719. Conventionl or common residues re nonnegtive integers less thn or equl to m. The set 0, 1,,...,m is complete residue system modm, becuse it hs m elements no two of which re congruent mod m, (nd every integer is congruent modm to one of its members). A miniml (or lest) residue mod m is residue whose bsolute vlue is less thn or equl to m. For instnce " is lest residue of 89mod 13, since. The set of lest residues mod13 is 89 q "mod13 nd " 13 "6,"5,...,,0, 1,...,5, 6. A set of lest residues mod6 is ",,0,1,, 3 s is "3,",,0, 1,. A set of lest residues mod m is complete residue system. 1. q mod m for ll.. If q bmod m, then b q modm. 3. If q bmod m nd b q c mod m, then q c mod m. 1
4. If two numbers re congruent to third, they re lso congruent to ech other. (This follows from nd 3.) 5. If q bmod m nd c q dmod m, then c q b dmodm, " c q b " dmodm, nd c q bdmod m. [If b gm nd c dhm, then c bd Ÿbhcgghm m.] 6. If q bmod m, then g q bg mod m for ny integer g, i.e., congruence cn be multiplied by ny number. 7. If g, g b nd gcdÿg, m 1, i.e., g nd m re reltively prime, then we cn divide the congruence q b modm by g resulting in g q b g modm. For exmple from 49 q 14mod 5, it follows tht 7 q mod 5. 8. If S 1,,..., m is complete residue system mod m, nd gcdÿ,m 1, then x q bmod m hs unique solution (or root) in S. [gcdÿ, m 1 there re integers s nd t such tht s mt 1 or s q 1mod m. Then sx q sbmod m, nd x q sbmodm. Furthermore sb is congruent to just one element of S.] 9. If S 1,,..., m is complete residue system mod m, nd gcdÿ,m 1, then so is T 1,,..., m. [ i q j modm i q j mod m by 7. Thus the elements of T re distinct nd no two re congruent mod m. Ech i is congruent to some j mod m since x q i mod m hs unique solution j by 8. Hence every integer n is congruent to some element in S nd then lso in T.] We lso need some results bout qudrtic residues. Definition. is qudrtic residue (QR)modm if gcdÿ, m 1 nd x q modm for some integer x. If there is no such x, then is qudrtic nonresidue (QNR). For exmple, 1 is QR mod 13, since 8 q 1mod 13, while is QNR mod 3, since x q mod3 hs no solution. Ÿ 1 if is QR mod p nd Ÿ p if is Nottion. If gcdÿ, p 1, p prime, p QNR mod p. Ÿ p is the Legendre symbol. 1 13 1, 3. Throughout the following, p denotes n odd prime number. Theorem. There re totl of P mutully incongruent QRs nd just s mny mutully incongruent QNRs mod p. The QRs re 1,,...,P mod p. No two of (the QRs) 1,,...,P re congruent modp, becuse with x, y 1,,...,P, x q y mod p p Ÿxy Ÿx " y, but this cn t hppen since 0 xy, x " y p. This give us P mutully incongruent QRs. No new QRs re obtined going beyond P. Indeed, consider ŸPh mod p. Let k t P be such tht P h q k modp (i.e., k is the lest residue of Phmod p). Then ŸPh q k mod p,
one of the QRs 1,,...,P mod p. Since there re (side from 0mod p) P mutully incongruent numbers modp, there must be totl of P mutully incongruent QNRs mod p. R Theorem 3. The product of two QRs nd the product of two QNRs is QR; the product of QR nd QNR is QNR. Let r 1 nd r be QRs, nd n 1 nd n be QNRs mod p. 1. From 1 q r 1, q r, we obtin Ÿ 1 q r 1 r mod p, nd thus r 1 r is QR.. The P numbers 1,,...,P,n 1 1,n 1,...,n 1 P re mutully incongruent modp. Since the first P of these numbers re QRs mod p, nd since only P QRs exist, the P numbers n 1 1, n 1,...,n 1 P must be QNRs, i.e., n i r j is QNR. 3. The P numbers n 1 1, n 1,...,n 1 P, n 1 n 1, n 1 n,...,n 1 n P re mutully incongruent mod p. The first P of them, by, re QNRs; thus the others must be QRs, mong them n 1 n. R Theorem 4. if if q P mod p. In terms of the Legendre symbol Let gcdÿ,p 1. Then is QR mod p if q P 1 modp, nd is QNR mod p Ÿ p q mod p. For ny x S 1,,...,p " 1, there is unique y S such tht xy q mod p. Pick x 1 rbitrrily in S, nd let y 1 S be tht number such tht x 1 y 1 q mod p. Then pick x in S different from x 1 nd y 1, nd let y be tht number so tht x y q mod p. Continue in this mnner until ll the numbers in S hve been used. If is QR, then for some v, x v y v, i.e. x v q mod p. The sme is true for x6 p " x v, nd x v nd x6 re the only solutions to x q modp in S. Furthermore x v x6 x v p " x v q " modp. Multiply ll the P " 1 congruences xy q mod p with this lst one to get Ÿ! q " P mod p. Note tht when 1 (clerly QR), we hve Wilson s Theorem Ÿ! q mod p. By Wilson s Theorem, we conclude tht if is QR, then q P 1 modp. If is QNR, then there re exctly P congruences xy q modp, nd x nd y re never equl. Multiply them ll together to get Ÿ! q P mod p, nd by Wilson s Theorem, q P mod p. R Corollry. p p Ÿ Ÿ Ÿ q Ÿ equl (since p 4 ).. R mod p, nd since both sides re o1, it follows tht they re in fct Theorem 5. (Euler) is QR mod p if nd only if p q 1mod 4. If p q 1 mod4, then p 1 4n, n is even, nd p Ÿ Ÿ n 1. 3
Ifp q 3 mod4, then is odd, nd p Ÿ Ÿ. R Thus, x 1 q 0mod p hs solution if nd only if p is on the form 4n 1. Theorem 6. If p Ÿ b, but p 4 nd p 4 b, then p c d for some integers c nd d. (This with Theorem 5 shows tht only those primes of the form 4n 1 cn be written s sums of squres.) Let b pf. If f 1, we re done, so ssume f 1. Next, without loss of generlity, we my ssume tht f p. [If this is not the cse, simply replce nd b by their lest residues 0 nd b 0 mod p. Then 0 b 0 pf 0, nd since 0, b 0 p, pf 0 p p 1 4 4 p, nd f 0 p. For exmple 50 1 1 501 6141, but 50 q 1mod 61, nd Ÿ1 1 1 61 with 61.] If ) nd * re lest residues for nd b modf respectively, then ) * ff 1 where f 1 t 1 f, nd then Ÿ b Ÿ) * Ÿpf Ÿff 1 pf f 1, or Ÿ) b* Ÿ* " b) pf f 1. Since ) b* q b q 0 modf, nd * " b) q b " b q 0 modf, we cn divide this lst equlity through by f to get 1 b 1 pf 1, where f 1 t 1 f. Now f 1 p 0, for otherwise ) * 0, nd f nd f b, sy mf,b nf, nd then b Ÿmf Ÿnf pf, whence p Ÿm n f, nd f 1, contrry to f 1. If f 1 1, 1 b 1 p provides representtion of p s sum of squres. If f 1 1, repet this procedure strting with 1 b 1 pf 1 to get b pf with 0 f t 1 f 1, etc. This method of constructing new equtions with ever decresing fs continues until 1 ppers (which it must). This lst eqution gives representtion of p s sum of two squres. R For exmple: 11 1 1 61 1 1 1 1 Ÿ11 1 1 Ÿ1 1 1 611 Ÿ11 111 Ÿ1111 61 1 1 10 61 1 6 5 61. Theorem 7. 1. A prime number q of the form 4n 3 cnnot be written s sum of two squres.. Every prime number p of the form 4n 1 cn be written s sum of two squres in exctly one wy (up to the order in which the summnds re written). 4
1. Suppose tht b q. Then b q " modq. b is certinly QR mod q (since it s the squre of b). On the other hnd is QNR by Theorem 5, is certinly QR, nd Theorem 3 implies tht " is QNR. This mkes b both QR nd QNR, contrdiction.. In this cse, Theorem 5 gurntees the existence of x so tht p Ÿx 1. Then Theorem 6 implies tht p b for some positive integers nd b. Assume tht there is second representtion p A B. Then p Ÿ b ŸA B ŸAoBb ŸAb#B. Since p divides A p " b p A Ÿ b " b ŸA B A " B b ŸA Bb ŸA"Bb, p ŸABb or p ŸA " Bb. Since ABb 0 nd AbB 0, we conclude tht either or ABb p nd t the sme time Ab"B 0 AbB p nd t the sme time A"Bb 0 Note. A nd either A b B or A B b. The first of these equtions implies tht A A nd B b while the second implies tht A b B b A B B b A B b 1, nd 1, nd A b nd B. Thus the representtion of p s sum of two squres is unique up to the order in which the squres re written. R B b A B B b A kb nd kb for some k (not necessrily n integer). Then Ÿk1 b Ÿk1 B b. 5