prove that if $x$ is a real number, then $\lfloor2x\rfloor=\lfloor x\rfloor + \lfloor x + \frac{1}{2}\rfloor$
I've seen the proof in my discrete math book, but it was very confusing. I don't understand why they considered those cases and why they chose $\frac{1}{2}$ specifically. It would be great if someone can explain better or provide a much clearer proof.
Proof from the book:
Let x = n + $\epsilon$ where n is an integer and 0 $\le\epsilon \lt 1$
case 1: Consider 0 $\le\epsilon \lt \frac{1}{2}$
2x = 2n + 2$\epsilon$ and $\lfloor$2x$\rfloor$ = 2n because 0 $\le 2\epsilon \lt 1$
Similarly, x + $\frac{1}{2}$= n + ( $\frac{1}{2}$+ $\epsilon$), so $\lfloor$x + $\frac{1}{2}$$\rfloor$ = n,
because 0 < $\frac{1}{2}$ + $\epsilon$ < 1.
Consequently,$\lfloor$2x$\rfloor$ = 2n and $\lfloor$x$\rfloor$ + $\lfloor$x + $\frac{1}{2}$$\rfloor$ = n + n = 2n.
case 2: $\frac{1}{2}$ ≤ $\epsilon$< 1.
2x = 2n + 2$\epsilon$ =(2n + 1) + (2$\epsilon$ − 1).
Because 0 ≤ 2$\epsilon$ − 1 < 1, it follows that $\lfloor$2x$\rfloor$ = 2n + 1.
Because$\lfloor$x + $\frac{1}{2}$$\rfloor$ = $\lfloor$n + ( $\frac{1}{2}$+ $\epsilon$)$\rfloor$ = $\lfloor$n + 1 + ($\epsilon$ − $\frac{1}{2}$ )$\rfloor$ and 0 ≤ $\epsilon$ − $\frac{1}{2}$ < 1,
it follows that $\lfloor$x + $\frac{1}{2}$$\rfloor$ =n + 1.
Consequently, $\lfloor$2x$\rfloor$ = 2n + 1 and $\lfloor$x$\rfloor$ + $\lfloor$x + $\frac{1}{2}$$\rfloor$= n + (n + 1) = 2n + 1.
This concludes the proof.
Let $x=n+\varepsilon$ where $n$ is an integer and $0\le\varepsilon\lt1.$ Then $$\lfloor2x\rfloor=\lfloor2n+2\varepsilon\rfloor=2n+\lfloor2\varepsilon\rfloor,$$ and $$\lfloor x\rfloor+\lfloor x+\frac12\rfloor=\lfloor n+\varepsilon\rfloor+\lfloor n+\varepsilon+\frac12\rfloor=n+\lfloor\varepsilon\rfloor+n+\lfloor\varepsilon+\frac12\rfloor=2n+\lfloor\varepsilon+\frac12\rfloor,$$ so the identity $$\lfloor2x\rfloor=\lfloor x\rfloor+\lfloor x+\frac12\rfloor$$ is equivalent to the identity (for $0\le\varepsilon\lt1$) $$\lfloor2\varepsilon\rfloor=\lfloor\varepsilon+\frac12\rfloor.$$ Since $0\le2\varepsilon\lt2,$ the value of $\lfloor2\varepsilon\rfloor$ is either $0$ or $1,$ namely, $$\lfloor2\varepsilon\rfloor=\begin{cases} 1\text{ if }2\varepsilon\ge1,\\ 0\text{ otherwise.} \end{cases}$$ Likewise, since $\frac12\le\varepsilon+\frac12\lt\frac32,$ the value of $\lfloor\varepsilon+\frac12\rfloor$ is either $0$ or $1,$ namely, $$\lfloor\varepsilon+\frac12\rfloor=\begin{cases} 1\text{ if }\varepsilon+\frac12\ge1,\\ 0\text{ otherwise.} \end{cases}$$ Finally, to see that $\lfloor2\varepsilon\rfloor=\lfloor\varepsilon+\frac12\rfloor,$ note that the inequality $2\varepsilon\ge1$ and the inequality $\varepsilon+\frac12\ge1$ both have the same solution set, namely, $\varepsilon\ge\frac12.$