[Math] Prove that$[{a\over b}]$+$[{2a\over b}]$+$[{3a\over b}]$+…+$[{(b-1)a\over b}]$ = $(a-1)(b-1)\over2$

ceiling-and-floor-functionsfunctions

If a and b are positive integers with no common factor how to show that $[{a\over b}]$+$[{2a\over b}]$+$[{3a\over b}]$+…+$[{(b-1)a\over b}]$ = $(a-1)(b-1)\over2$,where [.] denotes the greatest integer function?
I'm not able to understand how to simplify the LHS to RHS. Help please!!

Best Answer

If $x,y\not\in\mathbb{Z}$ and $x+y\in\mathbb{Z}$, then $\left\lfloor x\right\rfloor+\left\lfloor y\right\rfloor=x+y-1$. Therefore, $$ \left\lfloor j\frac ab\right\rfloor+\left\lfloor(b-j)\frac ab\right\rfloor=a-1\tag{1} $$ If $(a,b)=1$, then for $0\lt j\lt b$, we have $j\frac ab\not\in\mathbb{Z}$.

Summing $(1)$, we get $$ \sum_{j=1}^{b-1}\left\lfloor j\frac ab\right\rfloor+\left\lfloor(b-j)\frac ab\right\rfloor=(a-1)(b-1)\tag{2} $$ $(2)$ counts each term in the sum we want twice, so we get $$ \sum_{j=1}^{b-1}\left\lfloor j\frac ab\right\rfloor=\frac{(a-1)(b-1)}2\tag{3} $$