Ceiling of Floor is Floor
From ProofWiki
Contents |
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 \lceil {\left \lfloor {x}\right \rfloor}\right \rceil = \left \lfloor {x}\right \rfloor$
That is, the ceiling of the floor is the floor.
Proof
By definition of the floor function, we have that $\left \lfloor {x} \right \rfloor \in \Z$.
From Integer Equals Floor And Ceiling, we have:
- $x = \left \lceil {x} \right \rceil \iff x \in \Z$
Hence the result.
$\blacksquare$
Also see
Sources
- Donald E. Knuth: The Art of Computer Programming: Volume 1: Fundamental Algorithms (1968): $\S 1.2.4$: Exercise $2$