In class, we briefly covered what "floor" and "ceiling" mean. Very simple concepts. They were on one slide, and then we never heard about them again. But now the following homework problem has popped up:

$$\lfloor\lfloor x/2 \rfloor / 2 \rfloor = \lfloor x/4 \rfloor$$

Usually when I post a problem (especially from homework), I like to demonstrate that I'm not just asking for the answer by showing what I've done, what I know so far, and so on... but in this case, I have absolutely no idea where to even begin.

I will say that my first approach was to create a chart and try various values for "x" in order to see if there's a pattern and to make sure there was no easy counter-example to prove it false. That was all fine and well, but ultimately I couldn't figure out what to do with the results.

Googling for this is quite difficult, as everyone uses slightly different notation and therefore one search doesn't encompass all the actual results. The only clue that I've seen so far that kind of sort of makes sense, was when some guy said that "x" should be replaced with "4n + k", since the right-hand side of the equation is divided by 4, so that k is any remainder 0 through 3.

How should one approach this problem? What kind of manipulations can you do to floors? What can you assume? etc. etc. ...

  • 2
    $\begingroup$ Yes, writing $x = 4n + r$ with $0 \leqslant r < 4$ is the right way. It works more or less the same, whether $x$ is supposed to be an integer or not. $\endgroup$ – Daniel Fischer Jun 30 '13 at 23:14
  • $\begingroup$ After $4n+t$, we know the floor when we divide by $4$. Now for the divisions by $2$, break up into $2$ cases $t\le 2$, $t\gt 2$, and calculate. No need of theorems. $\endgroup$ – André Nicolas Jun 30 '13 at 23:23
  • $\begingroup$ Technically, there is one thing you need to know about the floor function, but that's rather obvious: $\forall a\in\mathbb Z, b\in\mathbb R: \lfloor a+b\rfloor=a+\lfloor b\rfloor$ $\endgroup$ – Tomas Jun 30 '13 at 23:25
  • $\begingroup$ By the way, a more general case has been asked here. $\endgroup$ – Tomas Jun 30 '13 at 23:27

This is straightforward using the universal property of the floor function, viz. $$\rm k\le \lfloor r \rfloor \color{#c00}\iff k\le r,\ \ \ for\ \ \ k\in \mathbb Z,\ r\in \mathbb R$$ Therefore for $\rm\:0 < n\in \mathbb Z,\ r\in \mathbb R,\ $ $$\rm\begin{eqnarray} &\rm k &\le&\!\rm\ \color{#0a0}{\lfloor \lfloor r \rfloor / n\rfloor} \\ \color{#c00}\iff& \rm k &\le&\ \ \rm \lfloor r \rfloor / n \\ \iff& \rm nk &\le&\ \ \rm \lfloor r \rfloor \\ \color{#c00}\iff& \rm nk &\le&\ \ \rm\ \, r \\ \iff& \rm k &\le&\ \ \rm\ \, r/n \\ \color{#c00}\iff& \rm k &\le&\ \ \rm \color{blue}{\lfloor r/n \rfloor} \\ \\ \Rightarrow\ \ \rm \color{#0a0}{\lfloor \lfloor r}\!\!&\rm\color{#0a0}{ \rfloor / n\rfloor}\ &=&\rm\ \ \color{blue}{\lfloor r/n\rfloor} \end{eqnarray}$$

Your problem is simply the special case $\rm\,\ r = x/2,\,\ n = 2.$


Suppose $a = \lfloor x/4 \rfloor$. Then, $a \leq x/4 < a+1$, or, $2a \leq x/2 < 2(a+1)$. As a result, $\lfloor x/2 \rfloor \in \{2a,2a+1\}\implies \lfloor x/2 \rfloor/2 \in \{a,a+\frac{1}{2}\}\implies \lfloor \lfloor x/2 \rfloor/2 \rfloor = a$.

Conversely, assume $\lfloor \lfloor x/2 \rfloor/2 \rfloor = a$. Then, $a \leq \lfloor x/2 \rfloor/2 < a+1 \implies 2a \leq \lfloor x/2 \rfloor < 2a+2$. This gives us $\lfloor x/2 \rfloor \in \{2a, 2a+1\} \implies x/2 \in [2a,2a+2) \implies x/4 \in [a,a+1) \implies \lfloor x/4 \rfloor = a$.

$\mathbf{Edit:}$ OK, I have overdone it, and one of the paragraphs will be good enough. For example, using the first one (for any given $a\in\mathbb{Z}$), \begin{align} a = \lfloor x/4 \rfloor & \iff a \leq x/4 < a+1 \\ & \iff 2a \leq x/2 < 2(a+1) \\ & \iff \lfloor x/2 \rfloor \in \{2a,2a+1\} \\ & \iff \lfloor x/2 \rfloor/2 \in \{a,a+\frac{1}{2}\} \\ & \iff \lfloor \lfloor x/2 \rfloor/2 \rfloor = a \end{align}

  • $\begingroup$ You just need one of these two paragraphs. $\endgroup$ – Julien Jun 30 '13 at 23:29
  • $\begingroup$ Or put if and only ifs to the first paragraph and ignore the second, duh. $\endgroup$ – Lord Soth Jun 30 '13 at 23:30
  • $\begingroup$ @julien Was just writing that :) $\endgroup$ – Lord Soth Jun 30 '13 at 23:30
  • 1
    $\begingroup$ At least, there is no doubt the result is true! $\endgroup$ – Julien Jun 30 '13 at 23:30
  • $\begingroup$ ...oh...my god. I think that's going to take several hours for my non-math oriented brain to work through. I'll get started in a bit...thanks. $\endgroup$ – CptSupermrkt Jun 30 '13 at 23:31

The suggestion that you should write $x = 4n + r$ works pretty well, where $n$ is an integer and $0 \leq r < 4$. Here $\lfloor x/4 \rfloor = n$, so you need to show that $$\lfloor \lfloor 2n + {r \over 2} \rfloor /2 \rfloor = n$$ Split into cases $0 \leq r < 2$ and $2 \leq r < 4$, or equivalently $0 \leq r/2 < 1$ and $1 \leq r/2 < 2$; it should not be that hard to verify the above equality holds in each case.


First observe that $$ \lfloor x/4 \rfloor=k\quad \text{if and only if}\quad 4k+4>x\ge 4k. $$ Next $$ \lfloor\lfloor x/2\rfloor/2\rfloor =k \quad \text{if and only if}\quad 2k+2>\lfloor x/2\rfloor\ge 2k. $$ But $$ 2k+2>\lfloor x/2\rfloor\ge 2k\quad \text{if and only if}\quad \lfloor x/2\rfloor=2k\quad\text{or}\quad 2k+1. $$ In the first case $$ \lfloor x/2\rfloor=2k\quad \text{if and only if}\quad 4k+2>x\ge 4k, $$ while in the second case $$ \lfloor x/2\rfloor=2k+1\quad \text{if and only if}\quad 4k+4>x\ge 4k+2. $$ Altogether $$ 2k+2>\lfloor x/2\rfloor\ge 2k\quad \text{if and only if}\quad 4k+4>x\ge 4k. $$

Therefore, $\lfloor x/4 \rfloor=\lfloor\lfloor x/2\rfloor/2\rfloor$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.