Theorem 2: [Euler] Let and it is a quadratic residue if and only if
Proof: To prove the if part we assume that is a quadratic residue. Thus it must an even power of g where g is a generator of
. Let a be equal to g2k. Thus
For the only if part we assume that is a non-quadratic residue. Thus it must be an odd power of g where g is a generator of
Let a be equal to g2k+1. Thus
Since gp-1≡ 1 mod p and from Theorem 1 . Since g is the generator its order cannot be less than (p-1). Thus
and
.
![]()
Now the most natural question is what happens when n is composite. In other words how many roots are there of the equation x2 ≡ a mod n when n is a composite number. We have to consider two cases:
- n is even and of the form
- n is odd and of the form
In both cases pi’s are all primes. From Theorem 1 we know that there are exactly 2 roots for each of the modular linear equation x2 ≡ 1 mod ∀i (pi ≠ 2). Again we can easily prove the following for modular linear equations.
- x2 ≡1 mod 2 has only 1 root.
- x2 ≡ 1 mod 4 has exactly 2 roots.
- x2 ≡ 1 mod 2e has exactly 4 roots for ∀e ≥ 2.