]> Number Theory - Quadratic Reciprocity

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 p,q be distinct odd primes. If p=q=1 (mod4 ), then

(pq)=(qp)

otherwise

(pq)=(qp).

which we can state as

(pq)(qp)=(1 ) p1 2 q1 2

Proof: From the last theorem on the previous page, we need only show

m+n=(p1 )(q1 )/4

where m=q/p+2 q/p+...+((p1 )/2 )q/p, and n is similarly defined by swapping p and q.

Eisenstein found an elegant geometrical proof. Consider the line L from (0,0 ) to (p,q), and the rectangle R with corners at (0,0 ) and (p/2 ,q/2 ). How many lattice points lie strictly in R?

Simply computing the area of a rectangle gives (p1 )(q1 )/4 . Alternatively, we can count the number of points above and below L inside R, since no lattice points can lie on L in R since p,q are coprime.

Consider the points below L on the line x=1 . They have y-coordinates of 1 ,2 ,...,q/p. When x=2 , there are 2 q/p points, and so on, giving a total of m points below the L. Similarly there are n points above L in R, proving the result.

We can restate the proof algebraically. Consider the numbers pyqx for x=1 ,...,(p1 )/2 and y=1 ,...,(q1 )/2 . There are a total of (p1 )(q1 )/4 numbers, not necessarily distinct. None are zero, since p,q are coprime. The result follows after observing that n of them are positive, and m are negative.

Example:

(31 103 )=(103 31 )=(10 31 )=(2 31 )(5 31 )=(1 )(5 31 )

since 2 =5 (mod8 ). Next,

(5 31 )=(31 5 )=(1 5 )=1 .

Hence 31 is a quadratic nonresidue modulo 103 .

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 (ab) is defined for all odd positive integers b and all integers a. When b is prime, it is equivalent to the Legendre symbol (which is why we reuse the notation). If b=1 , define (a1 )=1 . Lastly, for other values of b, factor b into primes: b=p 1 k 1 ...p n k n and define

(ab)=(ap 1 ) k 1 ...(ap n) k n

Thus for odd positive integers b,b 1 ,b 2 we have

(ab 1 b 2 )=(ab 1 )(ab 2 )

Other properties of the Legendre symbol carry over. By inducting on the number of primes in the factorization of b, one can show:

(2 b)=(1 ) (b1 )/2 (1 b)=(1 ) (b 2 1 )/8 (ab)(ba)=(1 ) a1 2 b1 2

The last property allows us to compute the Jacobi symbol without factoring.

Example:

(31 103 )=(103 31 )=(21 31 )=(1 31 )(21 31 ) =(31 21 )=(11 21 )=(1 21 )(11 21 )=(21 11 )=(1 11 )=1 .

Hence 31 is a quadratic nonresidue modulo 103 .