Floor and Ceiling Functions
Definitions
Let x be a real number. The floor function of x, denoted by ⌊x⌋ or floor (x), is defined to be the greatest integer that is less than or equal to x.
The ceiling function of x, denoted by ⌈x⌉ or ceil (x), is defined to be the least integer that is greater than or equal to x.
For example,
It follows from the definitions that the floor and ceiling functions have type \(\mathbb{R} \to \mathbb{Z}.\) Formally, for any \(x \in \mathbb{R},\) they can be defined as
Graphs of the Floor and Ceiling Functions
The floor and ceiling functions look like a staircase and have a jump discontinuity at each integer point.
Properties of the Floor and Ceiling Functions
There are many interesting and useful properties involving the floor and ceiling functions, some of which are listed below. The number \(n\) is assumed to be an integer.
- \(\left\lfloor x \right\rfloor = n \;\text{ iff }\; n \le x \lt n + 1\)
- \(\left\lceil x \right\rceil = n \;\text{ iff }\; n - 1 \lt x \le n\)
- \(\left\lfloor x \right\rfloor = n \;\text{ iff }\; x - 1 \lt n \le x\)
- \(\left\lceil x \right\rceil = n \;\text{ iff }\; x \le n \lt x + 1\)
- \(\left\lfloor { - x} \right\rfloor = - \left\lceil x \right\rceil \)
- \(\left\lceil { - x} \right\rceil = - \left\lfloor x \right\rfloor \)
- \(\left\lfloor x \right\rfloor + \left\lfloor { - x} \right\rfloor \) \(= \left\{ {\begin{array}{*{20}{l}} 0 &{\text{ if } x \in \mathbb{Z}}\\ { - 1} &{\text{ if } x \notin \mathbb{Z}} \end{array}} \right.\)
- \(\left\lceil x \right\rceil + \left\lceil { - x} \right\rceil \) \(= \left\{ {\begin{array}{*{20}{l}} 0 &{\text{ if } x \in \mathbb{Z}}\\ 1 &{\text{ if } x \notin \mathbb{Z}} \end{array}} \right.\)
- \(\left\lfloor {x + n} \right\rfloor = \left\lfloor x \right\rfloor + n\)
- \(\left\lceil {x + n} \right\rceil = \left\lceil x \right\rceil + n\)
Fractional Part Function
The fractional part of a number \(x \in \mathbb{R}\) is the difference between \(x\) and the floor of \(x:\)
For example,
The graph of the fractional part function looks like a sawtooth wave, with a period of \(1.\)
The range of fractional part function is the half-open interval \(\left[ {0,1} \right).\)
Some other properties of the fractional part are
- \(\left\{ x \right\} = 0 \;\text{ iff }\; x \in \mathbb{Z}\)
- \(\left\{ {x + n} \right\} = \left\{ x \right\}, n \in \mathbb{Z}\)
- \(\left\{ x \right\} + \left\{ { - x} \right\} \) \(= \left\{ {\begin{array}{*{20}{l}} 0 &{\text{if } x \in \mathbb{Z}}\\ 1 &{\text{if } x \notin \mathbb{Z}} \end{array}} \right.\)