Calculus

Set Theory

Set Theory Logo

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,

\[\lfloor{\pi}\rfloor = 3,\;\;\lceil{\pi}\rceil = 4,\;\;\lfloor{5}\rfloor = 5,\;\;\lceil{5}\rceil = 5.\]
\[\lfloor{- e}\rfloor = -3,\;\;\lceil{-e}\rceil = -2,\;\;\lfloor{-1}\rfloor = -1,\;\;\lceil{-1}\rceil = -1.\]

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

\[\begin{array}{*{20}{l}} \text{floor:} & {\lfloor {x} \rfloor = \max \left\{ {n \in \mathbb{Z}:n \le x} \right\}}\\[1em] \text{ceiling:} & {\lceil {x} \rceil = \min \left\{ {n \in \mathbb{Z}:n \le x} \right\}} \end{array}\]

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.

The graph of the floor function.
Figure 1.
The graph of the ceiling function.
Figure 2.

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.

  1. \(\left\lfloor x \right\rfloor = n \;\text{ iff }\; n \le x \lt n + 1\)
  2. \(\left\lceil x \right\rceil = n \;\text{ iff }\; n - 1 \lt x \le n\)
  3. \(\left\lfloor x \right\rfloor = n \;\text{ iff }\; x - 1 \lt n \le x\)
  4. \(\left\lceil x \right\rceil = n \;\text{ iff }\; x \le n \lt x + 1\)
  5. \(\left\lfloor { - x} \right\rfloor = - \left\lceil x \right\rceil \)
  6. \(\left\lceil { - x} \right\rceil = - \left\lfloor x \right\rfloor \)
  7. \(\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.\)
  8. \(\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.\)
  9. \(\left\lfloor {x + n} \right\rfloor = \left\lfloor x \right\rfloor + n\)
  10. \(\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:\)

\[\left\{ x \right\} = x - \left\lfloor x \right\rfloor .\]

For example,

\[\left\{ 2 \right\} = 2 - \left\lfloor 2 \right\rfloor = 2 - 2 = 0,\]
\[\left\{ {3.51} \right\} = 3.51 - \left\lfloor {3.51} \right\rfloor = 3.51 - 3 = 0.51,\]
\[\left\{ {\frac{7}{3}} \right\} = \frac{7}{3} - \left\lfloor {\frac{7}{3}} \right\rfloor = \frac{7}{3} - 2 = \frac{1}{3},\]
\[\left\{ { - 5.98} \right\} = - 5.98 - \left\lfloor { - 5.98} \right\rfloor = - 5.98 - \left( { - 6} \right) = - 5.98 + 6 = 0.02\]

The graph of the fractional part function looks like a sawtooth wave, with a period of \(1.\)

Graph of the fractional part function.
Figure 3.

The range of fractional part function is the half-open interval \(\left[ {0,1} \right).\)

Some other properties of the fractional part are

  1. \(\left\{ x \right\} = 0 \;\text{ iff }\; x \in \mathbb{Z}\)
  2. \(\left\{ {x + n} \right\} = \left\{ x \right\}, n \in \mathbb{Z}\)
  3. \(\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.\)

See solved problems on Page 2.

Page 1 Page 2