(Floor Function).

The Floor and Ceiling Functions
Every real number x ∈ R is bounded above and below by integers.
Theorem 1. For every real number x, there exists an integer n such that n ≤ x <
n + 1.
(∀ x ∈ R)(∃n ∈ Z)(n ≤ x < n + 1)
The Floor Function
The floor of x is the largest integer less than or equal to x.
Definition 1 (Floor Function). The floor of x is
b x c = max{n ∈ Z : n ≤ x }
The Graph of the Floor Function
y = bxc
3
2
1
−1
0
2
1
−1
1
3
x
Examples of the Floor Function
The floor of some sample numbers are listed below.
j√ k
√
2 = 1 since 2 ≈ 1.41421.
•
• bπ c = 3 since π ≈ 3.14159. (π is the circumference of the unit
circle.)
• bec = 2 since e ≈ 2.71828.
j
k
√
• b ϕc = (1 + 5)/2 = 1 since ϕ ≈ 1.61803. (ϕ is the golden ratio,
the positive solution of x2 − x − 1 = 0.)
j √ k
• b ϕc = 1−2 5 = −1 since ϕ ≈ −0.61803.
• bγc = 0 since γ ≈ 0.57721. (The Euler-Mascheroni constant γ is
approximately the difference Hn − ln n for large n.)
The Ceiling Function
The ceiling of x is the smallest integer greater than or equal to
x.
Definition 2 (Ceiling Function). The ceiling of x is
d x e = min{n ∈ Z : x ≤ n}
The Graph of the Floor Function
y = dxe
3
2
1
−2
−1
0
1
−1
2
2
3
x
Examples of the Ceiling Function
The ceiling of some sample numbers are listed below.
•
l√ m
√
√
2 = 2 since 2 ≈ 1.41421. ( 2 is the hypotenuese of an
isocelse right triangle with unit sides.)
• dπ e = 4 since π ≈ 3.14159.
• dee = 3 since e ≈ 2.71828. (e is approximately equal to 1 + n1 )n
for large n. This expression arises in computing compound interest.)
l
m
√
• d ϕe = (1 + 5)/2 = 2 since ϕ ≈ 1.61803.
l
m
√
• d ϕe = (1 − 5)/2 = 0 since ϕ ≈ −0.61803. (ϕ is the conguate of
the golden ratio, the negative solution of x2 − x − 1 = 0.)
• dγe ≈ d0.57721e = 1
Properties of The Floor and Ceiling Functions
There are several useful identities involving floors and ceilings.
(
b x c + b− x c =
(
0
−1
if x ∈ Z
if x 6∈ Z
0
if x ∈ Z
−1 if x 6∈ Z
logb x + 1 = logb ( x + 1)
d x e + d− x e =
3
The Count of Numerals in a Number
The number of decimal digits in n is
blog(n)c + 1 = dlog(n + 1)e
For instance, All numbers from n = 10 to n = 99 have 2 digits and
for any number in this range 1 ≤ log(n) < 2 and 1 < log(n + 1) ≤ 2 so
that
2 = blog(n)c + 1 = dlog(n + 1)e
In general, when n is written in base b the number of base b numerals
required is
logb (n) + 1 = logb (n + 1)
The Count of Numerals in a Number
The number of binary bits needed to write n is
blg(n)c + 1 = dlg(n + 1)e
For instance, All numbers from n = 16 = (10000)2 to n = 31 = (11111)2
have 5 bits and for any number in this range4 ≤ lg(n) < 5 and 4 <
log(n + 1) ≤ 5 so that
5 = blg(n)c + 1 = dlg(n + 1)e
The Fractional Part Function
It is also useful to be aware of the fractional part of a real
number x.
The fractional part is the difference betwwen x and the floor
of x. The fraction part is written { x } = x − b x c.
y = {x}
1
−1
0
1
2
3
x
−1
Problems on Floor, Ceiling, and Fractional Part Functions
Show your understanding of this topic by completing the problems found at Floor and Ceiling Functions.
4