# 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.

Source: https://practicecalculus.com/functions/floor-and-ceiling-functions
Updated: 2026-11-03

$$ \lfloor x \rfloor = \max\{n \in \mathbb{Z} : n \le x\}, \quad \lceil x \rceil = \min\{n \in \mathbb{Z} : n \ge x\} $$

## 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$

## Key takeaways

- $\lfloor x \rfloor$ rounds down to the nearest integer and $\lceil x \rceil$ rounds up.
- Both are step functions: constant between integers, with a jump of $1$ at every integer.
- At an integer $n$, $\lim_{x\to n^-}\lfloor x\rfloor = n - 1$ and $\lim_{x\to n^+}\lfloor x\rfloor = n$, so the two-sided limit does not exist.
- The derivative is $0$ away from the integers and undefined at them; integrals are sums of rectangle areas.

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](/functions/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

$$\lfloor x\rfloor = \text{the largest integer } n \text{ with } n \le x, \qquad \lceil x\rceil = \text{the smallest integer } n \text{ with } n \ge x$$

| $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
title: 'Graph of the floor function y = ⌊x⌋ from x = −1 to x = 3'
caption: 'Each step includes its left endpoint (closed dot) and excludes its right endpoint (open dot), because $\lfloor n\rfloor = n$ at every integer $n$.'
x: [-1.5, 3.5]
y: [-1.8, 2.8]
functions:
  - expr: '-1'
    domain: [-1, 0]
  - expr: '0'
    domain: [0, 1]
  - expr: '1'
    domain: [1, 2]
  - expr: '2'
    domain: [2, 3]
points:
  - [-1, -1, '', closed]
  - [0, -1, '', open]
  - [0, 0, '', closed]
  - [1, 0, '', open]
  - [1, 1, '', closed]
  - [2, 1, '', open]
  - [2, 2, '(2, 2)', closed]
  - [3, 2, '', open]
```

## Graph of the ceiling function

```graph
title: 'Graph of the ceiling function y = ⌈x⌉ from x = −1 to x = 3'
caption: 'The ceiling steps are closed on the right and open on the left, the mirror image of the floor function.'
x: [-1.5, 3.5]
y: [-0.8, 3.8]
functions:
  - expr: '0'
    domain: [-1, 0]
  - expr: '1'
    domain: [0, 1]
  - expr: '2'
    domain: [1, 2]
  - expr: '3'
    domain: [2, 3]
points:
  - [-1, 0, '', open]
  - [0, 0, '', closed]
  - [0, 1, '', open]
  - [1, 1, '', closed]
  - [1, 2, '', open]
  - [2, 2, '', closed]
  - [2, 3, '', open]
  - [3, 3, '(3, 3)', closed]
```

## 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](/blog/how-to-evaluate-limits) disagree:

$$\lim_{x\to n^-}\lfloor x\rfloor = n - 1, \qquad \lim_{x\to n^+}\lfloor x\rfloor = n$$

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](/blog/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](/theorems/squeeze-theorem) the limit is $1$.

## Derivative of the floor function

$$\frac{d}{dx}\lfloor x\rfloor = 0 \quad \text{for } x \notin \mathbb{Z}$$

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](/blog/riemann-sums) that happens to be exact. For $x \ge 0$:

$$\int_0^x\lfloor t\rfloor\,dt = (0 + 1 + \cdots + (n - 1)) + n(x - n) = nx - \frac{n(n+1)}{2}, \qquad n = \lfloor x\rfloor$$

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

1. **Rounding negatives toward zero.** $\lfloor -1.2\rfloor = -2$, not $-1$.
2. **Claiming the limit at an integer exists.** The left and right limits differ by $1$.
3. **Putting the closed dot on the wrong end.** Floor steps are closed on the left; ceiling steps are closed on the right.
4. **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](/functions/piecewise-functions), and compare with the corner of the [absolute value function](/functions/absolute-value-function).

## Frequently asked questions

### What is the floor function?

The floor function $\lfloor x\rfloor$, also called the greatest integer function, gives the largest integer less than or equal to $x$. For example $\lfloor 2.7\rfloor = 2$ and $\lfloor -2.7\rfloor = -3$.

### What is the difference between floor and ceiling?

Floor rounds down and ceiling rounds up. They agree on integers, and for a non-integer $x$ the ceiling is exactly one more than the floor.

### Is the floor function continuous?

It is continuous at every non-integer and has a jump discontinuity at every integer. It is right-continuous everywhere: $\lim_{x\to n^+}\lfloor x\rfloor = n = \lfloor n\rfloor$.

### What is the derivative of the floor function?

Between integers the floor function is constant, so its derivative is $0$. At each integer it jumps, so it is not differentiable there.

### How do you integrate the floor function?

Split the interval at the integers. On each piece the function is constant, so each piece contributes a rectangle, for example $\int_0^3\lfloor x\rfloor\,dx = 0 + 1 + 2 = 3$.
