Monday, 10 August 2026

Exercise (7.4).10

Prove Lemma (7.20).


Let's remind ourselves of Lemma (7.20).

Let $p$ be an odd prime and $a$ also be odd such that $p \not \mid a$. Let $g$ be the number of negative residues as defined in Gauss’s Lemma (7.14). We have

$$\sum_{k=1}^{(p-1)/2} \lfloor \frac{a \times k}{p} \rfloor  \equiv g \pmod 2 $$


We start with the division algorithm and write $ak$ as

$$ ak = p \times \lfloor \frac{ak}{p} \rfloor + r $$

where $r$ is the least positive residue of $ak$ modulo $p$.


Next we'll consider the set $R$ of values of $r$ for $1 \le k \le \frac{p-1}{2}$.

$$ R = \{s_1, s_2, \ldots,  r_h, \quad t_1, t_2, \ldots,  t_g\}$$

where the residues $1 \le s_i \le \frac{p-1}{2}$ and $\frac{p+1}{2} \le t_i \le (p-1)$. Here $g$, by definition, is the number of least positive residues larger than $\frac{p-1}{2}$, and $g+h=\frac{p-1}{2}$.

We'll show the residues are distinct, a fact we'll use later. Consider two residues $r_1, r_2 \in R$. 

$$ r_1 \equiv r_2 \pmod p \implies ak_1 \equiv ak_2 \pmod p \implies k_1\equiv k_2 \pmod p $$

Since $1 \le k_1,k_2 \le \frac{p-1}{2}$, this means $k_1=k_2$. That is, no two residues are congruent modulo $p$, and since the set $R$ is of least positive residues, they are all less than $p$, and so incongruence also means inequality.


We now construct another set $S$ from $R$ by replacing those elements $t_i$ with $p-t_i$. Note that since  $\frac{p+1}{2} \le t_i \le (p-1)$, this means  $1 \le p - t_i \le \frac{p-1}{2}$.

$$ S = \{s_1, s_2, \ldots,  r_h, \quad p-t_1, p-t_2, \ldots,  p-t_g\}$$

We'll show that $S=\{1,2,3, \ldots, \frac{p-1}{2}\}$. To do this we first note that there are $\frac{p-1}{2}$ elements of $S$ all less than or equal to $\frac{p-1}{2}$. We also need to show no two elements are the same. We know all the $s_i$ are distinct, and all the $t_i$ are distinct. Let's consider whether $s_i$ and $p-t_i$ are distinct. 

$$ s_i \equiv p-t_i \pmod p \implies s_i + t_i \equiv 0 \pmod p \implies a (k_1 + k_2) \equiv 0 \pmod p \implies k_1 +k_2 \equiv 0 \pmod p $$

This is a contradiction since $2 \le k_1+k_2 \le p-1$, and so no two elements of $S$ are congruent.

Since $S$ has $\frac{p-1}{2}$ incongruent elements, all of value less than or equal to $\frac{p-1}{2}$, then it must be that 

$$ S = \{1, 2, 3, \ldots , \frac{p-1}{2} \}$$


Let's consider the sum of the elements of $S$,

$$ \sum_{k=1}^{(p-1)/2}k  = \sum_{i=1}^{h} s_i + \sum_{i=1}^{g} p-t_i \tag{i}$$

Let's also consider the sum of $ak$ over $1 \le k \le \frac{p-1}{2}$, 

$$  \sum_{k=1}^{(p-1)/2} ak = \sum_{k=1}^{(p-1)/2}p \lfloor \frac{ak}{p} \rfloor +\sum_{i=1}^{h} s_i + \sum_{i=1}^{g} t_i   \tag{ii} $$

Subtracting (ii)  from (i), 

$$  (a-1)\sum_{k=1}^{(p-1)/2} k = p \sum_{k=1}^{(p-1)/2} \lfloor \frac{ak}{p} \rfloor -pg + 2\sum_{i=1}^{g} t_i   $$

Taking modulo 2 means removing terms that are even, noting that $(a-1)$ is even,

$$  pg \equiv p \sum_{k=1}^{(p-1)/2} \lfloor \frac{ak}{p} \rfloor  $$

Dividing by $p$ is permissible since $p \not \mid 2$

$$  \sum_{k=1}^{(p-1)/2} \lfloor \frac{ak}{p} \rfloor \equiv g  \pmod 2 $$

This is the desired result.


Note: this solution was helped by Esenstein's Lemma (proofwiki).