Show ${\sum_{i=1}^{\frac{p-1}{2}} \lfloor \frac{2iq}{p} \rfloor + {\sum_{i=1}^{\frac{q-1}{2}}} {\lfloor \frac{2ip}{q} \rfloor}}=(p-1)/2\cdot(q-1)/2$ Let $E = {\sum_{i=1}^{\frac{p-1}{2}}} {\lfloor \frac{2iq}{p} \rfloor + {\sum_{i=1}^{\frac{q-1}{2}}} {\lfloor \frac{2ip}{q} \rfloor}}$ and $E'= \frac{p-1}{2} \frac{q-1}{2}$
Im trying to show that they are congruent mod $2$ but im not sure how. I know in the proof of quadratic reciprocity using Einstein's lemma you prove something similar (Thrm 7)
I feel like that proof can be extended to this case too but im unsure how to get the 2 inside the floor. One thought i had was to assign a weight to each lattice of say 2 then you get the expression $E$ and when summing up the weights you get that its congruent to 0 mod 2. But there is no guarantee that $E' \equiv 0$ mod 2.
 A: To elaborate on the link (in the comment) explaining Eisenstein's proof, here is a pictorial description of why $$\sum_{i=1}^{\frac {p-1}2}\left\lfloor \frac{2iq}p\right\rfloor\equiv \sum_{i=1}^{\frac {p-1}2}\left\lfloor \frac{iq}p\right\rfloor~({\rm mod~}2),\qquad (1) $$ where $p,q$ are odd primes with $p\neq q$. Referring to the picture below, the left-hand side of (1) equals the number of blue interior lattice points (with even $x$-coordinates) under the line $y=\frac q px$, and the right-hand side equals the number of interior lattice points of the triangle $A$ with vertices $(0,0),\left(\frac p 2,0\right),$ and $X=\left(\frac p 2,\frac q 2\right)$ (in the picture, this consists of $6$ blue points and $3$ red points). By abuse of notations, let $\# A$ be the number of blue points in $A$, and $\# B$ be the number of blue points in $B$. Each column of blue dots in $B$ can be completed by adding red points to a form a column of $q-1$ (an even number) points. Denote the number of the red points in $C$ by $\#C$.  Since $\# B+\#C$ is even, one has $$\# A+\# B\equiv \# A+\# C~({\rm mod~}2).$$ Reflecting the red points of $C$ with respect to $X$, one gets the lattice points in $A$ with odd $x$-coordinates, i.e. a total of $\# C$ such points. Together with $\# A$ lattice points with even $x$-coordinates, this gives $\#A+\#C$ lattice points in $A$. The result of (1) follows.

Now by symmetry, one sees that $$\sum_{i=1}^{\frac {q-1}2}\left\lfloor \frac{2ip}q\right\rfloor\equiv \sum_{i=1}^{\frac {q-1}2}\left\lfloor \frac{ip}q\right\rfloor~({\rm mod~}2),\qquad (2)$$ which gives the number of lattice points in the interior of triangle lying above $A$. These two triangles form a rectangle of dimension $\frac p 2\times \frac q 2$ with a total of $\frac{p-1}2\times\frac{q-1}2$ lattice points in the interior (clearly, there are no lattice points in the diagonal). It follows that $$\sum_{i=1}^{\frac {p-1}2}\left\lfloor \frac{2iq}p\right\rfloor+\sum_{i=1}^{\frac {q-1}2}\left\lfloor \frac{2ip}q\right\rfloor\equiv \frac{p-1}2\times\frac{q-1}2~({\rm mod~}2).~{\rm QED}$$
It may be of independent interest to record the following mild generalization.
Proposition. Let $m,n>1$ be positive odd integers such that $\gcd(m,n)=1$. Then $$\sum_{i=1}^{\frac {m-1}2}\left\lfloor \frac{2in}m\right\rfloor+\sum_{i=1}^{\frac {n-1}2}\left\lfloor \frac{2im}n\right\rfloor\equiv \frac{m-1}2\times\frac{n-1}2~({\rm mod~}2).$$
Lemma. Let $m,n$ be as in the Proposition. For positive integer $i$ with $0<i<\frac m 2,$ one has $$n-1=\left\lfloor \frac {2in}{m}\right\rfloor+\left\lfloor \frac{(m-2i)n}m\right\rfloor\equiv 0~({\rm mod~}2).$$
Proof. Observe that $2in/m$ cannot be an integer, for $2in=km\Rightarrow m~|~2i,$ so $2i\geq m,$ a contradiction to the assumption on $i$ (here one uses $\gcd(m.n)=1$). If one writes $$2in=km+r,0<r<m,$$ then $$(m-2i)n=((n-1)-k)m+(m-r),$$ where $0<m-r<m.$ This shows that $$\left\lfloor \frac {2in}{m}\right\rfloor+\left\lfloor \frac{(m-2i)n}m\right\rfloor=k+((n-1)-k)=n-1,$$ as required.
Proof of the Proposition. Using the lattice points argument and by symmetry, it suffices to show that $$\sum_{i=1}^{\frac {m-1}2}\left\lfloor \frac{2in}m\right\rfloor\equiv \sum_{i=1}^{\frac {m-1}2}\left\lfloor \frac{in}m\right\rfloor~({\rm mod~}2).$$ One has $$\sum_{i=1}^{\frac {m-1}2}\left\lfloor \frac{2in}m\right\rfloor=\sum_{i,0<2i<m/2}\left\lfloor \frac{2in}m\right\rfloor+\sum_{i,m/2<2i<m}\left\lfloor \frac{2in}m\right\rfloor$$
$$\equiv \sum_{i,0<2i<m/2}\left\lfloor \frac{2in}m\right\rfloor+\sum_{i,0<m-2i<m/2}\left\lfloor \frac{(m-2i)n}m\right\rfloor~({\rm by~the~lemma})$$
$$=\sum_{0<u<m/2,u~{\rm even}} \left\lfloor \frac{un}{m}\right\rfloor+\sum_{0<u<m/2,u~{\rm odd}}\left\lfloor\frac{un}m\right\rfloor=\sum_{u=1}^{\frac {m-1}2}\left\lfloor\frac{un}m\right\rfloor~({\rm mod~}2),$$ as required. QED
