<s>[INST] Algebra in Geometric Proof of Quadratic Reciprocity I am trying to understand the proof of quadratic reciprocity form the George Andrews textbook on number theory (this proof follows geometry and Eisenstein's thinking). I understand what is happening conceptually, but the finer points of inequality algebra are not obvious to me. We are given sets $\mu_1=\{q,2q,\cdots,\frac{1}{2}(p-1)q\}$ and $\mu_2=\{p,2p,\cdots,\frac{1}{2}(q-1)p\}$, with $\mu_1$ representing the negative least residues mod $p$ and $\mu_2$ representing the negative least residues mod $q$. Ultimately the proof shows $\mu_1+\mu_2$ is odd if and only if $p\equiv q\equiv3\pmod{4}$.
The author illustrates this by considering a hexagon $H$ with vertices $ABCDEF$ that lies within a rectangle $AGDJ$ (drawn in Quadrant $I$) that is bounded by $x=p/2$ and $y=q/2$. The attached picture provides additional information about the components of the rectangle.
For a point $(x,y)$ to lie in $H$, it must satisfy, $0<x<p/2$, $0<y<q/2$, $y<\frac{q}{p}x+\frac{1}{2}$, and $y>\frac{q}{p}x-\frac{q}{2p}$. The next step remarks that if $(m,n)$ is some lattice point in $H$, then so is $(\frac{p+1}{2}-m,\frac{q+1}{2}-n)$, where these two points are $equal$. This is verified by substituting "these coordinates" into the four inequalities above.
I'm not sure what is meant by "these coordinates." I assumed it meant $(m,n)$, so this is what I tried.
$\frac{q}{p}x-\frac{q}{2p}<y<\frac{q}{p}x+\frac{1}{2}\Rightarrow \frac{q}{p}m-\frac{q}{2p}<n<\frac{q}{p}m+\frac{1}{2} \Rightarrow qm-\frac{q}{2}<py<qm+\frac{p}{2}$
$\Rightarrow 2qm-q<2py<2qx+p$.
Any assistance would be appreciated.

 [/INST] After lots of questions and lots of attempts, here is the definitive algebra justifying the claim from this proof:
Consider the algebraic justification for $(m,n)=\left(\frac{p+1}{2}-m,\frac{q+1}{2}-n\right)$. Let $(m,n)$ be some lattice point within $H$, and let $(u,v)=\left(\frac{p+1}{2}-m,\frac{q+1}{2}-n\right)$ be some coordinate pair within $H$. To show the equality between forms, we must show $0<u<\frac{p}{2}, 0<v<\frac{q}{2}, v<\frac{q}{p}u+\frac{1}{2},$ and $v>\frac{q}{p}u-\frac{q}{2p}$. Call these Cases $1-4$, respectively.

*

*$0<u<\frac{p}{2}$
Assume $0<m<\frac{p}{2}\Rightarrow -\frac{p}{2}<-m<0$. Clearly $\frac{p+1}{2}-\frac{p}{2}=\frac{1}{2}<\frac{p+1}{2}-m<\frac{p+1}{2}$. Now,$\frac{p+1}{2}-m=\frac{p}{2}\Rightarrow m=\frac{1}{2}$, but $m$ is an integer, so $0<\frac{p+1}{2}-m<\frac{p}{2}$, i.e., $0<u<\frac{p}{2}$.


*$0<s<\frac{q}{2}$
Assume $0<n<\frac{q}{2}\Rightarrow -\frac{q}{2}<-n<0$. Clearly $\frac{q+1}{2}-\frac{q}{2}=\frac{1}{2}<\frac{q+1}{2}-n<\frac{q+1}{2}$. Now,$\frac{q+1}{2}-n=\frac{q}{2}\Rightarrow n=\frac{1}{2}$, but $n$ is an integer, so $0<\frac{q+1}{2}-n<\frac{q}{2}$, i.e., $0<v<\frac{q}{2}$.
For the remaining cases, let $n<\frac{q}{p}m+\frac{1}{2}$ and let $n>\frac{q}{p}m-\frac{q}{2p}$.


*$v<\frac{q}{p}u+\frac{1}{2}$
Consider $\frac{q+1}{2}-n<\frac{q}{p}\left(\frac{p+1}{2}-m\right)+\frac{1}{2}$. It is clear $\frac{q}{p}\left(\frac{p+1}{2}-m\right)+\frac{1}{2}$ $=\frac{q(p+1)}{2p}-\frac{q}{p}m+\frac{1}{2}=\frac{q}{2}+\frac{q}{2p}-\frac{q}{p}m+\frac{1}{2}=\frac{q+1}{2}-\left(\frac{q}{p}m-\frac{q}{2p}\right)$
$>v=\frac{q+1}{2}-n\left(\text{this follows from } n>\frac{q}{p}m-\frac{q}{2p}\right)$.


*$v>\frac{q}{p}u-\frac{q}{2p}$
Consider $\frac{q+1}{2}-n>\frac{q}{p}\left(\frac{p+1}{2}-m\right)-\frac{q}{2p}$. It is clear $\frac{q}{p}\left(\frac{p+1}{2}-m\right)-\frac{q}{2p}$ $=\frac{q(p+1)}{2p}-\frac{q}{p}m-\frac{q}{2p}=\frac{q}{2}+\frac{q}{2p}-\frac{q}{p}m-\frac{q}{2p}=\frac{q}{2}-\frac{q}{p}m=\frac{q+1}{2}-\left(\frac{q}{p}m+\frac{1}{2}\right)<v=\frac{q+1}{2}-n$ $\left(\text{this follows from } n<\frac{q}{p}m+\frac{1}{2}\right)$.
</s>