Floor and Ceiling Function — Definition and Examples

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

What Are the Floor and Ceiling Functions?

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

For x=3.2x = 3.2: ⌊3.2⌋=3\lfloor 3.2 \rfloor = 3 and ⌈3.2⌉=4\lceil 3.2 \rceil = 4.

When xx is already an integer, both agree: ⌊5⌋=⌈5⌉=5\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.

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

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

  • ⌊−2.3⌋=−3\lfloor -2.3 \rfloor = -3 (down means more negative)

  • ⌈−2.3⌉=−2\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 Z\mathbb{Z}:

⌊x⌋=max⁡{ n∈Z:n≤x }\lfloor x \rfloor = \max\{\, n \in \mathbb{Z} : n \le x \,\}

⌈x⌉=min⁡{ n∈Z:n≥x }\lceil x \rceil = \min\{\, n \in \mathbb{Z} : n \ge x \,\}

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

Symbol

Meaning

xx

Any real number (the input)

nn

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

Z\mathbb{Z}

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

⌊x⌋\lfloor x \rfloor

Floor of xx: the greatest integer ≤x\le x

⌈x⌉\lceil x \rceil

Ceiling of xx: the least integer ≥x\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)[3, 4), ⌊x⌋=3\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](3, 4], ⌈x⌉=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 xx and integer nn.

  • Integer shift: ⌊x+n⌋=⌊x⌋+n\lfloor x + n \rfloor = \lfloor x \rfloor + n and ⌈x+n⌉=⌈x⌉+n\lceil x + n \rceil = \lceil x \rceil + n.

  • Bounds: ⌊x⌋≤x<⌊x⌋+1\lfloor x \rfloor \le x < \lfloor x \rfloor + 1 and x≤⌈x⌉<x+1x \le \lceil x \rceil < x + 1.

  • Relationship: for non-integer xx, ⌈x⌉=⌊x⌋+1\lceil x \rceil = \lfloor x \rfloor + 1; for integer xx, ⌈x⌉=⌊x⌋\lceil x \rceil = \lfloor x \rfloor.

  • Negation: ⌊−x⌋=−⌈x⌉\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 ⌊4.7⌋\lfloor 4.7 \rfloor and ⌈4.7⌉\lceil 4.7 \rceil.

The integers around 4.7 are 4 and 5.

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

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

Final answer: ⌊4.7⌋=4\lfloor 4.7 \rfloor = 4, ⌈4.7⌉=5\lceil 4.7 \rceil = 5.

Example 2

Evaluate ⌊−2.3⌋\lfloor -2.3 \rfloor.

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

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

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

⌊−2.3⌋=−3\lfloor -2.3 \rfloor = -3.

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

Example 3

Evaluate ⌈−2.3⌉\lceil -2.3 \rceil.

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

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

⌈−2.3⌉=−2\lceil -2.3 \rceil = -2.

Final answer: ⌈−2.3⌉=−2\lceil -2.3 \rceil = -2.

Example 4

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

Separate the integer part.

⌊3.6+5⌋=⌊3.6⌋+5\lfloor 3.6 + 5 \rfloor = \lfloor 3.6 \rfloor + 5

⌊3.6⌋=3\lfloor 3.6 \rfloor = 3

3+5=83 + 5 = 8

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

Example 5

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

Substitute first.

3x−5=3(3.9)−53x - 5 = 3(3.9) - 5

=11.7−5= 11.7 - 5

=6.7= 6.7

⌈6.7⌉=7\lceil 6.7 \rceil = 7

Final answer: f(3.9)=7f(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÷4=6.75= 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: ⌈6.75⌉=7\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 ⌊x⌋\lfloor x \rfloor and ⌈x⌉\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][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 ⌊−4.2⌋=−4\lfloor -4.2 \rfloor = -4. That value is greater than −4.2-4.2, so it fails floor's definition.

The correct way: For negatives, floor moves down the number line, away from zero: ⌊−4.2⌋=−5\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 ⌈4.2⌉=4\lceil 4.2 \rceil = 4.

The correct way: Ceiling always rounds up, so ⌈4.2⌉=5\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 ⌈6⌉=7\lceil 6 \rceil = 7 because ceiling "rounds up."

The correct way: When xx is already an integer, there is nothing to round: ⌊6⌋=⌈6⌉=6\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 ⌊−4.2⌋=−4\lfloor -4.2 \rfloor = -4.

Conclusion

  • The floor function ⌊x⌋\lfloor x \rfloor gives the greatest integer at or below xx; the ceiling function ⌈x⌉\lceil x \rceil gives the least integer at or above xx.

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

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

  • For negatives, floor moves away from zero: ⌊−2.3⌋=−3\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

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 xx; ceiling rounds up to the least integer at or above xx. For x=2.5x = 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][x] in older textbooks.
What is ⌊x⌋\lfloor x \rfloor when xx is a whole number?
It equals xx itself. Both floor and ceiling leave integers unchanged.
Does the floor function ever equal the ceiling function?
Only when xx is an integer. For every non-integer, ⌈x⌉=⌊x⌋+1\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 ⌊x⌋\lfloor x \rfloor and ⌈x⌉\lceil x \rceil.
✍️ Written By
Madhukar V
Madhukar V
Math Columnist & Analyst
I see mathematics as more than just numbers and formulas—it is a way of thinking, questioning, and understanding the world around us. I work at the intersection of mathematics, EdTech, technology, and AI-powered learning, I enjoy exploring how mathematical ideas can be made simple, meaningful, and relatable. Through my articles, I aim to present mathematics with curiosity and a practical perspective, helping readers see the beauty and relevance behind every concept in a Bhanzu way.
LinkedIn
Related Articles
Book a FREE Demo ClassBook Now →