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$
Solution 1:
This is one of my favourite exercises, because of the following neat solution:
Fix $n$. Let
$$ f(x) := \sum\limits_{k=0}^{n-1} \Biggl[x + \frac{k}{n}\Biggr] - [nx] \,.$$
Then $f(x) =0 \forall x \in [0,\frac{1}{n})$ since all terms are zero, and it is easy to prove that $f(x+\frac{1}{n})=f(x)$.
It follows imediately that $f$ is identically 0.
Solution 2:
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\;.$$
Solution 3:
Both sides are equal since they count the same set: the RHS counts naturals $\rm\:\le n\:x\:$. The LHS counts them in a unique mod $\rm\ n\ $ representation, $\:$ viz. $\rm\ \: j \:\le\: x+k/n\: \iff \ j\:n-k \:\le\: n\:x\:,\ \ j>0 \le k < n\:$.
REMARK $\:$ That every natural has a unique representation of form $\rm \: j\:n-k \ \ \:$ where $\rm\ \ \: j>0 \le k < n\ \ \ $ is simply a slight variant of the Division Algorithm where one utilizes negative (vs. positive) remainders.$\ \ $ To derive this negative form, simply perform the following transformation on the positive remainder form $\rm\ q\: n + r\ \to\ (q+1)\:n + r-n\ $ if $\rm\ r\ne 0\:$, i.e. inc the quotient, dec the remainder by the dividend.
Thus the result is equivalent to the Division Algorithm, whose normal proof is indeed by induction. One could give a direct inductive proof of the result if, instead of invoking the Division Algorithm by name, one unwinds or inlines this inductive proof directly into the proof of the result - much as the same way that the classic Lindenmann - Zermelo direct proof of unique factorization of naturals inlines a division / Euclidean algorithm based descent proof of the fundamental Prime Divisor property $\rm\ p|ab\ \Rightarrow\ p|a\ \ or\ \ p|b\:$.
Solution 4:
It is enough to prove it for $0 < x < 1$.
Now, let $M$ be an integer such that, $\frac{M}{n} \le x < \frac{M+1}{n}$ where $0 \le M < n$
Thus $[nx] = M$.
For $0 \le k \le n-M-1$, we have that $[x+\frac{k}{n}] = 0$.
For $n-1 \ge k > n-M-1$ we have that $[x + \frac{k}{n}] = 1$.
The result follows.
I don't think induction can be used here.