Floor and Ceiling Function — Definition and Examples

#Algebra
TL;DR
The floor function $\lfloor x \rfloor$ gives the greatest integer less than or equal to $x$, and the ceiling function $\lceil x \rceil$ gives the least integer greater than or equal to $x$. This article covers their notation, graphs, properties, and worked examples, plus the negative-number trap that costs the most marks.
BT
Bhanzu TeamLast updated on July 19, 20268 min read

What Are the Floor and Ceiling Functions?

The floor function, written $\lfloor x \rfloor$, returns the greatest integer that is less than or equal to $x$. The ceiling function, written $\lceil x \rceil$, returns the least integer that is greater than or equal to $x$. In plain terms, floor rounds down to the nearest integer and ceiling rounds up.

For $x = 3.2$: $\lfloor 3.2 \rfloor = 3$ and $\lceil 3.2 \rceil = 4$.

When $x$ is already an integer, both agree: $\lfloor 5 \rfloor = \lceil 5 \rceil = 5$.

The floor function is also called the greatest integer function and shares its bracket-and-step behaviour; see the dedicated greatest integer function article for its exam-style notation. Both are examples of step functions, which jump rather than curve.

How Do You Read the Notation?

The square-bottomed brackets $\lfloor\ \rfloor$ mean floor, and the square-topped brackets $\lceil\ \rceil$ mean ceiling. A quick memory anchor: the bracket that looks like it has a floor at the bottom rounds down, and the one with a ceiling at the top rounds up.

  • $\lfloor 7.9 \rfloor = 7$ (down to the nearest integer)

  • $\lceil 7.1 \rceil = 8$ (up to the nearest integer)

  • $\lfloor -2.3 \rfloor = -3$ (down means more negative)

  • $\lceil -2.3 \rceil = -2$ (up means less negative)

Floor and Ceiling Function Formula

Stated precisely with set-builder notation, each function picks a single integer out of the integers $\mathbb{Z}$:

$$\lfloor x \rfloor = \max\{\, n \in \mathbb{Z} : n \le x \,\}$$

$$\lceil x \rceil = \min\{\, n \in \mathbb{Z} : n \ge x \,\}$$

In words, floor is the largest integer no bigger than $x$, and ceiling is the smallest integer no smaller than $x$. The variable key below keeps the symbols straight.

Symbol

Meaning

$x$

Any real number (the input)

$n$

An integer chosen from $\mathbb{Z}$ (the output)

$\mathbb{Z}$

The set of all integers $\{\ldots, -2, -1, 0, 1, 2, \ldots\}$

$\lfloor x \rfloor$

Floor of $x$: the greatest integer $\le x$

$\lceil x \rceil$

Ceiling of $x$: the least integer $\ge x$

What Do Their Graphs Look Like?

Both functions produce a staircase graph made of flat horizontal segments. Each step is one unit wide and jumps by one unit at every integer.

  • The floor graph holds the value of the left endpoint of each interval: on the interval $[3, 4)$, $\lfloor x \rfloor = 3$. The left end is filled (closed), the right end is open.

  • The ceiling graph holds the value of the right endpoint: on $(3, 4]$, $\lceil x \rceil = 4$. The right end is filled, the left end is open.

Which Properties Should You Know?

A handful of identities cover almost every problem. Each holds for any real $x$ and integer $n$.

  • Integer shift: $\lfloor x + n \rfloor = \lfloor x \rfloor + n$ and $\lceil x + n \rceil = \lceil x \rceil + n$.

  • Bounds: $\lfloor x \rfloor \le x < \lfloor x \rfloor + 1$ and $x \le \lceil x \rceil < x + 1$.

  • Relationship: for non-integer $x$, $\lceil x \rceil = \lfloor x \rfloor + 1$; for integer $x$, $\lceil x \rceil = \lfloor x \rfloor$.

  • Negation: $\lfloor -x \rfloor = -\lceil x \rceil$, which is where the negative-number mistakes hide.

Examples of the Floor and Ceiling Function

The examples move from a single value up to an applied problem. Work each line before reading the next.

Example 1

Evaluate $\lfloor 4.7 \rfloor$ and $\lceil 4.7 \rceil$.

The integers around 4.7 are 4 and 5.

$\lfloor 4.7 \rfloor = 4$ (greatest integer not above 4.7).

$\lceil 4.7 \rceil = 5$ (least integer not below 4.7).

Final answer: $\lfloor 4.7 \rfloor = 4$, $\lceil 4.7 \rceil = 5$.

Example 2

Evaluate $\lfloor -2.3 \rfloor$.

The tempting move is to drop the decimal and answer $-2$, matching what we do for positive numbers.

Test it: is $-2$ less than or equal to $-2.3$? No, because $-2$ is to the right of $-2.3$ on the number line, so $-2 > -2.3$. That breaks the definition of floor.

The greatest integer that is genuinely less than or equal to $-2.3$ is the one just below it.

$\lfloor -2.3 \rfloor = -3$.

Final answer: $\lfloor -2.3 \rfloor = -3$. For negatives, floor moves away from zero.

Example 3

Evaluate $\lceil -2.3 \rceil$.

The least integer greater than or equal to $-2.3$ is the one just above it.

$-2$ is greater than $-2.3$, and $-3$ is not.

$\lceil -2.3 \rceil = -2$.

Final answer: $\lceil -2.3 \rceil = -2$.

Example 4

Simplify $\lfloor 3.6 + 5 \rfloor$ using the integer-shift property.

Separate the integer part.

$\lfloor 3.6 + 5 \rfloor = \lfloor 3.6 \rfloor + 5$

$\lfloor 3.6 \rfloor = 3$

$3 + 5 = 8$

Final answer: $\lfloor 3.6 + 5 \rfloor = 8$.

Example 5

Evaluate the composite $f(x) = \lceil 3x - 5 \rceil$ at $x = 3.9$.

Substitute first.

$3x - 5 = 3(3.9) - 5$

$= 11.7 - 5$

$= 6.7$

$\lceil 6.7 \rceil = 7$

Final answer: $f(3.9) = 7$.

Example 6

A print shop charges per sheet, and each sheet holds 4 photos. How many sheets are needed for 27 photos?

Photos per sheet fixed at 4, so sheets $= 27 \div 4 = 6.75$.

You cannot buy 0.75 of a sheet, and 6 sheets hold only 24 photos, leaving 3 photos unprinted.

Round up with ceiling: $\lceil 6.75 \rceil = 7$.

Final answer: 7 sheets. Anywhere you "need enough to cover everything," ceiling is the right tool.

Why the Floor Function Runs Quietly Behind Everyday Systems

The floor and ceiling functions exist to answer a single stubborn question: how do you turn a continuous amount into a whole count? Money, time, and hardware do not accept fractions of a unit, so mathematics needs a clean rule for collapsing 6.75 into either 6 or 7.

  • Where it began: the notation $\lfloor x \rfloor$ and $\lceil x \rceil$ was introduced by Kenneth Iverson in 1962 to make integer rounding precise in computing, replacing the older ambiguous "greatest integer" bracket $[x]$.

  • Where it earns its keep now: tax brackets apply a floor to income steps, postal rates charge by a ceiling on weight, and pagination uses a ceiling to decide how many pages a list of results needs.

  • Where it is going: in computer science, floor and ceiling underlie array indexing, hashing, and memory allocation, where an off-by-one rounding error can crash a program.

The destination is worth seeing early: the same two brackets that round a single decimal also decide how a database splits ten million records into fixed-size blocks.

Tripping Points to Avoid

Three errors account for most wrong answers, and two of them live entirely in the negatives.

Mistake 1: Rounding negatives the wrong way

Where it slips in: Any problem with a negative input, where the instinct is to "chop the decimal."

Don't do this: Write $\lfloor -4.2 \rfloor = -4$. That value is greater than $-4.2$, so it fails floor's definition.

The correct way: For negatives, floor moves down the number line, away from zero: $\lfloor -4.2 \rfloor = -5$. The first instinct is to strip the decimal and keep the sign, and that dropped step down is exactly where the mark is lost.

Mistake 2: Swapping the two brackets

Where it slips in: Reading fast, students match $\lfloor\ \rfloor$ with "up" or $\lceil\ \rceil$ with "down."

Don't do this: Answer $\lceil 4.2 \rceil = 4$.

The correct way: Ceiling always rounds up, so $\lceil 4.2 \rceil = 5$. The habit that fixes this is reading the bracket shape aloud: floor has its bar at the bottom, ceiling at the top.

Mistake 3: Assuming floor and ceiling always differ by 1

Where it slips in: On integer inputs.

Don't do this: Claim $\lceil 6 \rceil = 7$ because ceiling "rounds up."

The correct way: When $x$ is already an integer, there is nothing to round: $\lfloor 6 \rfloor = \lceil 6 \rceil = 6$. The two functions differ by 1 only for non-integers.

The real-world echo of Mistake 1 is a billing bug: a system that "rounds down" a negative account adjustment the naive way can credit a customer one unit too much, the software equivalent of writing $\lfloor -4.2 \rfloor = -4$.

Conclusion

  • The floor function $\lfloor x \rfloor$ gives the greatest integer at or below $x$; the ceiling function $\lceil x \rceil$ gives the least integer at or above $x$.

  • Both draw staircase graphs; floor holds the lower integer per step, ceiling the upper.

  • Key identities include the integer shift $\lfloor x + n \rfloor = \lfloor x \rfloor + n$.

  • For negatives, floor moves away from zero: $\lfloor -2.3 \rfloor = -3$.

  • On integer inputs, floor and ceiling are equal.

To practise step functions with a teacher, explore Bhanzu's algebra tutor, get help with algebra, or browse math classes online.

Read More

Book a Free Demo

Was this article helpful?

Your feedback helps us write better content

Frequently Asked Questions

What is the difference between the floor and ceiling functions?
Floor rounds down to the greatest integer at or below $x$; ceiling rounds up to the least integer at or above $x$. For $x = 2.5$, floor is 2 and ceiling is 3.
Is the floor function the same as the greatest integer function?
Yes. The greatest integer function is another name for the floor function, often written $[x]$ in older textbooks.
What is $\lfloor x \rfloor$ when $x$ is a whole number?
It equals $x$ itself. Both floor and ceiling leave integers unchanged.
Does the floor function ever equal the ceiling function?
Only when $x$ is an integer. For every non-integer, $\lceil x \rceil = \lfloor x \rfloor + 1$.
How do you type floor and ceiling brackets?
In LaTeX, use \lfloor x \rfloor for floor and \lceil x \rceil for ceiling, which render as $\lfloor x \rfloor$ and $\lceil x \rceil$.
✍️ Written By
BT
Bhanzu Team
Content Creator and Editor
Bhanzu’s editorial team, known as Team Bhanzu, is made up of experienced educators, curriculum experts, content strategists, and fact-checkers dedicated to making math simple and engaging for learners worldwide. Every article and resource is carefully researched, thoughtfully structured, and rigorously reviewed to ensure accuracy, clarity, and real-world relevance. We understand that building strong math foundations can raise questions for students and parents alike. That’s why Team Bhanzu focuses on delivering practical insights, concept-driven explanations, and trustworthy guidance-empowering learners to develop confidence, speed, and a lifelong love for mathematics.
Related Articles
Book a FREE Demo ClassBook Now →