# Value of $\left \lfloor{x}\right \rfloor+\left \lfloor{-x}\right \rfloor$?

While reading about greatest integer function from a book, I found a question as $\left \lfloor{x}\right \rfloor+\left \lfloor{-x}\right \rfloor$ ?

I attempted it as follows:

We know:

$x-1<\left \lfloor{x}\right \rfloor< x\tag1$

Also then: $-x-1 < \left \lfloor{-x}\right \rfloor < -x\tag2$

Adding $(1)$ & $(2)$, we get

$-2< \left \lfloor{x}\right \rfloor+\left \lfloor{-x}\right \rfloor<0$.

This is the answer which I got, but the actual answer was $\left \lfloor{x}\right \rfloor+\left \lfloor{-x}\right \rfloor= -1$. I am not getting this. Where my method has gone wrong? Please help me.

• Is $[x]$ the floor function? – freakish Feb 10 '17 at 12:31
• $[ ]$ denotes greatest integer function. – Avi Feb 10 '17 at 12:32
• Your (1) and (2) just hold for $x \notin \mathbb{Z}.$ – tommy xu3 Feb 10 '17 at 12:32
• How many integers are there between $-2$ and $0$ non-inclusive? – lulu Feb 10 '17 at 12:32
• Also, you should specify that $x$ is not an integer. – lulu Feb 10 '17 at 12:33

$\lfloor x\rfloor = \begin{cases}x&, x\in \mathbb{Z}\\ x-r(x) &, x\not \in \mathbb{Z}\end{cases}$

Where $r(x)$ is the smallest positive number such that $x-r(x)\in\mathbb{Z}$. See, that for $x\not\in\mathbb{Z}$ $r(-x)=1-r(x)$.

Because $x\in \mathbb{Z} \Rightarrow -x\in\mathbb{Z}$, we have

$\lfloor x\rfloor + \lfloor -x\rfloor = \begin{cases}x&-x&, x\in \mathbb{Z}\\ x-r(x) &-x-1+r(x) &, x\not \in \mathbb{Z}\end{cases} =\begin{cases}0&, x\in \mathbb{Z}\\ -1 &, x\not \in \mathbb{Z}\end{cases}$

We have $x=\lfloor x\rfloor+\{x\}$.

As you can draw integer numbers out the floors,

$$\lfloor x\rfloor+\lfloor-x\rfloor=\lfloor\lfloor x\rfloor+\{x\}\rfloor+\lfloor-\lfloor x\rfloor-\{x\}\rfloor=\lfloor x\rfloor+\lfloor\{x\}\rfloor-\lfloor x\rfloor+\lfloor-\{x\}\rfloor$$ and the integer parts cancel out.

Now,

$$\lfloor x\rfloor+\lfloor-x\rfloor=\lfloor\{x\}\rfloor+\lfloor-\{x\}\rfloor$$

which is one of $0$ or $-1$ (see why), and the original claim is wrong.