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: From the last theorem on the previous page, we need only show
where , and is similarly defined by swapping and .
Eisenstein found an elegant geometrical proof. Consider the line from to , and the rectangle with corners at and . How many lattice points lie strictly in ?
Simply computing the area of a rectangle gives . Alternatively, we can count the number of points above and below inside , since no lattice points can lie on in since are coprime.
Consider the points below on the line . They have -coordinates of . When , there are points, and so on, giving a total of points below the . Similarly there are points above in , proving the result.
We can restate the proof algebraically. Consider the numbers for and . There are a total of numbers, not necessarily distinct. None are zero, since are coprime. The result follows after observing that of them are positive, and are negative.
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 .