> 
> Prove that if a and b are relatively prime, then  
> 
>  $$\sum\_{n=1}^{a-1} \left\lfloor \frac{nb}{a}\right\rfloor = \frac{(a - 1)(b - 1)}{2}$$
> 
> 
> 

My attempt was:  

We have:
$$\sum\_{i=1}^{n-1} i = \frac{n(n - 1)}{2}$$

Then, 
$$\sum\_{n=1}^{a-1} \left\lfloor \frac{nb}{a}\right\rfloor = \left\lfloor \frac{a(a - 1)b}{2a}\right\rfloor$$

Could I apply the summation formula for floor function like above? Am I in the right track? 

Thanks,  

Chan