Floor and Ceiling Functions

The floor and ceiling functions are two of the most important special functions in mathematics, particularly in number theory, computer science, and discrete mathematics. The floor function, written ⌊x⌋, maps any real number x to the greatest integer less than or equal to x. The ceiling function, written ⌈x⌉, maps any real number x to the least integer greater than or equal to x. Together, these functions bridge the gap between the continuous world of real numbers and the discrete world of integers. You encounter floor and ceiling functions constantly in everyday life, even without naming them. When a store rounds a price down to the nearest dollar, that is a floor operation. When a building requires that you buy enough tiles to cover a floor (even if the last row is only partially needed), that is a ceiling operation. In programming, integer division in most languages implicitly uses the floor function, and scheduling problems — like figuring out how many buses are needed to transport a group of students — rely on ceiling reasoning. Understanding these functions deeply requires grasping their precise definitions, their graphical representations (the famous 'staircase' graphs), and a set of algebraic identities and inequalities that make them powerful tools for proof and calculation. This article develops all of these ideas from the ground up, with careful attention to the edge cases that trip up many beginners, such as what happens when x is already an integer.

Key takeaways
  • Formal Definitions
  • The Fractional Part
  • Relationship Between Floor and Ceiling
  • Important Algebraic Properties
  • Solving Equations and Inequalities

Formal Definitions

The floor of x is defined as ⌊x⌋ = the unique integer n such that n ≤ x < n + 1. Equivalently, ⌊x⌋ is the greatest integer not exceeding x. The ceiling of x is defined as ⌈x⌉ = the unique integer n such that n − 1 < x ≤ n. Equivalently, ⌈x⌉ is the least integer not less than x. For example: ⌊3.7⌋ = 3, ⌊−1.2⌋ = −2, ⌊5⌋ = 5, ⌈3.1⌉ = 4, ⌈−1.8⌉ = −1, ⌈7⌉ = 7. Notice that for negative non-integers, the floor goes further from zero: ⌊−1.2⌋ = −2, not −1.

The Fractional Part

The fractional part of x is defined as {x} = x − ⌊x⌋. It always satisfies 0 ≤ {x} < 1. For example, {3.7} = 0.7 and {−1.2} = 0.8 (since ⌊−1.2⌋ = −2 and −1.2 − (−2) = 0.8). This means every real number can be written as x = ⌊x⌋ + {x}, a decomposition into integer and fractional parts. The fractional part is zero if and only if x is already an integer.

Relationship Between Floor and Ceiling

The floor and ceiling functions are related by a simple identity: ⌈x⌉ = −⌊−x⌋. This means you can always derive one from the other. Another key relationship is ⌈x⌉ − ⌊x⌋ = 0 if x is an integer, and ⌈x⌉ − ⌊x⌋ = 1 if x is not an integer. Combining: ⌈x⌉ − ⌊x⌋ = 1 − [x ∈ ℤ], where the bracket is 1 when x is an integer and 0 otherwise. Also note ⌊x⌋ ≤ x ≤ ⌈x⌉ always holds.

Important Algebraic Properties

Several key properties govern how floor and ceiling interact with arithmetic. (1) Translation by an integer: ⌊x + n⌋ = ⌊x⌋ + n for any integer n. (2) Inequality characterization: ⌊x⌋ = n ⟺ n ≤ x < n + 1 ⟺ x − 1 < n ≤ x. (3) Floor of a sum: in general ⌊x + y⌋ ≥ ⌊x⌋ + ⌊y⌋, with equality when {x} + {y} < 1. (4) Hermite's identity: ⌊x⌋ + ⌊x + 1/n⌋ + ⌊x + 2/n⌋ + ⋯ + ⌊x + (n−1)/n⌋ = ⌊nx⌋ for any positive integer n. (5) The number of multiples of k in the range [1, n] is ⌊n/k⌋, a fact essential in number theory.

Solving Equations and Inequalities

To solve ⌊x⌋ = k for integer k, the solution set is the interval [k, k+1). To solve ⌊2x + 1⌋ = 5, set 5 ≤ 2x + 1 < 6, giving 4 ≤ 2x < 5, so 2 ≤ x < 5/2. For inequalities: ⌊x⌋ ≥ 3 means x ≥ 3; ⌊x⌋ ≤ 3 means x < 4. To solve ceiling equations: ⌈x⌉ = k has solution set (k−1, k]. Strategy: always replace the floor or ceiling expression with its defining inequality, then solve for x in the resulting compound inequality.

The Key Equation

⌊x⌋≤x<⌊x⌋+1and⌈x⌉−1<x≤⌈x⌉\lfloor x \rfloor \leq x < \lfloor x \rfloor + 1 \qquad \text{and} \qquad \lceil x \rceil - 1 < x \leq \lceil x \rceil
  • \lfloor x \rfloor — Floor of x (dimensionless (integer)): The greatest integer less than or equal to x; always satisfies ⌊x⌋ ≤ x
  • \lceil x \rceil — Ceiling of x (dimensionless (integer)): The least integer greater than or equal to x; always satisfies ⌈x⌉ ≥ x
  • x — Input (dimensionless (real number)): Any real number; the domain of both floor and ceiling functions is all of ℝ

Worked Example

Problem. Solve the equation ⌊3x − 1⌋ = 4, and then find the number of integers in the solution set of ⌈x/2⌉ ≤ 5.

x∈[53, 2)andx≤10x \in \left[\tfrac{5}{3},\, 2\right) \quad \text{and} \quad x \leq 10

Answer. Part 1: x ∈ [5/3, 2). Part 2: x ≤ 10, which contains infinitely many integers (or 10 positive integers if restricted to {1, 2, ..., 10}).

Figure
Diagram
Floor and Ceiling Functions: Staircase Graphsxy012-1-212-1⌊x⌋⌈x⌉— ⌊x⌋ floor--- ⌈x⌉ ceiling
Origins · 1 minKenneth E. Iverson and how this was discovered
KE
Kenneth E. Iverson
1920–2004 · Canadian

Kenneth Iverson invented the notation ⌊x⌋ and ⌈x⌉ for the floor and ceiling functions in his 1962 book 'A Programming Language', which also introduced the APL programming language. Before Iverson, these concepts existed but lacked unified, standard notation. His symbols, popularized further by Donald Knuth in 'The Art of Computer Programming' (1968), became universally accepted in mathematics and computer science. Iverson received the Turing Award in 1979 for his contributions to programming languages. Iverson's APL programming language was so concise that an entire sorting algorithm could be written in a single line of code. He was known to type complete programs on a single index card.

  • Absolute Value Function — Like floor and ceiling, the absolute value function is a special function defined by cases; both require piecewise reasoning and appear frequently in equations and inequalities.
  • Piecewise Functions — The floor and ceiling functions are formally piecewise functions — their rules change depending on which interval contains the input — making piecewise function theory directly applicable.
  • Integer Division and Modular Arithmetic — The floor function is the mathematical foundation of integer division: ⌊a/b⌋ gives the quotient, and the remainder relates to the fractional part, directly connecting floor functions to modular arithmetic.
  • Domain and Range of Functions — Both floor and ceiling functions have domain ℝ and range ℤ, providing a concrete example of how a function can map an uncountable set to a countable one.