<s>[INST] How to prove this identity of ceiling function? My book writes down this identity of least integer function:
$$\lceil x\rceil +\left\lceil x + \frac{1}{n}\right \rceil + \left\lceil x + \frac{2}{n}\right \rceil + \cdots +\left\lceil x + \frac{n -1}{n}\right \rceil = \lceil nx\rceil + n-1 $$. 
It didn't deduce it, however. I googled a bit about ceiling function but couldn't find any deduction. It is more like Hermite's Identity of floor function. Can anyone show me how to deduce this?
 [/INST] Another way of doing it is $$f(x)=\lceil x\rceil+\left\lceil x+\frac1n\right\rceil+\dots +\left\lceil x+1-\frac1n\right\rceil  - \left\lceil nx\right\rceil$$
We have $$
\begin{align}
f\left(x+\frac{1}{n}\right)=&\left\lceil x+\frac1n\right\rceil+\left\lceil x+\frac2n\right\rceil+\dots +\left\lceil x+1\right\rceil  - \left\lceil nx+1\right\rceil \\
=&\left\lceil x+\frac{1}{n}\right\rceil+\left\lceil x+\frac2n\right\rceil+\dots +\left\lceil x\right\rceil  - \left\lceil nx\right\rceil \\
=&\lceil x\rceil+\left\lceil x+\frac1n\right\rceil+\dots +\left\lceil x+1-\frac{1}{n}\right\rceil  - \left\lceil nx\right\rceil\\
=&f(x)
\end{align}$$
So $f$ is $\frac1n$-periodic. And we only need to evaluate it over $\left(0,\frac1n\right]$, in which case
$$f(x) = n-1$$
This is because if $x\in(0,\frac{1}{n}]$, then $x,x+\frac{1}{n},\dots,x+\frac{n-1}{n}$ and $nx\in(0,1]$ and $$\left\lceil x\right\rceil = \left\lceil x+\frac{1}{n}\right\rceil=\dots=\left\lceil x+\frac{n-1}{n}\right\rceil=\left\lceil nx\right\rceil=1$$
</s>