$\sum_{i=1}^{[ a/2]} [\frac {ib}{a} ] + \sum_{i=1}^{[ b/2]} [\frac {ja}{b} ] = [a/2][b/2] + [(a,b)/2].$

88 Views Asked by At

Show that if $a$ and $b$ are positive integers then $$\sum_{i=1}^{[ a/2]} [\frac {ib}{a} ] + \sum_{i=1}^{[ b/2]} [\frac {ja}{b} ] = [a/2][b/2] + [(a,b)/2].$$

I was trying by taking cases with integers $a$ and $b$ as both even,...etc. But not able to combine the right set of terms.

Here $[.]$ is greatest integer function. Help Needed.

Thank You.

1

There are 1 best solutions below

0
On

Consider the set of integer pairs $(i,j)$ such that $$0<i\le\frac a2\ ,\quad 0<j\le \frac b2\ .$$ This can be visualised as a rectangle with diagonal from $(0,0)$ to $(\frac a2,\frac b2)$. We will count the number of points in this rectangle in two ways.

First, the width of the rectangle is $[\frac a2]$ and the height is $[\frac b2]$. So the answer is $[\frac a2][\frac b2]$.

Alternatively, count the points in the triangle below the diagonal. Since the diagonal has slope $\frac ba$, the number of points with $x=i$ is $[\frac{ib}a]$ and the total is $$\sum_{i=1}^{[a/2]} \Bigl[\frac{ib}a\Bigr]\ .$$ Doing the same for the triangle above the diagonal gives $$\sum_{j=1}^{[b/2]}\Bigl[\frac{ja}b\Bigr]\ .$$ However, we have counted some points twice, namely, those (if any) on the diagonal. Let $g=gcd(a,b)$. Then these points are $$\Bigl(k\frac ag,\,k\frac bg\Bigl)$$ with $1\le k\le\frac g2$. So there are $[\frac{(a,b)}2]$ points that we must subtract and hence $$[\frac a2][\frac b2]=\sum_{j=1}^{[b/2]}\Bigl[\frac{ja}b\Bigr]+\sum_{j=1}^{[b/2]}\Bigl[\frac{ja}b\Bigr]-\Bigl[\frac{(a,b)}2\Bigr]\ .$$