Rewriting $\lfloor x \rfloor+\lfloor-x\rfloor$

75 Views Asked by At

How can I prove that

$$\lfloor x\rfloor + \lfloor -x\rfloor = \begin{cases} \phantom{-}0 &, x \in \mathbb{Z} \\ -1 &, x \notin \mathbb{Z} \end{cases}$$

where $x$ is a real number?

3

There are 3 best solutions below

2
On

First assume $x$ is an integer and then evaluate the left side. Next assume $x$ is not an integer, so it equals $k+y$ for some integer $k$ and some real number $y$ with $0<y<1$. Then evaluate the left side.

0
On

Consider the following equation: $\lfloor x \rfloor - \lfloor x \rfloor = 0.$ Doh, of course, because $\lfloor x \rfloor = \lfloor x \rfloor$. The question is then: when does $\lfloor x \rfloor = |\lfloor -x \rfloor|$? (The straight bars here represent the absolute value function).

If $x$ is positive but not an integer, then $\lfloor -x \rfloor = -(\lfloor x \rfloor + 1)$, so $|\lfloor x \rfloor| < |\lfloor -x \rfloor|$. For example, if $x = \pi \approx 3.14159$, then $-x \approx -3.14159$ and $\lfloor -x \rfloor = -4$, and obviously $3 < |-4|$.

Similarly, if $x$ is negative but not an integer, then $\lfloor -x \rfloor = -(\lfloor x \rfloor + 1)$ just the same, but $|\lfloor x \rfloor| > |\lfloor -x \rfloor|$. Example: $x = -\frac{3}{2}$. Then $$\lfloor -x \rfloor = \left\lfloor \frac{3}{2} \right\rfloor = 1,$$ and obviously $|-2| > 1$.

But if $x$ is an integer, be it positive or negative or 0, then $\lfloor x \rfloor = |\lfloor -x \rfloor|$. For example, if $x = -7$, then $\lfloor x \rfloor = -7$ and the absolute value of that is 7, the same as the absolute value of $x$ itself, and $\lfloor x \rfloor$ as well.

0
On

If $\,x\,$ is an integer then $\,\lfloor x \rfloor + \lfloor -x \rfloor = x +(-x) = 0\,$. Otherwise, by the definition of $\,\lfloor \,\cdot\, \rfloor\,$:

$$ x - 1 \lt \lfloor x \rfloor \lt x \\ -x - 1 \lt \lfloor -x \rfloor \lt -x $$

Adding the two inequalities:

$$ -2 \lt \lfloor x \rfloor + \lfloor -x \rfloor \lt 0 \\ $$

The only integer strictly between $\,-2\,$ and $\,0\,$ is of course $\,-1\,$.