With this knowledge if we lift the result from primes to composites using CRT (Chinese Remainder Theorem) we can observe that the equation x2 ≡ a mod n has 2k roots when n is odd and when n is even it has 2k-1, 2k and 2k+1 roots respectively for e1=1, e1=2 and e1≥ 2.
Now we introduce to the notion of Legendre Symbol of an element . It is denoted by
and is defined as follows:
=
=
depending on whether a is a quadratic residue or non-quadratic residue from Euler’s Criterion.
Theorem 3: For every odd prime p we have = (-1)
=
depending on p ≡1 mod 4 and p ≡ 3 mod 4 respectively.
Theorem 4: For every odd prime p we have =
= +1 (if p ≡ ±1 mod 8) and = -1 (if p ≡ ±3 mod 8).
Proof: Consider the following congruences :
p-1 ≡ 1(-1)1 mod p, 2 ≡ 2(-1)2 mod p, p -3 ≡ 3(-1)3 mod p, 4 ≡ (-1)4 mod p, …, r ≡ mod p. Here r is either p – (p-1)/2 or (p-1)/2. If we multiply these congruences and observing the fact that the number on the left of each congruence is even, we obtain:
2.4.6 … (p-1) ≡ ! (-1)
mod p.
Thus we have ! ≡
!(-1)
mod p. Since
!≡ 0 mod p we have established the first equality since
=
.
![]()