Floor Function
The floor function (also known as the greatest integer function) \(\lfloor\cdot\rfloor: \mathbb{R} \to \mathbb{Z}\) of a real number \(x\) denotes the greatest integer less than or equal to \(x\). For example, \(\lfloor 5\rfloor=5, ~\lfloor 6.359\rfloor =6, ~\left\lfloor \sqrt{7}\right\rfloor=2, ~\lfloor \pi\rfloor = 3, ~\lfloor -13.42\rfloor = -14.\)
In general, \( \lfloor x \rfloor\) is the unique integer satisfying \(\lfloor x\rfloor\le x<\lfloor x\rfloor +1\).
Let \(\{x\}\) denote the fractional part of \(x\) with \(0\le \{x\}<1\), for example, \(\{2.137\}=0.137.\) Then \(x=\lfloor x\rfloor+\{x\}\) for any real number \(x\). For example, \(3.1416=3+0.1416,\) with \(\lfloor x\rfloor =3\) and \(\{x\}=0.1416\).
Contents
Floor Function
The key fact that \( \lfloor x \rfloor \le x < \lfloor x \rfloor +1\) is often enough to solve basic problems involving the floor function.
Find all the values of \(x\) that satisfy \[ \big\lfloor 0.5 + \lfloor x \rfloor \big\rfloor = 20 .\]
Let \( \lfloor x \rfloor= y.\) Then \[\lfloor 0.5 + y \rfloor = 20 .\] This is equivalent to \( 20\le y + 0.5 < 21,\) or \[19.5\le y < 20.5 .\] Since \(y\) is an integer and \(y = 20\) is the only integer in that interval, this becomes \[ y = 20 = \lfloor x \rfloor.\] Any value less than \(21\) and greater than or equal to \(20\) will satisfy this equation. Thus, the answer is all the real numbers \(x\) such that \[20\le x<21 . \ _\square\]
Other Properties:
(1) \( \lfloor x+n \rfloor = \lfloor x \rfloor + n \) for any integer \( n. \)
(2) \( \lfloor x \rfloor + \lfloor -x \rfloor = \begin{cases} -1&\text{if } x \notin {\mathbb Z} \\ 0&\text{if } x\in {\mathbb Z}. \end{cases} \)
(3) \( \lfloor x+y \rfloor = \lfloor x \rfloor + \lfloor y \rfloor \) or \( \lfloor x \rfloor + \lfloor y \rfloor + 1. \)
The proofs of these are straightforward. To illustrate, here is a proof of (2). If \( x\) is an integer, then \( \lfloor x \rfloor + \lfloor -x \rfloor = x+(-x) = 0. \) If \( x \) is not an integer, then \( \lfloor x \rfloor < x < \lfloor x \rfloor + 1.\) Then \( -\lfloor x \rfloor -1 < -x < -\lfloor x \rfloor, \) and the outsides of the inequality are consecutive integers, so the left side of the inequality must equal \( \lfloor -x \rfloor, \) by the characterization of the greatest integer function given in the introduction.
So \( \lfloor -x \rfloor = -\lfloor x \rfloor - 1,\) or \( \lfloor x \rfloor + \lfloor -x \rfloor = -1.\) \(_\square\)
Floor and Ceiling Functions - Problem Solving
Problems involving the floor function of \( x\) are often simplified by writing \( x = n+r \), where \( n = \lfloor x \rfloor \) is an integer and \(r = \{x\} \) satisfies \( 0\le r <1.\)
If \(\lfloor x \rfloor\{x\} = 1\) and \(\lfloor x \rfloor^2 - \lfloor x \rfloor(1+x) + 4 = 0\), what is the value of \(x\)?
Write \( x = n+r \) with \( n = \lfloor x \rfloor\) and \( r = \{ x \} \) as suggested above. Then the first equation becomes \( nr=1.\) Expanding and rearranging the second equation,
\[\begin{align} n^2 - n(1+n+r) + 4 &= 0\\ -n-nr+4&=0\\ -n+3&=0, \end{align} \]
so \(n=3.\) Therefore, \( r=\frac13\) and \( x = n+r = \frac{10}3.\) \(_\square\)
Applications of Floor Function to Calculus
Definite integrals and sums involving the floor function are quite common in problems and applications. The best strategy is to break up the interval of integration (or summation) into pieces on which the floor function is constant.
Evaluate \( \int\limits_0^\infty \lfloor x \rfloor e^{-x} \, dx. \)
Break the integral up into pieces of the form \[ \begin{align} \int\limits_n^{n+1} \lfloor x \rfloor e^{-x} \, dx &= \int\limits_n^{n+1} ne^{-x} \, dx \\ &= -ne^{-x}\big|_n^{n+1} \\ &= n(e^{-n}-e^{-(n+1)}) \\ &= ne^{-(n+1)}(e-1). \end{align} \] So the integral is the sum of these pieces over all \( n\): \[ \begin{align} \int_0^\infty \lfloor x \rfloor e^{-x} \, dx &= \sum_{n=0}^\infty \int_n^{n+1} \lfloor x \rfloor e^{-x} \, dx \\ &= \sum_{n=0}^\infty ne^{-(n+1)}(e-1) \\ &= (e-1)\sum_{n=0}^\infty \frac{n}{e^{n+1}}, \end{align} \] but \( \sum\limits_{n=0}^\infty nx^{n+1} = x^2\sum\limits_{n=0}^\infty nx^{n-1} = \frac{x^2}{(1-x)^2} \) by differentiating the geometric series, so the answer is \[ (e-1)\frac{(1/e)^2}{(1-1/e)^2} = (e-1)\frac1{(e-1)^2} = \frac1{e-1}. \]
Other Applications of the Floor Function
One common application of the floor function is finding the largest power of a prime dividing a factorial:
Let \( p \) be a prime number and \( n \) a positive integer. The largest power of \( p \) dividing \( n! \) is \( p^k,\) where
\[
k = \left\lfloor \frac{n}{p} \right\rfloor + \left\lfloor \frac{n}{p^2} \right\rfloor + \cdots = \sum_{i=1}^\infty \left\lfloor \frac{n}{p^i} \right\rfloor.
\]
Induct on \( n\): the base case \( n =1 \) is clear (both sides are 0), and if it is true for \( n-1, \) then the largest power of \( p \) dividing \( n! = (n-1)! \cdot n \) is \( p^\ell,\) where \[ \ell = v_p(n) + \sum_{i=1}^\infty \left\lfloor \frac{n-1}{p^i} \right\rfloor \] where \( v_p(n) \) is the largest \( k \) such that \( p^k|n. \) Now it is clear that \( \left\lfloor \frac{n}{p^i} \right\rfloor - \left\lfloor \frac{n-1}{p^i} \right\rfloor = 1\) if \( p^i \) divides \( n \) and \( 0 \) otherwise. The number of \( i \ge 1 \) such that \( p^i \) divides \( n\) is just \( v_p(n),\) so \[ \begin{align} \sum_{i=1}^\infty \left\lfloor \frac{n}{p^i} \right\rfloor - \sum_{i=1}^\infty \left\lfloor \frac{n-1}{p^i} \right\rfloor &= v_p(n) \\ \sum_{i=1}^\infty \left\lfloor \frac{n}{p^i} \right\rfloor &= v_p(n) + \sum_{i=1}^\infty \left\lfloor \frac{n-1}{p^i} \right\rfloor, \end{align} \] which is \( \ell,\) as desired.
References
- Omegatron, . Floor function. Retrieved March 30, 2006, from https://commons.wikimedia.org/wiki/File:Floor_function.svg