Gauss' Lemma
There is a less obvious way to compute the Legendre symbol. This method allows us to easily evaluate , among other things. Before stating the method formally, we demonstrate it with an example.
Let , and . There are nonzero elements . Consider the first half and multiply them all by to get . As integers, let us count the number of them that are greater than (that is, or higher).
Note: even though there is no way to define inequalities modulo , we can view elements of as integers in and look at sizes there, though it is not yet clear why we want to do this.
and are the only ones in the set that are greater than , so there are exactly of them. Then Gauss' Lemma states that if we take this and raise to this power, then we have , that is:
Theorem: Let be an odd prime, be an integer coprime to . Consider the set and view each member is an integer in . Let be the number of members in this set that are greater than . Then
Proof: Let be the members of the set less than , and be the members greater than . Then . Consider the sequence
Each of these are distinct: clearly and whenever (since is invertible), and if , then let . Then , which is a contradiction since
Hence they must be precisely the numbers in some order, thus
Dividing both sides by completes the proof.
For example, let be an odd prime and take . Consider the sequence . Note these are positive least residues. Now for some integer and . By considering each case we see that the number of elements greater than is even when and odd when . We can restate this as follows.
Theorem: Let be an odd prime.
Proof: See the last paragraph, and note that is even when and odd otherwise. Similarly for .
Example: By Gauss' Lemma, if and otherwise (). Combining this with the above result for we have if and otherwise ().
Theorem: Let be an odd prime and be some integer coprime to . Let .
Then , where as in Gauss' Lemma, is the number of elements of which have a residue greater than . In particular when is odd, .
Proof: For each , the equation holds for some . Reading the proof of Gauss' Lemma, we see these are preceisely the and .
Then summing these equations gives
Since is odd, we have .