Summation of $\arccos\left(\frac{n^2+r^2+r}{\sqrt{(n^2+r^2+r)^2+n^2}}\right)$

summationtrigonometric series

I found this question in a book, and cannot solve it.

I have to find the the sum $$S_n=\sum_{r=0}^{n-1} \arccos\left(\frac{n^2+r^2+r}{\sqrt{(n^2+r^2+r)^2+n^2}}\right)$$

I tried converting this to $\arctan(\frac{n}{n^2+r^2+r})$ which seemed the most possible way of solving this but can't convert this into a difference of two terms which would help in telescoping the sum.

So my question is:

Am I on the right track or do I need to change my approach completely?
Any help would be highly appreciated.

Best Answer

Hint: compute $$\tan\left(\arctan{\frac{r+1}{n}}-\arctan{\frac{r}{n}}\right).$$