Floor equals Ceiling iff Integer
From ProofWiki
Theorem
Let $x \in \R$ be a real number.
Let $\left \lfloor {x}\right \rfloor$ be the floor of $x$, and $\left \lceil {x}\right \rceil$ be the ceiling of $x$.
Then:
- $\left \lfloor {x}\right \rfloor = \begin{cases} \left \lceil {x}\right \rceil & : x \in \Z \\ \left \lceil {x}\right \rceil - 1 & : x \notin \Z \\ \end{cases}$
or equivalently:
- $\left \lceil {x}\right \rceil = \begin{cases} \left \lfloor {x}\right \rfloor & : x \in \Z \\ \left \lfloor {x}\right \rfloor + 1 & : x \notin \Z \\ \end{cases}$
where $\Z$ is the set of integers.
Proof
From Integer Equals Floor And Ceiling, we have that:
- $x \in \Z \implies x = \left \lfloor {x}\right \rfloor$;
- $x \in \Z \implies x = \left \lceil {x}\right \rceil$.
So $x \in \Z \implies \left \lfloor {x}\right \rfloor = \left \lceil {x}\right \rceil$.
Now let $x \notin \Z$.
From the definition of the floor function:
- $\left \lfloor {x} \right \rfloor = \sup \left({\left\{{m \in \Z: m \le x}\right\}}\right)$
From the definition of the ceiling function:
- $\left \lceil {x} \right \rceil = \inf \left({\left\{{m \in \Z: m \ge x}\right\}}\right)$
Thus $\left \lfloor {x} \right \rfloor < x < \left \lceil {x} \right \rceil$.
Hence the result, from the definition of $\inf$ and $\sup$.
$\blacksquare$