Quadratic Reciprocity
The law of quadratic reciprocity, noticed by Euler and Legendre and proved by Gauss, helps greatly in the computation of the Legendre symbol.
Theorem: Let be distinct odd primes. If , then otherwise which we can state as
Proof: TODO
Example: since . Next, Hence is a quadratic nonresidue modulo .
Note we had to factor a number during this computation, so for large numbers this method is not efficient without a fast factoring algorithm. Of course, to compute the Legendre symbol, we can simply perform a modular exponentiation, but it turns out by extending the Legendre symbol we can salvage the above method.
The Jacobi Symbol
The Jacobi symbol is defined for all odd positive integers and all integers . When is prime, it is equivalent to the Legendre symbol (which is why we reuse the notation). If , define . Lastly, for other values of , factor into primes: and define
Thus for odd positive integers we have Other properties of the Legendre symbol carry over. By inducting on the number of primes in the factorization of , one can show:
The last property allows us to compute the Jacobi symbol without factoring.
Example: Hence is a quadratic nonresidue modulo .