Floor and Ceiling Functions: Graphs, Limits, Derivative, Integral
The floor function ⌊x⌋ and ceiling function ⌈x⌉: definitions, step graphs, one-sided limits, continuity, derivative and how to integrate them.
Special and piecewise functions Updated 4 min read
At a glance
- Domain
- (-\infty, \infty)
- Range
- The integers \mathbb{Z}
- Derivative
- \frac{d}{dx}\lfloor x \rfloor = 0 \ \ (x \notin \mathbb{Z})
- Integral
- \int_0^x \lfloor t \rfloor\,dt = \lfloor x \rfloor x - \frac{\lfloor x \rfloor(\lfloor x \rfloor + 1)}{2}
- Discontinuities
- A jump of size 1 at every integer
- Relation
- \lceil x \rceil = -\lfloor -x \rfloor
On this page
The floor function \lfloor x\rfloor rounds a number down to the nearest integer, and the ceiling function \lceil x\rceil rounds it up. Their graphs look like staircases, which makes them the classic examples of piecewise functions with jump discontinuities. The floor function is also called the greatest integer function and is sometimes written [x] or \operatorname{int}(x).
Definitions
| x | 2.7 | 2 | 0.4 | -0.4 | -2.7 |
|---|---|---|---|---|---|
| \lfloor x\rfloor | 2 | 2 | 0 | -1 | -3 |
| \lceil x\rceil | 3 | 2 | 1 | 0 | -2 |
Watch the negative numbers: rounding -2.7 down moves it to -3, not -2.
Graph of the floor function
Graph of the ceiling function
Key properties
- Range. Both functions output only integers.
- Bounds. x - 1 < \lfloor x\rfloor \le x \le \lceil x\rceil < x + 1.
- Integers are fixed. \lfloor n\rfloor = \lceil n\rceil = n for any integer n.
- Shifting by an integer. \lfloor x + n\rfloor = \lfloor x\rfloor + n for any integer n.
- Floor and ceiling are linked. \lceil x\rceil = -\lfloor -x\rfloor, and for a non-integer x, \lceil x\rceil = \lfloor x\rfloor + 1.
Limits and continuity
Between integers the floor function is constant, so it is continuous there. At an integer n the one-sided limits disagree:
So \lim_{x\to n}\lfloor x\rfloor does not exist, and there is a jump of size 1. Since the right-hand limit equals \lfloor n\rfloor, the floor function is right-continuous. The ceiling function is the reverse: \lim_{x\to n^-}\lceil x\rceil = n and \lim_{x\to n^+}\lceil x\rceil = n + 1, so it is left-continuous. For the formal definitions, see the guide to continuity.
Example: a limit at infinity. Find \lim_{x\to\infty}\frac{\lfloor x\rfloor}{x}. For x > 0, dividing x - 1 < \lfloor x\rfloor \le x by x gives 1 - \frac{1}{x} < \frac{\lfloor x\rfloor}{x} \le 1. Both bounds approach 1, so by the squeeze theorem the limit is 1.
Derivative of the floor function
On each open interval (n, n+1) the function is the constant n, whose derivative is 0. At an integer the function is not continuous, so it is not differentiable. The same holds for the ceiling function.
Integral of the floor function
Each unit interval [k, k+1] contributes a rectangle of height k and width 1, so you add up rectangle areas, much like a Riemann sum that happens to be exact. For x \ge 0:
The same formula also holds for negative x.
Example. \int_0^{3.5}\lfloor t\rfloor\,dt = 0 + 1 + 2 + 3(0.5) = 4.5. The formula agrees: 3(3.5) - \frac{3\cdot 4}{2} = 10.5 - 6 = 4.5.
Example with ceiling. \int_0^3\lceil t\rceil\,dt = 1 + 2 + 3 = 6, since \lceil t\rceil equals 1 on (0, 1], 2 on (1, 2] and 3 on (2, 3]. Single points do not affect an integral.
Common mistakes
- Rounding negatives toward zero. \lfloor -1.2\rfloor = -2, not -1.
- Claiming the limit at an integer exists. The left and right limits differ by 1.
- Putting the closed dot on the wrong end. Floor steps are closed on the left; ceiling steps are closed on the right.
- Differentiating at a jump. The derivative is 0 only between integers. At the integers it does not exist.
Where you will see them
Step functions model anything charged in whole units: postage by the ounce, parking by the hour, or tax brackets. In calculus they are the go-to examples for one-sided limits and for functions that are integrable but not continuous. See the general strategy on piecewise functions, and compare with the corner of the absolute value function.
Practice it now
One-sided and infinite limits
Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.
Practice this lesson