# Gauss's lemma (number theory)

Gauss's lemma in number theory gives a condition for an integer to be a quadratic residue. Although it is not useful computationally, it has theoretical significance, being involved in some proofs of quadratic reciprocity.

It made its first appearance in Carl Friedrich Gauss's third proof (1808)[1] of quadratic reciprocity and he proved it again in his fifth proof (1818).[2]

## Statement of the lemma

For any odd prime p let a be an integer that is coprime to p.

Consider the integers

$a, 2a, 3a, \dots, \frac{p-1}{2}a$

and their least positive residues modulo p. (These residues are all distinct, so there are (p−1)/2 of them.)

Let n be the number of these residues that are greater than p/2. Then

$\left(\frac{a}{p}\right) = (-1)^n$

where (a/p) is the Legendre symbol.

## Example

Taking p = 11 and a = 7, the relevant sequence of integers is

7, 14, 21, 28, 35.

After reduction modulo 11, this sequence becomes

7, 3, 10, 6, 2.

Three of these integers are larger than 11/2 (namely 6, 7 and 10), so n = 3. Correspondingly Gauss's lemma predicts that

$\left(\frac {7}{11}\right) = (-1)^3 = -1.$

This is indeed correct, because 7 is not a quadratic residue modulo 11.

The above sequence of residues

7, 3, 10, 6, 2

may also be written

-4, 3, -1, -5, 2.

In this form, the integers larger than 11/2 appear as negative numbers. It is also apparent that the absolute values of the residues are a permutation of the residues

1, 2, 3, 4, 5.

## Proof

A fairly simple proof[3] of the lemma, reminiscent of one of the simplest proofs of Fermat's little theorem, can be obtained by evaluating the product

$Z = a \cdot 2a \cdot 3a \cdot \cdots \cdot \frac{p-1}2 a$

modulo p in two different ways. On one hand it is equal to

$Z = a^{(p-1)/2} \left(1 \cdot 2 \cdot 3 \cdot \cdots \cdot \frac{p-1}2 \right)$

The second evaluation takes more work. If x is a nonzero residue modulo p, let us define the "absolute value" of x to be

$|x| = \begin{cases} x & \mbox{if } 1 \leq x \leq \frac{p-1}2, \\ p-x & \mbox{if } \frac{p+1}2 \leq x \leq p-1. \end{cases}$

Since n counts those multiples ka which are in the latter range, and since for those multiples, −ka is in the first range, we have

$Z = (-1)^n \left(|a| \cdot |2a| \cdot |3a| \cdot \cdots \cdots \left|\frac{p-1}2 a\right|\right).$

Now observe that the values |ra| are distinct for r = 1, 2, ..., (p−1)/2. Indeed, we have

|ra| ≡ |sa| (mod p),
ra ≡ ±sa (mod p),
r ≡ ±s (mod p) (because a is coprime to p), and

This gives r=s, since r,s are positive least residues. But there are exactly (p−1)/2 of them, so their values are a rearrangement of the integers 1, 2, ..., (p−1)/2. Therefore,

$Z = (-1)^n \left(1 \cdot 2 \cdot 3 \cdot \cdots \cdot \frac{p-1}2\right).$

Comparing with our first evaluation, we may cancel out the nonzero factor

$1 \cdot 2 \cdot 3 \cdot \cdots \cdot \frac{p-1}2$

and we are left with

$a^{(p-1)/2} = (-1)^n.\$

This is the desired result, because by Euler's criterion the left hand side is just an alternative expression for the Legendre symbol (a/p).

## Applications

Gauss's lemma is used in many,[4][5] but by no means all, of the known proofs of quadratic reciprocity.

For example, Eisenstein[6] used Gauss's lemma to prove that if p is an odd prime then

$\left(\frac{a}{p}\right)=\prod_{n=1}^{(p-1)/2}\frac{\sin{(2\pi an/p)}}{\sin{(2\pi n/p)}},$

and used this formula to prove quadratic reciprocity, (and, by using elliptic rather than circular functions, to prove the cubic and quartic reciprocity laws.[7])

Kronecker[8] used the lemma to show that

$\left(\frac{p}{q}\right)=\sgn\prod_{i=1}^{\frac{q-1}{2}}\prod_{k=1}^{\frac{p-1}{2}}\left(\frac{k}{p}-\frac{i}{q}\right).$

Switching p and q immediately gives quadratic reciprocity.

It is also used in what are probably the simplest proofs of the "second supplementary law"

$\left(\frac{2}{p}\right) = (-1)^{(p^2-1)/8} = \begin{cases} +1\text{ if }p\equiv \pm 1\pmod {8}\\-1\text{ if }p\equiv \pm 3\pmod {8}\end{cases}$

## Higher powers

Generalizations of Gauss's lemma can be used to compute higher power residue symbols. In his second monograph on biquadratic reciprocity,[9] Gauss used a fourth-power lemma to derive the formula for the biquadratic character of 1 + i in Z[i], the ring of Gaussian integers. Subsequently,[10] Eisenstein used third- and fourth-power versions to prove cubic and quartic reciprocity.

### nth power residue symbol

Main article: Power residue symbol

Let k be an algebraic number field with ring of integers   $\mathcal{O}_k,$   and let   $\mathfrak{p} \subset \mathcal{O}_k$   be a prime ideal. The ideal norm of  $\mathfrak{p}$  is defined as the cardinality of the residue class ring (since $\mathfrak{p}$ is prime this is a finite field)   $\mathcal{O}_k / \mathfrak{p}\;:\;\;\; \mathrm{N} \mathfrak{p} = |\mathcal{O}_k / \mathfrak{p}|.$

Assume that a primitive nth root of unity   $\zeta_n\in\mathcal{O}_k,$   and that n and $\mathfrak{p}$ are coprime (i.e. $n\not\in \mathfrak{p}.$)   Then

No two distinct nth roots of unity can be congruent $\pmod{\mathfrak{p}}.$

The proof is by contradiction: assume otherwise, that   $\zeta_n^r\equiv\zeta_n^s\pmod{\mathfrak{p}}, \;\;0   Then letting   $t=s-r,\;\;\zeta_n^t\equiv 1 \pmod{\mathfrak{p}},$   and  $0 < t< n.\$ From the definition of roots of unity,

$x^n-1=(x-1)(x-\zeta_n)(x-\zeta_n^2)\dots(x-\zeta_n^{n-1}),$   and dividing by x − 1 gives
$x^{n-1}+x^{n-2}+\dots +x + 1 =(x-\zeta_n)(x-\zeta_n^2)\dots(x-\zeta_n^{n-1}).$

Letting x = 1 and taking residues $\pmod{\mathfrak{p}},$

$n\equiv(1-\zeta_n)(1-\zeta_n^2)\dots(1-\zeta_n^{n-1})\pmod{\mathfrak{p}}.$

Since n and $\mathfrak{p}$  are coprime, $n\not\equiv 0\pmod{\mathfrak{p}},$   but under the assumption, one of the factors on the right must be zero. Therefore the assumption that two distinct roots are congruent is false.

Thus the residue classes of   $\mathcal{O}_k / \mathfrak{p}$   containing the powers of ζn are a subgroup of order n of its (multiplicative) group of units,   $(\mathcal{O}_k/\mathfrak{p}) ^\times = \mathcal{O}_k /\mathfrak{p}- \{0\}.$   Therefore the order of   $(\mathcal{O}_k/\mathfrak{p})^ \times$   is a multiple of n, and

$\mathrm{N} \mathfrak{p} = |\mathcal{O}_k / \mathfrak{p}| = |(\mathcal{O}_k / \mathfrak{p} )^\times| + 1 \equiv 1 \pmod{n}.$

There is an analogue of Fermat's theorem in   $\mathcal{O}_k:$  If   $\alpha \in \mathcal{O}_k,\;\;\; \alpha\not\in \mathfrak{p},$   then[11]

$\alpha^{\mathrm{N} \mathfrak{p} -1}\equiv 1 \pmod{\mathfrak{p} },$   and since   $\mathrm{N} \mathfrak{p} \equiv 1 \pmod{n},$
$\alpha^{\frac{\mathrm{N} \mathfrak{p} -1}{n}}\equiv \zeta_n^s\pmod{\mathfrak{p} }$   is well-defined and congruent to a unique nth root of unity ζns.

This root of unity is called the nth-power residue symbol for   $\mathcal{O}_k,$   and is denoted by

$\left(\frac{\alpha}{\mathfrak{p} }\right)_n= \zeta_n^s \equiv \alpha^{\frac{\mathrm{N} \mathfrak{p} -1}{n}}\pmod{\mathfrak{p}}.$

It can be proven that[12]

$\left(\frac{\alpha}{\mathfrak{p} }\right)_n= 1 \mbox{ if and only if there is an } \eta \in\mathcal{O}_k\;\;\mbox{ such that } \;\;\alpha\equiv\eta^n\pmod{\mathfrak{p}}.$

### 1/n systems

Let   $\mu_n = \{1,\zeta_n,\zeta_n^2,\dots,\zeta_n^{n-1}\}$   be the multiplicative group of the nth roots of unity, and let   $A=\{a_1, a_2,\dots,a_m\}$   be representatives of the cosets of   $(\mathcal{O}_k / \mathfrak{p})^\times/\mu_n.$   Then A is called a 1/n system $\pmod\mathfrak{p}.$[13]

In other words, there are  $mn=\mathrm{N} \mathfrak{p} -1$  numbers in the set   $A\mu=\{ a_i \zeta_n^j\;:\; 1 \le i \le m, \;\;\;0 \le j \le n-1\},$   and this set constitutes a representative set for   $(\mathcal{O}_k / \mathfrak{p})^\times.$

The numbers 1, 2, ..., (p − 1)/2, used in the original version of the lemma, are a 1/2 system (mod p).

Constructing a 1/n system is straightforward: let M be a representative set for   $(\mathcal{O}_k / \mathfrak{p})^\times.$   Pick any $a_1\in M$   and remove the numbers congruent to  $a_1, a_1\zeta_n, a_1\zeta_n^2, \dots, a_1\zeta_n^{n-1}$   from M. Pick a2 from M and remove the numbers congruent to   $a_2, a_2\zeta_n, a_2\zeta_n^2, \dots, a_2\zeta_n^{n-1}$   Repeat until M is exhausted. Then {a1, a2, ... am} is a 1/n system $\pmod\mathfrak{p}.$

### The lemma for nth powers

Gauss's lemma for the nth power residue symbol is[14]

Let   $\zeta_n\in \mathcal{O}_k$   be a primitive nth root of unity,   $\mathfrak{p} \subset \mathcal{O}_k$   a prime ideal,   $\gamma \in \mathcal{O}_k, \;\;n\gamma\not\in\mathfrak{p},$ (i.e. $\mathfrak{p}$ is coprime to both γ and n) and let A = {a1, a2,..., am} be a 1/n system $\pmod{\mathfrak{p}}.$

Then for each i, 1 ≤ im, there are integers π(i), unique (mod m), and b(i), unique (mod n), such that

$\gamma a_i \equiv \zeta_n^{b(i)}a_{\pi(i)} \pmod{\mathfrak{p}},$

and the nth-power residue symbol is given by the formula

$\left(\frac{\gamma}{\mathfrak{p} }\right)_n = \zeta_n^{b(1)+b(2)+\dots+b(m)}.$

The classical lemma for the quadratic Legendre symbol is the special case n = 2, ζ2 = −1, A = {1, 2, ..., (p − 1)/2}, b(k) = 1 if ak > p/2, b(k) = 0 if ak < p/2.

### Proof

The proof of the nth-power lemma uses the same ideas that were used in the proof of the quadratic lemma.

The existence of the integers π(i) and b(i), and their uniqueness (mod m) and (mod n), respectively, come from the fact that Aμ is a representative set.

Assume that π(i) = π(j) = p, i.e.

$\gamma a_i \equiv \zeta_n^r a_p \pmod{\mathfrak{p}}$   and   $\gamma a_j \equiv \zeta_n^s a_p \pmod{\mathfrak{p}}.$

Then

$\zeta_n^{s-r}\gamma a_i \equiv \zeta_n^s a_p \equiv \gamma a_j\pmod{\mathfrak{p}}$

Because γ and $\mathfrak{p}$ are coprime both sides can be divided by γ, giving

$\zeta_n^{s-r} a_i \equiv a_j\pmod{\mathfrak{p}},$

which, since A is a 1/n system, implies s = r and i = j, showing that π is a permutation of the set {1, 2, ..., m}.

Then on the one hand, by the definition of the power residue symbol,

\begin{align} (\gamma a_1)(\gamma a_2)\dots(\gamma a_m) &= \gamma^{\frac{\mathrm{N} \mathfrak{p} -1}{n}} a_1 a_2\dots a_m \\&\equiv \left(\frac{\gamma}{\mathfrak{p} }\right)_n a_1 a_2\dots a_m \pmod{\mathfrak{p}}, \end{align}

and on the other hand, since π is a permutation,

\begin{align} (\gamma a_1)(\gamma a_2)\dots(\gamma a_m) &\equiv {\zeta_n^{b(1)}a_{\pi(1)}} {\zeta_n^{b(2)}a_{\pi(2)}}\dots{\zeta_n^{b(m)}a_{\pi(m)}} \\ &\equiv \zeta_n^{b(1)+b(2)+\dots+b(m)}a_{\pi(1)} a_{\pi(2)}\dots a_{\pi(m)}\\ &\equiv \zeta_n^{b(1)+b(2)+\dots+b(m)} a_1 a_2\dots a_m \pmod{\mathfrak{p}}, \end{align}

so

$\left(\frac{\gamma}{\mathfrak{p} }\right)_n a_1 a_2\dots a_m \equiv \zeta_n^{b(1)+b(2)+\dots+b(m)} a_1 a_2\dots a_m \pmod{\mathfrak{p}},$

and since for all 1 ≤ im, ai and  $\mathfrak{p}$   are coprime, a1a2...am can be cancelled from both sides of the congruence,

$\left(\frac{\gamma}{\mathfrak{p} }\right)_n \equiv \zeta_n^{b(1)+b(2)+\dots+b(m)} \pmod{\mathfrak{p}},$

and the theorem follows from the fact that no two distinct nth roots of unity can be congruent (mod $\mathfrak{p}$).

## Relation to the transfer in group theory

Let G be the multiplicative group of nonzero residue classes in Z/pZ, and let H be the subgroup {+1, −1}. Consider the following coset representatives of H in G,

$1, 2, 3, \dots, \frac{p-1}{2}.$

Applying the machinery of the transfer to this collection of coset representatives, we obtain the transfer homomorphism

$\phi : G \to H,$

which turns out to be the map that sends a to (−1)n, where a and n are as in the statement of the lemma. Gauss's lemma may then be viewed as a computation that explicitly identifies this homomorphism as being the quadratic residue character.

Two other characterizations of squares modulo a prime are Euler's criterion and Zolotarev's lemma.

## Notes

1. ^ "Neuer Beweis eines arithmetischen Satzes"; pp 458-462 of Untersuchungen uber hohere Arithmetik
2. ^ "Neue Beweise und Erweiterungen des Fundalmentalsatzes in der Lehre von den quadratischen Reste"; pp 496-501 of Untersuchungen uber hohere Arithmetik
3. ^ Any textbook on elementary number theory will have a proof. The one here is basically Gauss's from "Neuer Beweis eines arithnetischen Satzes"; pp 458-462 of Untersuchungen uber hohere Arithmetik
4. ^ Lemmermeyer, ch. 1
5. ^ Lemmermeyer, p. 9, "like most of the simplest proofs [ of QR], [Gauss's] 3 and 5 rest on what we now call Gauss's Lemma
6. ^ Lemmermeyer, p. 236, Prop 8.1 (1845)
7. ^ Lemmermeyer, ch. 8
8. ^ Lemmermeyer, ex. 1.34 (The year isn't clear because K. published 8 proofs, several based on Gauss's lemma, between 1875 and 1889)
9. ^ Gauss, BQ, §§ 69–71
10. ^ Lemmermeyer, Ch. 8
11. ^ Lemmermeyer, Ch. 4.1
12. ^ Lemmermeyer, Prop 4.1
13. ^ Lemmermeyer, Ch. 4.2
14. ^ Lemmermeyer, Prop. 4.3

## References

The two monographs Gauss published on biquadratic reciprocity have consecutively numbered sections: the first contains §§ 1–23 and the second §§ 24–76. Footnotes referencing these are of the form "Gauss, BQ, § n".

• Gauss, Carl Friedrich (1828), Theoria residuorum biquadraticorum, Commentatio prima, Göttingen: Comment. Soc. regiae sci, Göttingen 6
• Gauss, Carl Friedrich (1832), Theoria residuorum biquadraticorum, Commentatio secunda, Göttingen: Comment. Soc. regiae sci, Göttingen 7

These are in Gauss's Werke, Vol II, pp. 65–92 and 93–148

German translations of the above are in the following, which also has the Disquisitiones Arithmeticae and Gauss's other papers on number theory, including the six proofs of quadratic reciprocity.

• Gauss, Carl Friedrich; Maser, H. (translator into German) (1965), Untersuchungen uber hohere Arithmetik (Disquisitiones Arithmeticae & other papers on number theory) (Second edition), New York: Chelsea, ISBN 0-8284-0191-8
• Lemmermeyer, Franz (2000), Reciprocity Laws: from Euler to Eisenstein, Berlin: Springer, ISBN 3-540-66957-4