Skip to main content
Mathematics LibreTexts

1.4: The Floor and Ceiling of a Real Number

  • Page ID
    82286
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    Here we define the floor, a.k.a., the greatest integer, and the ceiling, a.k.a., the least integer, functions. Kenneth Iverson introduced this notation and the terms floor and ceiling in the early 1960s — according to Donald Knuth who has done a lot to popularize the notation. Now this notation is standard in most areas of mathematics.

    Definition \(\PageIndex{1}\)

    If \(x\) is any real number we define \[\lfloor x\rfloor=\mbox{ the greatest integer less than or equal to } x\nonumber\] \[\lceil x\rceil=\mbox{ the least integer greater than or equal to } x\nonumber\]

    \({\mbox{$ \lfloor x \rfloor $}}\) is called the floor of \(x\) and \({\mbox{$ \lceil x \rceil $}}\) is called the ceiling of \(x\) The floor \(\lfloor x\rfloor\) is sometimes denoted \([x]\) and called the greatest integer function. But I prefer the notation \(\lfloor x\rfloor\). Here are a few simple examples:

    1. \(\lfloor 3.1 \rfloor\) = 3 and \(\lceil 3.1 \rceil\) = 4
    2. \(\lfloor 3 \rfloor\) = 3 and \(\lceil 3 \rceil\) = 3
    3. \(\lfloor -3.1 \rfloor\) = -4 and \(\lceil -3.1 \rceil\) = -3

    From now on we mostly concentrate on the floor \(\lfloor x \rfloor\). For a more detailed treatment of both the floor and ceiling see the book Concrete Mathematics [5]. According to the definition of \(\lfloor x \rfloor\) we have \[\label{eq:1}\lfloor x\rfloor =\max\{n\in\mathbb{Z}\mid n\leq\}\] Note also that if \(n\) is an integer we have: \[\label{eq:2}n=\lfloor x\rfloor \Longleftrightarrow n\leq x<n+1.\] From this it is clear that \[{\mbox{$ \lfloor x \rfloor $}} \le x \mbox{ holds for all $x$},\nonumber\] and \[{\mbox{$ \lfloor x \rfloor $}} = x \Longleftrightarrow x \in \mathbb{Z}.\nonumber\] We need the following lemma to prove our next theorem.

    Lemma \(\PageIndex{1}\)

    For all \(x \in \mathbb{R}\) \[x - 1 < {\mbox{$ \lfloor x \rfloor $}} \le x.\nonumber\]

    Proof

    Let \(n={\mbox{$ \lfloor x \rfloor $}}\). Then by \(\eqref{eq:2}\) we have \(n\le x<n+1\). This gives immediately that \({\mbox{$ \lfloor x \rfloor $}}\le x\), as already noted above. It also gives \(x<n+1\) which implies that \(x-1<n\), that is, \(x-1<{\mbox{$ \lfloor x \rfloor $}}\).

    Exercise \(\PageIndex{1}\)

    Sketch the graph of the function \(f(x)={\mbox{$ \lfloor x \rfloor $}}\) for \(-3\le x\le 3\).

    Exercise \(\PageIndex{2}\)

    Find \({\mbox{$ \lfloor \pi \rfloor $}}\), \({\mbox{$ \lceil \pi \rceil $}}\), \({\mbox{$ \lfloor \sqrt{2} \rfloor $}}\), \({\mbox{$ \lceil \sqrt{2} \rceil $}}\), \({\mbox{$ \lfloor -\pi \rfloor $}}\), \({\mbox{$ \lceil -\pi \rceil $}}\), \({\mbox{$ \lfloor -\sqrt{2} \rfloor $}}\), and \({\mbox{$ \lceil -\sqrt{2} \rceil $}}\).

    Definition \(\PageIndex{2}\)

    Recall that the decimal representation of a positive integer \(a\) is given by \(a =a_{n-1}a_{n-2}\cdots a_1a_0\) where \[\label{eq:3} a = a_{n-1}10^{n-1} + a_{n-2}10^{n-2} + \cdots + a_110 + a_0\] and the digits \(a_{n-1},a_{n-2},\dots,a_1,a_0\) are in the set \(\{0,1,2,3,4,5,6,7,8,9\}\) with \(a_{n-1}\neq 0\). In this case we say that the integer \(a\) is an \(n\) digit number or that \(a\) is \(n\) digits long.

    Exercise \(\PageIndex{3}\)

    Prove that \(a\in\mathbb{N}\) is an \(n\) digit number where \(n={\mbox{$ \lfloor \log(a) \rfloor $}}+1\). Here \(\log\) means logarithm to base 10.

    Hint

    Show that if \(\eqref{eq:3}\) holds with \(a_{n-1}\neq 0\) then \(10^{n-1}\le a<10^n\). Then apply the \(\log\) to all terms of this inequality.

    Exercise \(\PageIndex{4}\)

    Use the previous exercise to determine the number of digits in the decimal representation of the number \(2^{3321928}\). Recall that \(\log(x^y)=y\log(x)\) when \(x\) and \(y\) are positive.


    1.4: The Floor and Ceiling of a Real Number is shared under a All Rights Reserved (used with permission) license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?