# Floor function properties: $[2x] = [x] + [ x + \frac12 ]$ and $[nx] = \sum_{k = 0}^{n - 1} [ x + \frac{k}{n} ]$

I'm doing some exercises on Apostol's calculus, on the floor function. Now, he doesn't give an explicit definition of $[x]$, so I'm going with this one:

DEFINITION Given $x\in \Bbb R$, the integer part of $x$ is the unique $z\in \Bbb Z$ such that $$z\leq x < z+1$$ and we denote it by $[x]$.

Now he asks to prove some basic things about it, such as: if $n\in \Bbb Z$, then $[x+n]=[x]+n$

So I proved it like this: Let $z=[x+n]$ and $z'=[x]$. Then we have that

$$z\leq x+n<z+1$$

$$z'\leq x<z'+1$$

Then $$z'+n\leq x+n<z'+n+1$$

But since $z'$ is an integer, so is $z'+n$. Since $z$ is unique, it must be that $z'+n=z$.

However, this doesn't seem to get me anywhere to prove that $$\left[ {2x} \right] = \left[ x \right] + \left[ {x + \frac{1}{2}} \right]$$

in and in general that

$$\left[ {nx} \right] = \sum\limits_{k = 0}^{n - 1} {\left[ {x + \frac{k}{n}} \right]}$$

Obviously one could do an informal proof thinking about "the carries", but that's not the idea, let alone how tedious it would be. Maybe there is some easier or clearer characterization of $[x]$ in terms of $x$ to work this out.

Another property is $$[-x]=\begin{cases}-[x]\text{ ; if }x\in \Bbb Z \cr-[x]-1 \text{ ; otherwise}\end{cases}$$

I argue: if $x\in\Bbb Z$, it is clear $[x]=x$. Then $-[x]=-x$, and $-[x]\in \Bbb Z$ so $[-[x]]=-[x]=[-x]$. For the other, I guess one could say:

$$n \leqslant x < n + 1 \Rightarrow - n - 1 < x \leqslant -n$$

and since $x$ is not an integer, this should be the same as $$- n - 1 \leqslant -x < -n$$

$$- n - 1 \leqslant -x < (-n-1)+1$$

So $[-x]=-[x]-1$

-

Let $n=\lfloor x\rfloor$, and let $\alpha=x-n$; clearly either $0\le\alpha<\frac12$, or $\frac12\le\alpha<1$. Then

$$\lfloor 2x\rfloor=\lfloor 2n+2\alpha\rfloor=2n+\lfloor 2\alpha\rfloor=\begin{cases} 2n,&\text{if }0\le\alpha<\frac12\\ 2n+1,&\text{if }\frac12\le\alpha<1\;, \end{cases}$$

and

$$\left\lfloor x+\frac12\right\rfloor=\left\lfloor n+\alpha+\frac12\right\rfloor=n+\left\lfloor\alpha+\frac12\right\rfloor=\begin{cases} n,&\text{if }0\le\alpha<\frac12\\ n+1&\text{if }\frac12\le\alpha<1\;; \end{cases}$$

since $\lfloor x\rfloor=n$, the first result is immediate.

The general case is handled similarly, except that there are $n$ cases; for $k=0,\dots,n-1$, case $k$ is $$\frac kn\le\alpha<\frac{k+1}n\;.$$

-
M.Scott: By this question, Peter, challenged me and my knowledge about this function, however, I supposed I know this function properly. You opened my eyes to the additional facts I didn’t consider well. Thanks Brian. Thanks Peter for this question. (+1)+(+1) – Babak S. Aug 19 '12 at 20:17

Hint: Set $\{ x \} = x - [x]$. To prove $[nx] = \displaystyle\sum_{k = 0}^{n - 1} [x + \frac{k}{n}]$, consider the cases $\frac{k - 1}{n} \leq \{ x\} < \frac{k}{n}$ for $k = 1,2,\ldots,n$ separately.

The idea is that we want to see when exactly $[x + \frac{k}{n}] = [x] + 1$ starts to hold as $k$ grows.

-
WHy would you want to do that? Serkan's argument gives you the equality in one simple step! – Mariano Suárez-Alvarez Aug 19 '12 at 18:55
Although one need not phrase this in terms of «cases»: given $x$, there exists exactly one $k\in\{1,\dots,n\}$ such that $(k-1)/n\leq\{x\}<k/n$. Now work with this $k$. – Mariano Suárez-Alvarez Aug 19 '12 at 18:57

Here is a complete answer to the second question:

If $n$ is a positive integer then $\lfloor nx \rfloor = \sum_{k=0}^{n-1} \lfloor x+\frac{k}{n} \rfloor$.

Let $m = \lfloor x \rfloor$ and $d = x - m$, so $0 \le d < 1$.

Let $j =\lfloor nd \rfloor$, so $0 \le j \le n-1$ and $\frac{j}{n} \le d < \frac{j+1}{n}$. If $0 \le k \le n-j-1$,

$\begin{array}\\ m &\le m+d+\frac{k}{n}\\ &< m+\frac{n-j}{n}+\frac{j}{n}\\ &= m+\frac{n}{n}\\ &= m+1\\ \end{array}$

so $\lfloor m+d+\frac{k}{n} \rfloor =m$.

If $n-j \le k \le n-1$,

$\begin{array}\\ m+d+\frac{k}{n} &\ge m+\frac{n-j}{n}+\frac{j}{n}\\ &= m+\frac{n}{n}\\ &= m+1\\ \end{array}$

and

$\begin{array}\\ m+d+\frac{k}{n} &\lt m+\frac{n-j+1}{n}+\frac{n-1}{n}\\ &= m+\frac{2n-j}{n}\\ &= m+2-\frac{j}{n}\\ \end{array}$

so $\lfloor m+d+\frac{k}{n} \rfloor =m+1$.

Therefore

$\begin{array}\\ \sum_{k=0}^{n-1} \lfloor x+\frac{k}{n} \rfloor &=\sum_{k=0}^{n-1} \lfloor m+d+\frac{k}{n} \rfloor\\ &= \sum_{k=0}^{n-j-1} \lfloor m+d+\frac{k}{n} \rfloor +\sum_{k=n-j}^{n-1} \lfloor m+d+\frac{k}{n} \rfloor\\ &= (n-j)m+j(m+1)\\ &= nm+j\\ \end{array}$

and $\lfloor nx \rfloor =\lfloor n(m+d) \rfloor =nm+\lfloor nd \rfloor =nm+j$.

We are done.

-