Chter 8 Qudrtic Residues 8. Qudrtic residues Let n>be given ositive integer, nd gcd, n. We sy tht Z n is qudrtic residue mod n if the congruence x mod n is solvble. Otherwise, is clled qudrtic nonresidue mod n.. If nd b re qudrtic residues mod n, so is their roduct b.. If is qudrtic residue, nd b qudrtic nonresidue mod n, then b is qudrtic nonresidue mod n. 3. The roduct of two qudrtic nonresidues mod n is not necessrily qudrtic residue mod n. For exmle, in Z {, 5, 7, }, only is qudrtic residue; 5, 7, nd 5 7 re ll qudrtic nonresidues. Proosition 8.. Let be n odd rime, nd. The qudrtic congruence x +bx+c 0mod is solvble if nd only if x + b b 4c mod is solvble. Theorem 8.. Let be n odd rime. Exctly one hlf of the elements of Z re qudrtic residues. Proof. Ech qudrtic residue modulo is congruent to one of the following residues.,,...,k,...,. We show tht these residue clsses re ll distinct. For h<k, h k mod if nd only if k hh + k is divisible by, this is imossible since ech of k h nd h + k is smller thn. Corollry 8.3. If is n odd rime, the roduct of two qudrtic nonresidues is qudrtic residue.
46 Qudrtic Residues 8. The Legendre symbol Let be n odd rime. For n integer, we define the Legendre symbol { +, if is qudrtic residue mod, :, otherwise. Lemm 8.4. b b. Proof. This is equivlent to sying tht modulo, the roduct of two qudrtic residues resectively nonresidues is qudrtic residue, nd the roduct of qudrtic residue nd qudrtic nonresidue is qudrtic nonresidue. For n odd rime,. This is resttement of Theorem 8.6 tht is qudrtic residue mod if nd only if mod4. Theorem 8.5 Euler. Let be n odd rime. For ech integer not divisible by, mod. Proof. Suose is qudrtic nonresidue mod. The mod residues,,..., re rtitioned into irs stisfying xy. In this cse,! mod. On the other hnd, if is qudrtic residue, with k k mod, rt from 0, ±k, the remining 3 elements of Z cn be rtitioned into irs stisfying xy.! k k 3 mod. Summrizing, we obtin! mod. Note tht by utting, we obtin Wilson s theorem:! mod. By comrison, we obtin formul for : mod.
8.3 s qudrtic residue mod 47 8.3 s qudrtic residue mod Theorem 8.6. Let be n odd rime. is qudrtic residue mod if nd only if mod4. Proof. If x mod, then x mod by Fermt s little theorem. This mens tht is even, nd mod4. Conversely, if mod4, the integer is even. By Wilson s theorem,! j i j j i j j! mod. i The solutions of x mod re therefore x ±!. Here re the squre roots of mod for the first 0 rimes of the form 4k +: 5 ± 3 ±5 7 ±4 9 ± 37 ±6 4 ±9 53 ±3 6 ± 73 ±7 89 ±34 97 ± 0 ±0 09 ±33 3 ±5 37 ±37 49 ±44 57 ±8 73 ±80 8 ±9 93 ±8 Theorem 8.7. There re infinitely mny rimes of the form 4n +. Proof. Suose there re only finitely mny rimes,,..., r of the form 4n +. Consider the roduct P r +. Note tht P mod4. Since P is greter thn ech of,,..., r, it cnnot be rime, nd so must hve rime fctor different from,,..., r. But then modulo, is squre. By Theorem 8.6, must be of the form 4n +, contrdiction. In the tble below we list, for rimes < 50, the qudrtic residues nd their squre roots. It is understood tht the squre roots come in irs. For exmle, the entry,7 for the rime 47 should be interreted s sying tht the two solutions of the congruence x mod47re x ±7mod47. Also, for rimes of the form 4n +, since is qudrtic residue modulo, we only list qudrtic residues smller thn. Those greter thn cn be found with the hel of the squre roots of.
48 Qudrtic Residues Qudrtic residues mod nd their squre roots 3, 5,, 7,, 3 4,, 3, 5 4, 5, 4 9, 3 3, 5, 3, 4 4, 7, 4,, 6 4, 8, 5 9, 4, 5, 9 6, 5 7, 8 9, 3, 7 6, 4 7, 6 3,, 5 3, 7 4, 6, 8, 0 9, 3, 9 3, 6 6, 4 8, 8 9,, 4, 5, 6, 8 7, 6 9, 3 3, 0 3,, 8 4, 5, 6 7, 0 8, 5 9, 3 0, 4 4, 3 6, 4 8, 7 9, 9 0, 5, 5 8, 37, 6, 3, 5 4, 7, 9 9, 3 0,, 4, 7 6, 4 4, 9,, 7 4, 5, 3 8, 7 9, 3 0, 6 6, 4 8, 0 0, 5 43, 4, 6, 7 9, 3 0, 5, 3, 0 4, 0 5, 6, 4 7, 9, 8 3, 8 4, 4 5, 5 3, 7 35, 36, 6 38, 9 40, 3 4, 6 47,, 7 3, 4, 6, 0 7, 7 8, 4 9, 3, 3 4, 6, 4 7, 8 8,, 6 4, 0 5, 5 7, 8, 3 3, 9 34, 9 36, 6 37, 5 4, 8 8.4 The lw of qudrtic recirocity Proosition 8.8 Guss Lemm. Let be n odd rime, nd n integer not divisible by. Then μ where μ is the number of residues mong flling in the rnge <x<.,, 3,..., Proof. Every residue modulo hs unique reresenttive with lest bsolute vlue, nmely, the one in the rnge x. The residues described in the sttement of Guss Lemm re recisely those whose reresenttives re negtive. Now, mong the reresenttives of the residues of,,, sy, there re λ ositive ones, r,r,...,r λ, nd μ negtive ones Here, λ + μ, nd 0 <r i,s j <. s, s,..., s μ.
8.4 The lw of qudrtic recirocity 49 Note tht no two of the r s re equl; similrly for the s s. Suose tht r i s j for some indices i nd j. This mens h r i mod ; k s j mod for some h, k in the rnge 0 <h,k<. Note tht h + k 0mod. But this is contrdiction since h + k< nd does not divide. It follows tht r,r,...,r λ,s,s,...,s μ re ermuttion of,,...,. From this μ, nd μ. By Theorem 8.5, μ. Exmle 8.. Let 9nd 5. We consider the first 9 multiles of 5 mod 9. These re 5, 0, 5, 0, 5 6, 30, 35 6, 40, 45 7. 4 of these exceed 9, nmely, 0, 5,, 6. It follows tht 5 9 ; 5 is qudrtic residue mod 9. Theorem 8.9. 4 + 8. Equivlently, { + if ±mod8, if ±3mod8. Proof. We need to see how mny terms in the sequence,, 3,..., re in the rnge <x<.if 4k +, these re the numbers k +,...,4k, nd there re k of them. On the other hnd, if 4k +3, these re the numbers k +,...,4k +, nd there re k +of them. In ech cse, the number of terms is [ +]. 4 Exmle 8.. Squre root of mod for the first 0 rimes of the form 8k ±. 7 3 7 6 3 5 3 8 4 7 47 7 7 73 3 79 9 89 5 97 4 03 38 3 5 7 6 37 3 5 46 67 3 9 57 93 5 99 0 Proosition 8.0 Euler. Let >3 be rime number of the form 4k +3.Ifq + is lso rime, then the Mersenne number M hs rime fctor +nd is comosite. Indeed 5 9 mod 9.
50 Qudrtic Residues Proof. Note tht the rime q is of the form 8k +7, nd so dmits s qudrtic residue. By Theorem 8.9, q modq. q This mens tht q +divides M. If>3, +<, nd M is comosite. For exmle, M is divisible by 3 since 3 + is rime. Similrly, M 3 3 is divisible by 47, nd M 83 83 is divisible by 67. Theorem 8. Lw of qudrtic recirocity. Let nd q be distinct odd rimes. q q. q Equivlently, when t lest one of, q mod4, is qudrtic residue mod q if nd only if q is qudrtic residue mod. Proof. Let be n integer not divisible by. Suose, s in the roof of Guss Lemm bove, of the residues,,..., the ositive lest bsolute vlue reresenttives re r, r,...,r λ, nd the negtive ones re s, s,..., s μ. The numbers,,..., re ermuttion of hi + r i, i,,...,λ, nd kj + s j, j,,...,μ, where h,..., h λ, k,..., k μ re ermuttion of,,...,. Considering the sum of these numbers, we hve m m m m m In rticulr, if is odd, then m + m + m + λ r i + i λ r i + i m μ s j j μ s j + j μ s j j m + μ μ s j. j μ m m mod, For q 3mod4, is qudrtic residue mod q if nd only if q is qudrtic nonresidue mod.
8.4 The lw of qudrtic recirocity 5 nd by Guss lemm, m m. Therefore, for distinct odd rimes nd q,wehve q m mq, nd q n n q. q q n m 3 In the digrm bove, we consider the lttice oints m, n with m nd n q. There re ltogether q such oints forming rectngle. These oints re serted by the line L of sloe q through the oint 0,0. For ech m,,...,, the number of oints in the verticl line through m, 0 under L is mq. Therefore, the totl number of oints under L is mq m. Similrly, the totl number of oints on the left side of L is q n. From these, we hve n q It follows tht m mq + q n n q q. q q. q The lw of qudrtic recirocity cn be recst into the following form: q, if q 3mod4, q +, otherwise. q
5 Qudrtic Residues Exmles. 59 3 3 59. 34 97 97 7 7 97 3 59 59 3 7 3 3 7 97.Now, 97 +by Theorem 8.9, nd 97 7 3 4 3 7 7 7 7 7. 7 3. 3 3. For which rimes is 3 qudrtic residue? 3 3 k+ ɛ ɛ k rovided 6k + ɛ, ɛ ±. This mens 3 is qudrtic residue mod if nd only if k is even, i.e., m ±.
Chter 9 Clcultion of Squre Roots 9. Squre roots modulo. Let be rime of the form 4k +3.If re ± 4 +., then the squre roots of mod Proof. 4 + + mod.. Let be rime of the form 8k +5.If, then the squre roots of mod re ± 8 +3 if 4 mod, ± 4 8 +3 if 4 mod. Proof. Note tht Since 8 +3 4 +3 4 mod. mod,wehve 4 ±mod. If 4 mod, then this gives 8 +3 s squre root of mod. If 4 mod, then we hve y 8 +3 8 +3 y 4 8 +3 for ny qudrtic nonresidue y mod. Since 5mod8, we my simly tke y.
54 Clcultion of Squre Roots Exmles. Let 3. Clerly is qudrtic residue mod 3. The squre roots of re ± 6 ±8 5mod3.. Let 9. Both 6 nd 7 re qudrtic residues mod 9. Since 7 7 mod9, the squre root of 7 re ±7 4 ±3 6mod9. On the other hnd, Since 6 7 mod9, the squre roots of 6 re ± 7 6 4 ± 0 ±8mod9. Proosition 9.. Let be n odd rime nd λ u, u odd. Consider the congruence x mod. Let b be ny qudrtic nonresidue mod. Assume tht u ±mod, nd tht μ> is the smllest integer for which u μ mod. If μ λ, then the congruence hs no solution. b If μ λ, then u b u λ μ k for some odd number k< μ+. The solutions of the congruence re x ± u+ b λ μ μ+ ku mod. Exmle 9.. Consider the congruence x 5 mod 57. Here 57 8. In the nottion of the bove theorem, u. With 5, the order of u 5 modulo 57 is 8: 5 ; 5 4 97; 5 8 ; 5 6 4; 5 3 6; 5 64 56. This mens μ 6. Let b 3, qudrtic nonresidue of 57. The successive owers of b u 3 re, modulo 57, 3 9; 3 4 8; 3 8 36; 3 6 49; 3 3 64; 3 64 4; 3 8 56. Now, u 5 should be n odd ower of b u λ μ 3 9. In fct, 9 3 79 5 mod 57. This mens k 3. The solutions of the congruence re x ±5 3 0 7 3 ±5 3 5 ±30 7 mod 57. 9. Squre roots modulo n odd rime ower The qudrtic congruence x mod7clerly hs solutions x ±3mod7. We wnt to solve the congruence x mod7 by seeking solution of the form x 3+7b. 3 + 7b 9+6b 7+b 7 ++6b 7mod7 Choose b so tht +6b 0mod7. This gives b mod7nd x 0 mod 7.
9.3 Squres modulo k 55 Exercise. Find the squres modulo 49. Answer. Squres modulo 49: 9 6 3 30 37 44 0 3 45 38 3 4 7. Proceed to solve the congruences x mod7 3. nd x mod7 4. Proosition 9.. Let be n odd rime. Suose x mod k hs solution x c k mod k. Let γ be the multilictive inverse of c Z. Then with b k γ c k mod, We k hve solution c k+ c k + b k k mod k+ of x mod k+. Exmle 9.. The solutions of the congruences x follows: 345 mod 7 k for k 8 re s k 3 4 5 6 7 8 x mod 7 k 37 37 380 58 897 67746 34809 The bse 7 exnsions of these solutions re x ±35505 7. 9.3 Squres modulo k Here re the squres modulo k,utok 7. Z 4 : 0,, Z 8 : 4, Z 6 : 9, Z 3 : 6, 7, 5, Z 64 : 33, 36, 4, 49, 57, Z 8 : 64, 65, 68, 73, 8, 89, 97, 00, 05, 3,. It is esy to see tht the nlogue of Proosition xxx is no longer true. For exmle, is clerly squre of Z 4 ;but5+4is not squre in Z 8. Suose c Z k is squre. Let h be the smllest integer such tht c + h for some Z h. Since c + h + h+ + h, we must hve h +<k, nd h k. From this, we infer tht 5 is not squre, nd the squres in Z 8 re 0,, 4. Also, rt from these, the squres in Z 6 re 4 0, 5 9, 6 4, nd 7. This mens tht the squres in Z 6 re 0,, 4 nd 9. Proosition 9.3. Let k 3. For every squre c Z k, c + k is squre in Z k+. Proof. Clerly, if c, c + k + k + k Z k+. Ifc, we write c + h for h k nd Z k 3. Then, + h + k c+ k + h + k. Since is unit, modulo k+, this is c + k.
56 Clcultion of Squre Roots Corollry 9.4. A residue given in binry exnsion k k 0, is qudrtic residue mod k if nd only if on the right of the rightmost digit there is n even number ossibly none of zeros, nd on its left there re t lest two zeros.