# 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? Feb 10, 2017 at 12:31
• $[ ]$ denotes greatest integer function.
– Avi
Feb 10, 2017 at 12:32
• Your (1) and (2) just hold for $x \notin \mathbb{Z}.$
– User
Feb 10, 2017 at 12:32
• How many integers are there between $-2$ and $0$ non-inclusive?
– lulu
Feb 10, 2017 at 12:32
• Also, you should specify that $x$ is not an integer.
– lulu
Feb 10, 2017 at 12:33

## 3 Answers

$\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.

$$T=\left\lfloor x \right\rfloor + \left\lfloor { - x} \right\rfloor$$

When x=n, only integer

$$\underbrace {\left\lfloor x \right\rfloor }_n + \underbrace {\left\lfloor { - x} \right\rfloor }_{ - n} \Rightarrow n - n = 0$$

When x=n+a, $$a\in(0,1)$$

$$\left\lfloor {n + a} \right\rfloor + \left\lfloor { - n - 1 + 1 - a} \right\rfloor$$

$$a \in \left( {0,1} \right)$$, therefore $$a' = 1 - a \in \left( {0,1} \right)$$

$$\underbrace {\left\lfloor {n + a} \right\rfloor }_n + \underbrace {\left\lfloor { - n - 1 + a'} \right\rfloor }_{ - n - 1} = n - n - 1 = - 1$$.

Hence when x is an integer $$T=0$$, else $$T=-1$$