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.

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


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


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.