Let $a$ and $b$ be integers. Is it true that

$$ \left | \left \lceil \frac{a}{2} \right \rceil - \left \lceil \frac{b}{2} \right \rceil \right |\geq \left \lfloor \left | \frac{a - b}{2} \right |\right \rfloor $$

Where $\lceil \cdot \rceil$ is the ceiling function, $\lfloor \cdot \rfloor$ the floor function and $|\cdot|$ is the absolute function.

The inequality seems to be true when I check it programatically but I would like to get a proof (or disproof) for this inequality.

  • $\begingroup$ What about $a=-1$ and $b=2$? The LHS is $|0-1| =1$ and the RHS is $2$. $\endgroup$
    – Martin R
    Commented Nov 7, 2019 at 16:05
  • $\begingroup$ @MartinR Thank you very much for pointing that out, I have altered the inequality slightly, there was an error in the equation. $\endgroup$
    – KillaKem
    Commented Nov 7, 2019 at 16:25
  • $\begingroup$ You might as well assume $a\ge b$ and thus dispense with taking absolute values. $\endgroup$
    – hardmath
    Commented Nov 7, 2019 at 17:03
  • $\begingroup$ If we allow all real numbers, you can also just write it as $|\lceil x\rceil-\lceil y\rceil|\ge\lfloor|x-y|\rfloor|$. Assuming $x\ge y$ gives $\lceil x\rceil-\lceil y\rceil\ge\lfloor x-y\rfloor$, which looks pretty neat. $\endgroup$
    – Milten
    Commented Nov 7, 2019 at 17:13

3 Answers 3


Yes, it is true.

$$ \left | \left \lceil \frac{a}{2} \right \rceil - \left \lceil \frac{b}{2} \right \rceil \right |\geq \left \lfloor \left | \frac{a - b}{2} \right |\right \rfloor \tag1$$

In the following, $m,n$ are integers.

Case 1 : If $a=2m,b=2n$, then both sides of $(1)$ equal $|m-n|$.

Case 2 : If $a=2m,b=2n+1$, then $$(1)\iff |m-n-1|\ge \left\lfloor\left |m-n-\frac 12\right|\right\rfloor\tag2$$

If $m-n-\frac 12\ge 0$, then $m-n-1\ge 0$, so$$(2)\iff m-n-1\ge m-n-1$$which is true.

If $m-n-\frac 12\lt 0$, then $m-n-1\lt 0$, so$$(2)\iff -m+n+1\ge -m+n$$which is true.

Case 3 : If $a=2m+1, b=2n$, then $$(1)\iff |m-n+1|\ge \left\lfloor\left|m-n+\frac 12\right|\right\rfloor\tag3$$

If $m-n+\frac 12\ge 0$, then $m-n+1\ge 0$, so$$(3)\iff m-n+1\ge m-n$$which is true.

If $m-n+\frac 12\lt 0$, then $m-n+1\lt 0$, so$$(3)\iff -m+n-1\ge -m+n-1$$which is true.

Case 4 : If $a=2m+1,b=2n+1$, then both sides of $(1)$ equal $|m-n|$.


There is no need for the assumption that $a$ and $b$ are integers. You just need to prove that

$$|\lceil x\rceil-\lceil y\rceil|\ge\lfloor|x-y|\rfloor$$

for any real numbers $x$ and $y$. By symmetry, we may assume $x\ge y$, in which case we can remove the absolute value signs. If, moreover, we write $x=y+u$ with $u\ge0$, we are trying to prove

$$\lceil y+u\rceil\ge\lceil y\rceil+\lfloor u\rfloor$$

But $u=\lfloor u\rfloor+r$ for some $0\le r\lt1$, and $\lceil y+\lfloor u\rfloor +r\rceil=\lceil y+r\rceil+\lfloor u\rfloor$, so the inequality to prove is simply

$$\lceil y+r\rceil\ge\lceil y\rceil$$

which is clearly true, since the ceiling function is never decreasing and $r\ge0$.


Assume without loss of generality that $a\ge b$. Then the inequality is $$ \left\lceil \frac a2 \right\rceil - \left\lceil \frac b2 \right\rceil \ge \left\lfloor \frac {a-b}2 \right\rfloor $$ If either $a$ or $b$ is an even integer, then we can pull the whole number $\frac a2$ or $\frac b2$ out of the floor function, and the inequality reduces to $\left\lceil \frac a2 \right\rceil \ge \left\lfloor \frac {a}2 \right\rfloor$ or $-\left\lceil \frac b2 \right\rceil \ge \left\lfloor -\frac {b}2 \right\rfloor$ (where the first is trivial and the second is actually an equality).

Assume therefore that neither of $a$ and $b$ is an even integer. Let $2m<a<2(m+1)$ and $2n<b<2(n+1)$, for some $m,n\in \mathbb Z$. Then $$ \left\lceil \frac a2 \right\rceil - \left\lceil \frac b2 \right\rceil = (m+1)-(n+1) = m-n $$ On the other hand $$ m-n-1<\frac a2 - \frac b2 < m-n+1 $$ which means that $$ \left\lfloor \frac {a-b}2 \right\rfloor \le m-n = \left\lceil \frac a2 \right\rceil - \left\lceil \frac b2 \right\rceil $$ so we are done.

EDIT: I didn't notice you assumed $a$ and $b$ to be integers. Well, my answer works for all real numbers.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .