Maximum and minimum value of ⌊2x⌋ − 2 ⌊x⌋ for any real number x? Working through some sample problems on flooring from a guide book and I'm stuck on the following questions:
What is the maximum and minimum value of $\lfloor 2x\rfloor − 2 \lfloor x\rfloor$ for any real number $x$ and positive integer $n$? How about if $x$ is any positive real number?
What is the maximum and minimum value of $\lfloor nx\rfloor − n \lfloor x\rfloor$ for any real number $x$ and positive integer $n$? How about if $x$ is any positive real number?
I'm not sure how to go about finding the minimum and maximum values. Could anybody help me out?
 A: I would write $x=m+k$ with $m\in\mathbb Z$ and $k\in[0,1)$. Then we have
$$ \lfloor 2x\rfloor - 2\lfloor x\rfloor = \lfloor 2m+2k\rfloor - 2\lfloor m+k\rfloor
= 2m+\lfloor 2k\rfloor - 2m = \lfloor 2k\rfloor $$
because $2m$ and $m$ are integers and $\lfloor k\rfloor=0$.
Then you just need to find the range of $\lfloor 2k\rfloor$ for $0\le k<1$.
It goes the same way with any other natural instead of $2$.
A: Note that for any integer $k$, $\lfloor k+x\rfloor=k+\lfloor x\rfloor$. Then for any integer $n$,
$$
\begin{align}
\lfloor n(k+x)\rfloor-n\lfloor k+x\rfloor
&=nk+\lfloor nx\rfloor-nk-n\lfloor x\rfloor\\
&=\lfloor nx\rfloor-n\lfloor x\rfloor\tag1
\end{align}
$$
Since we can write any real as $k+x$ where $k\in\mathbb{Z}$ and $0\le x\lt1$, $(1)$ says that the whole range can be gotten for $0\le x\lt1$, and for those $x$, $n\lfloor x\rfloor=0$, which means we only need to look at $\lfloor nx\rfloor$ where $0\le x\lt1$.
A: You can think of $\lfloor x \rfloor$ as a piece-wise defined function, where on any interval $[k,k+1)$ between two integers, it takes the value $k$.
Similarly $\lfloor 2x \rfloor$ is a piece-wise defined function, but it is only constant on intervals between half integers (i.e., integers or integers plus one half). I.e., on the interval $[k,k+1/2)$ it takes the value $2k$, and on the interval $[k+1/2,k+1)$ it takes the value $2k+1$.
So it is helpful to consider cases based on which half-integer interval $x$ lies in. If $x = k+\epsilon$ for some integer $k$ and some $0 \leq \epsilon < \frac{1}{2}$, then $\lfloor x \rfloor = k$, and $\lfloor 2x \rfloor = \lfloor 2k+2\epsilon \rfloor = 2k$. If instead $x=k+\frac{1}{2}+\epsilon$ for some integer $k$ and some $0 \leq \epsilon < \frac{1}{2}$, then $\lfloor x \rfloor = k$ and $\lfloor 2x \rfloor = \lfloor 2k+1+2\epsilon \rfloor = 2k+1$. Compute the difference $\lfloor 2x \rfloor - 2 \lfloor x \rfloor$ in both of these cases.
Similarly, for the second problem you will want to write $x= k + \frac{\ell}{n}+\epsilon$ for some integer $k$, some integer $0 \leq \ell < n$, and some $0 \leq \epsilon < \frac{1}{n}$ (do you see why this is always possible?). Then calculate the value of the function $\lfloor nx \rfloor - n \lfloor x\rfloor$ and see what the maximum and minimum possible values are.
I'll let you think about what to do for the last problem (but again, you'll want to determine the intervals where $x$ can "live" and in each case calculate the floor functions in question).
