Theorem 5: If a prime p ≡ 3 mod 4, then ≡ ∀ either is a or –a is a non-quadratic residue.
Proof: If p ≡ 3 mod 4, then p will be of the form 4l + 3 for some integer l, i.e., p = 2k+1 for some odd number k where k = 2l+1. We prove the theorem using contradiction. Assume both a and –a are quadratic residues modulo p. We then have x2 ≡ a mod p and y2 ≡ -a mod p for some x, y ∈Z*p . From this we have x2k ≡ ak mod p and y2k ≡ (-1)kak mod p. Since k is odd x2k mod p and y2k mod p must have opposite signs. But from Fermat’s little theorem, both x2k and y2k must be congruent to 1 mod p, which contradicts the assumption. Hence either a or –a is a non-quadratic residue. ![]()
If p ≡ 3 mod 4 then either p ≡ 3 mod 8 or p ≡ 7 mod 8. Using the previous theorems we can easily show that the first case 2 is the generator and in the second case p-2 is the generator. Thus using this characterization we can compute the generator of any odd prime p ≡ 3 mod 4 in O(1) time.
Now we will prove an important theorem for finding out the square root of any quadratic residue.
Theorem 6: If a ∈Z*p is a quadratic residue then its square root is mod p.
Proof: Clearly we can see that mod p =
mod p =
mod p = a mod p. This is because Legendre symbol
mod p = +1, since a is a quadratic residue.
We can use the above theorem to compute the square root of any quadratic residue deterministically using modular exponentiation when p ≡ 3 mod 4.
Reference:
1. Introduction to Algorithms , Second Edition, T. H. Cormen, C. E. Leiserson, R. Rivest and C. Stein, Prentice Hall India .
2. Introduction to Analytic Number Theory , T. M. Apostol, Springer International .
3. Randomized Algorithms , R. Motwani & P. Raghavan, Cambridge University Press .