Let $a$ and $b$ be integers greater than one which have no common divisors. Prove that $$\sum_{i=1}^{b-1}\left\lfloor\frac{ai}{b}\right\rfloor=\sum_{j=1}^{a-1}\left\lfloor\frac{bj}{a}\right\rfloor.$$
I believe the reason for the equivalent relations is because they are symmetric but I cannot think of where to start with proof. Any guidance is greatly appreciated.
It equals $(a-1)(b-1)/2$.Consider a rectangle with its vertices to be $(0,0),(a,0),(0,b),(a,b)$,and a segment from $(0,0)$ to $(a,b)$.Note that no lattice points is on the segment (Otherwise $x/y=a/b$,contradicts with $\gcd(a,b)=1$).And consider the number of lattice points inside(not on the edge) the rectangle and under the segment,which equals half of the lattice points inside the rectangle,that is $(a-1)(b-1)/2$,and is also $\sum_{i=1}^{a-1}\left\lfloor\frac{bi}{a}\right\rfloor$.Also the same trick we can get $\sum_{i=1}^{b-1}\left\lfloor\frac{ai}{b}\right\rfloor=(a-1)(b-1)/2$