Quadratic Residues
Total Page:16
File Type:pdf, Size:1020Kb
Q Quadratic residues Q.1 Legendre symbol Let – p be an odd prime, p > 2, ? – g any generator of Zp. ? ? 2 Remark Q.1. If a ∈ Zp is a square, id est there is b ∈ Zp : b = a then a has precisely two roots b and −b 6= b ? ? 2 (mod p). In fact, if we denote f : Zp → Zp the morphism defined by f(a) = a , since its kernel ker(f) = {1, −1} satisfies # ker(f) = 2, we know that 2 ? ? Im(f) = b : b ∈ Zp = Zp/ ker(f) p−1 −1 2 so that # Im(f) = 2 and each coset f (a) = {b : b = a}, a ∈ Im(f) has 2 elements. If we choose, as canonical representative of Zp the set p p {a : − < a < } ⊂ 2 2 Z then one of the roots has a positive representative, the other a negative representative. If we instead choose as canonical representative of Zp the set {a : 0 ≤ a ≤ p − 1} ⊂ Z one of the roots has an odd representative, the other an even representative. ut ? Definition Q.2. Let p be an odd prime, p > 2. An element a ∈ Zp is called a quadratic residue modulo p iff a ∈ Im(f), a nonresidue if a∈ / Im(f). ? ¯ ? ¯ ? We will denote Qp ⊂ Zp the set Qp := Im(f) of the quadratic residues modulo p and Qp ⊂ Zp the set Qp := Zp \Qp of the nonquadratic residues . ? The quadratic residuosity/nonresiduosity can be also characterized in terms of any generator g of Zp: Lemma Q.3. a = gj is a quadratic residue if and only if j is even. 2 ? j 2 2j Proof. Im(f) = b : b ∈ Zp = (g ) : 1 ≤ j < p = g : 1 ≤ j < p . ut Example Q.4. Let p = 11 and g = 2 Then we have j 1 2 3 4 5 6 7 8 9 10 p j p − 2 < g < 2 2 4 −3 5 −1 −2 −4 3 −5 1 0 ≤ gj ≤ p − 1 2 4 8 5 10 9 7 3 6 1 0 ≤ a ≤ p − 1 0 1 2 3 4 5 6 7 8 9 10 p p − 2 < a < 2 −5 −4 −3 −2 −1 0 1 2 3 4 5 ind(a) 9 7 3 6 5 ∗ 10 1 8 2 4 9 7 3 6 5 ±b {b, p − b} a = b2 ind(a) ±1 {1, 10} 1 10 ±2 {2, 9} 4 2 ±3 {3, 8} −2 6 ±4 {4, 7} 5 4 ±5 {5, 6} 3 8 Q.1 Thus the quadratice residues are Q11 := {4, 5, −2, 3, 1} and the nonresidue Q¯11 := {2, −3, −1, −4, −5} Moreover we have a√∈ Q11 1 4 −2 5 3 0 < a < p 1 2 3 4 5 √ 2 − p < − a < 0 −1 −2 −3 −4 −5 2 √ odd √a 1 9 3 7 5 even a 10 2 8 4 6 ind(a) 10 2 6 4 8 ut Example Q.5. Analogously • for p = 5, g = 2 we have : ±b {b, p − b} a = b2 ind(a) ±1 {1, 4} 1 4 ±2 {2, 3} −1 2 so that the quadratice residues are Q5 := {±1} and the nonresidue Q¯5 := {±2}. • while for p = 7, g = 31 we obtain j 1 2 3 4 5 6 p j p − 2 < g < 2 3 2 −1 −3 −2 1 0 ≤ gj ≤ p − 1 3 2 6 4 5 1 0 ≤ a ≤ p − 1 0 1 2 3 4 5 6 p p − 2 < a < 2 −3 −2 −1 0 1 2 3 ind(a) 4 5 3 ∗ 6 2 1 4 5 3 ±b {b, p − b} a = b2 ind(a) ±1 {1, 6} 1 6 ±2 {2, 5} −3 4 ±3 {3, 4} 2 2 Thus the quadratice residues are Q7 := {2, −3, 1} and the nonresidue Q¯7 := {3, −1, −2}. ut Definition Q.6. Let p be an odd prime, p > 2 and a ∈ Z. We define the Legendre symbol 0 if p | a a = 1 if a is quadratic residue modulo p p −1 if a is nonresidue modulo p a (p−1)/2 Proposition Q.7. (Euler’s Criterion) p ≡ a (mod p). Proof. If p | a, a(p−1)/2 = 0. j j(p−1) (p−1)/2 j(p−1)/2 If p - a and a = g , a is a residue iff j is even, iff p − 1 | 2 iff a = g = 1. ut (p+1) Corollary Q.8. If p ≡ 3 (mod 4) and a ∈ Qp its roots are ±a 4 . (p+1) 2 (p+1) (p−1) 4 2 2 a Proof. We have ±a = a = a · a = p a = a. ut Proposition Q.9. The Legendre symbol satisfies the following properties: a b (1) a ≡ b (mod p) =⇒ p = p ; ab a b (2) p = p p ; ab2 a (3) gcd(b, p) = 1 =⇒ p = p ; 1 (4) p = 1 123 = 8 ≡ 1 (mod 7) so that 2 is not a generator. Q.2 −1 (p−1)/2 (5) p = (−1) Proof. (1) and (4) are trivial; (2) and (5) follow directly form Euler’s Criterion. ab2 a b2 a Ad (3): p = p p = p . ut m2−1 k2+k Lemma Q.10. For any odd integer m = 2k + 1, 8 = 2 ∈ N m2−1 4(k2+k) k2+k Proof. We have 8 = 8 = 2 which is an integer because k(k + 1) is necessarily even for each k. ut Proposition Q.11. It holds: ( 2 1 if p ≡ ±1 (mod 8) (6) 2 = (−1)(p −1)/8 = p −1 if p ≡ ±3 (mod 8) Proof. Since p−1 p−1 p−1 p−1 2 p2 − 1 p + 1 p − 1 1 + 1 X = · · = 2 2 = 2 = k 8 2 2 2 2 2 k=1 we have p−1 p−1 p−1 p−1 p−1 p−1 p−1 p−1 p−1 p−1 2 2 P k 2 2 2 2 2 2 2 2 (p2−1)/8 Y Y Y k Y Y Y Y Y (p−1)/2 Y (−1) k = (−1) k=1 k = (−1) k = k −k ≡ k (p − k) = 2k = 2 k k=1 k=1 k=1 k=1 k=1 k=1 k=1 k=1 k=1 k even k odd k even k odd p−1 Q 2 and we obtain the claim dividing out k=1 k. ut Fact Q.12. For any two odd primes p, q, it holds p − if p ≡ q ≡ 3 (mod 4) (7) q = (−1)(p−1)(q−1)/4 p = q p q p q otherwise. Q.2 Jacobi symbol The definition of Legendre symbol was generalized to the case of any integer a and any odd integer n. Qr ai Definition Q.13. Let n be an odd integer and n = i=1 pi its prime factorization. For any a ∈ Z we define the Jacobi symbol r a a Y a i := . n p i=1 i Lemma Q.14. Let s, t ∈ N be odd. Then: s − 1 t − 1 st − 1 + ≡ (mod 2) 2 2 2 and s2 − 1 t2 − 1 s2t2 − 1 + ≡ (mod 2) 8 8 8 Proof. For s = 2s0 + 1 and t = 2t0 + 1, we have st = 4s0t0 + 2(s0 + t0) + 1 = 2(2s0t0 + s0 + t0) + 1 whence st − 1 s − 1 t − 1 = 2s0t0 + (s0 + t0) ≡ s0 + t0 = + (mod 2). 2 2 2 and s2t2 − 1 (2s0t0 + s0 + t0)2 + (2s0t0 + s0 + t0) (s0 + t0)2 + (s0 + t0) s02 + s0 t02 + t0 s2 − 1 t2 − 1 = ≡ ≡ + = + (mod 2). 8 2 2 2 2 8 8 ut Qr ai Corollary Q.15. Let n be an odd integer, n = i=1 pi its prime factorization. Then r 2 r 2 n − 1 X pi − 1 n − 1 X p − 1 ≡ a (mod 2) and ≡ i a (mod 2) 2 2 i 8 8 i i=1 i=1 ut Q.3 Proposition Q.16. The Jacobi symbol satisfies the following properties: a b (1) a ≡ b (mod n) =⇒ n = n ; ab a b (2) n = n n ; ab2 a (3) gcd(b, n) = 1 =⇒ n = n ; 1 (4) n = 1 −1 (n−1)/2 (5) n = (−1) ( 2 1 if n ≡ ±1 (mod 8) (6) 2 = (−1)(n −1)/8 = n −1 if n ≡ ±3 (mod 8) ( n m (m−1)(n−1)/4 n − m if m ≡ n ≡ 3 (mod 4) (7) for any two odd integers m, n, it holds n = (−1) m = n m otherwise. Proof. (1-4) are trivial. ai −1 r −1 r pi−1 a Pr pi−1 a n−1 Ad (5): = Q = Q (−1) 2 i = (−1) i=1 2 i = (−1) 2 . n i=1 pi i=1 ai p2−1 p2−1 2 2 r 2 r i a Pr i a n −1 Ad (6): = Q = Q (−1) 8 i = (−1) i=1 8 i = (−1) 8 . n i=1 pi i=1 m n Qr ai Qs bi Ad (7): If gcd(m, n) 6= 1 then, by definition n = 0 = m . Otherwise let m = i=1 pi and n = j=1 qj be their prime factorizations. We have r s aibj r s aibj m Y Y pi Y Y qj n = = ± = ± n q p m i=1 j=1 j i=1 j=1 i Denote – I := {i : 1 ≤ i ≤ r : pi ≡ 3 (mod 4)} P – ι := i∈I ai – J := {j : 1 ≤ j ≤ s : qj ≡ 3 (mod 4)} P – κ := j∈J bj – L := {(i, j) : 1 ≤ i ≤ r, 1 ≤ j ≤ s : pi ≡ qj ≡ 3 (mod 4)} = {(i, j): i ∈ I, j ∈ J} P P P P – λ := (i,j)∈L aibj = aibj = i∈I ai j∈J bj = ικ i∈I j∈J m λ n ικ n m n and remark that n = (−1) m = (−1) m so that n = − m if and only if both ι and κ are odd.