Sum of Floor and Floor of Negative

Theorem
Let $x \in \R$. Then:


 * $\left \lfloor {x} \right \rfloor + \left \lfloor {-x} \right \rfloor = \begin{cases}

0 & : x \in \Z \\ -1 & : x \notin \Z \end{cases}$

where $\left \lfloor {x} \right \rfloor$ is the floor of $x$.

Proof

 * Let $x \in \Z$.

Then $x = \left \lfloor {x} \right \rfloor$ from Integer Equals Floor And Ceiling.

Now $x \in \Z \implies -x \in \Z$, so $\left \lfloor {-x} \right \rfloor = -x$.

Thus $\left \lfloor {x} \right \rfloor + \left \lfloor {-x} \right \rfloor = x + \left({-x}\right) = x - x = 0$.


 * Now suppose $x \notin \Z$.

From Real Number is Floor plus Difference, $x = n + t$, where $n = \left \lfloor {x} \right \rfloor$ and $t \in \left[{0 .. 1}\right)$.

Thus, $-x = - \left({n + t}\right) = -n - t = -n - 1 + \left({1 - t}\right)$.

As $t \in \left[{0 .. 1}\right)$, we have $1 - t \in \left[{0 .. 1}\right)$.

Thus $\left \lfloor {-x} \right \rfloor = -n - 1$.

So $\left \lfloor {x} \right \rfloor + \left \lfloor {-x} \right \rfloor = n + \left({-n - 1}\right) = n - n - 1 = -1$.