How to prove this property involving the floor function?

82 Views Asked by At

How does one prove that $$\lfloor x \rfloor = \lfloor x/2 \rfloor + \lfloor (x+1)/2 \rfloor $$ where $\lfloor x \rfloor$ represents the greatest integer less than or equal to $x$?

I tried to do this by using inequalities but end up with $\lfloor x \rfloor + 1/2$ on the lhs. Can someone help?

2

There are 2 best solutions below

0
On

Let $x = a + b$ where $a \in \mathbb{N}$ and $0 \leqslant b < 1$ We need to prove that $$\lfloor a + b \rfloor = \left\lfloor \frac{a+b}{2} \right\rfloor + \left\lfloor \frac{a+b +1}{2} \right\rfloor $$

The L.H.S. will be just $a$

Now the R.H.S.

$$\left\lfloor \frac{a+b}{2} \right\rfloor + \left\lfloor \frac{a+b +1}{2} \right\rfloor = \left\lfloor \frac{a}{2} \right\rfloor + \left\lfloor \frac{a+1}{2} \right\rfloor $$

If $a$ is even,

$$\left\lfloor \frac{a}{2} \right\rfloor + \left\lfloor \frac{a+1}{2} \right\rfloor = \frac{a}{2} + \frac{a}{2} = a $$

If $a$ is odd,

$$\left\lfloor \frac{a}{2} \right\rfloor + \left\lfloor \frac{a+1}{2} \right\rfloor = \frac{a-1}{2} + \frac{a+1}{2} = a $$

2
On

I here assume that $x$ is a positive real. We then have that $x = n + r$, where $n \in \mathbb{N}$ and $r$ is a real number with $r \in [0;1)$. We have that $\lfloor x \rfloor = n$.

Either $n$ or $n+1$ is even. If $n$ is even, then $\lfloor x/2 \rfloor = \frac{n}{2}$ and $\lfloor (x+1)/2 \rfloor = \lfloor (n+1)/2 \rfloor = \lfloor \frac{n}{2} + \frac{1}{2} \rfloor = \frac{n}{2}$. Therefore $\lfloor x/2 \rfloor + \lfloor (x+1)/2 \rfloor = \frac{n}{2} + \frac{n}{2} = n$.

The case where $n$ is odd is similar.