Introduction to Number Theory 2
c Eli Biham - May 3, 2005 348 Introduction to Number Theory 2 (12)
Quadratic Residues
Definition: The numbers 02, 12, 22, . . . , (n−1)2 mod n, are called quadratic residues modulo n. Numbers which are not quadratic residues modulo n are called quadratic non-residues modulo n. Example: Modulo 11: i 0 1 2 3 4 5 6 7 8 9 10 i2 mod 11 0 1 4 9 5 3 3 5 9 4 1 There are six quadratic residues modulo 11: 0, 1, 3, 4, 5, and 9. There are five quadratic non-residues modulo 11: 2, 6, 7, 8, 10.
c Eli Biham - May 3, 2005 349 Introduction to Number Theory 2 (12)
Quadratic Residues (cont.)
Lemma: Let p be prime. Exactly half of the numbers in Z∗
p are quadratic
- residues. With 0, exactly p+1
2 numbers in Zp are quadratic residues.
Proof: There are at most p+1
2 quadratic residues, since
02 12 ≡ (p − 1)2 (mod p) 22 ≡ (p − 2)2 (mod p) . . . i2 ≡ (p − i)2 (mod p) ∀i . . . Thus, all the elements in Zp span at most p+1
2 quadratic residues.
There are at least p+1
2
quadratic residues, otherwise, for some i = j ≤ p−1
/ 2 it
holds that i2 = (p − i)2 = j2 = (p − j)2, in contrast to Lagrange theorem that states that the equation x2 − i2 = 0 has at most two solutions (mod p).
c Eli Biham - May 3, 2005 350 Introduction to Number Theory 2 (12)
Quadratic Residues (cont.)
Since Z∗
p is cyclic, there is a generator. Let g be a generator of Z∗ p.
- 1. g is a quadratic non-residue modulo p, since otherwise there is some b such
that b2 ≡ g (mod p). Clearly, bp−1 ≡ 1 (mod p), and thus g
p−1 2
≡ bp−1 ≡ 1 (mod p). However, the order of g is p − 1. Contradiction.
- 2. g2, g4, . . . , g(p−1) mod p are quadratic residues, and are distinct, therefore,
there are at least p−1
2 quadratic residues.
- 3. g, g3, g5, . . . , g(p−2) mod p are quadratic non-residues, since if any of them
is a quadratic residue, g is also a quadratic residue. QED
c Eli Biham - May 3, 2005 351 Introduction to Number Theory 2 (12)