Quadratic Residues and Non-Quadratic Residues
📂Number TheoryQuadratic Residues and Non-Quadratic Residues
Definition
For primes p=2 and a<p, if there exists a solution to the congruence equation x2≡a(modp), then a is called a Quadratic Residue QR modulo p. If a is not a quadratic residue, it is called a Non-Quadratic Residue NR.
Explanation
Simply put, a quadratic residue is a number for which a square root exists in (modp).
For example, consider the prime 7
12≡1(mod7)22≡4(mod7)32≡2(mod7)42≡2(mod7)52≡4(mod7)62≡1(mod7)
1,2,4 is a QR and 3,5,6 is an NR. Considering the prime 11
12≡1(mod11)22≡4(mod11)32≡9(mod11)42≡5(mod11)52≡3(mod11)62≡3(mod11)72≡5(mod11)82≡9(mod11)92≡4(mod11)102≡1(mod11)
1,3,4,5,9 is a QR and the rest 2,6,7,8,10 are NR. Interestingly, QRs appear symmetrically, which is natural because
(p−q)2≡p2−2pq+q2≡q2(modp)
Also, there are always exactly the same number of QRs and NRs.
Theorem
For primes larger than 2, p, there are exactly 2(p−1) QRs and NRs.
Proof
The list of all numbers squared from 1 to p−1 is as follows.
12,22,⋯,(p−1)2
However, as we’ve seen
(p−q)2≡p2−2pq+q2≡q2(modp)
so whether we look at 1 or p−1, it’s the same, and whether we look at 2 or p−2, it’s the same. Therefore, it is sufficient to only look at half of the original number
12,22,⋯,(2p−1)2
These numbers are all QRs by the definition of QRs, so if we can show that all these numbers are different, then we can say that there are exactly 2(p−1) QRs. Similarly, since a natural number smaller than p in (modp) is either a QR or an NR, if there are exactly 2(p−1) QRs, then there must also be exactly 2(p−1) NRs. The formal proof uses reductio ad absurdum. Let b1 and b2 be two different natural numbers smaller than 2(p−1).
Assuming b12≡b22(modp) holds, then
b12−b22≡0(modp)
Therefore, for some integer k, b12−b22=pk, and the prime p is a divisor of (b1+b2)(b1−b2). However, since b1 and b2 are assumed to be smaller than 2(p−1), (b1+b2) is smaller than (p−1). Hence, p cannot be a divisor of (b1+b2), and must therefore be a divisor of (b1−b2). However, by the same reasoning ∣b1−b2∣ is smaller than (p−1), so it must be 0 to be divided by p. That means, b1=b2, but we assumed b1 and b2 to be two different natural numbers smaller than 2(p−1), so this is a contradiction. Therefore, b12=b22(modp) and there are exactly 2(p−1) QRs.
■