ArticleslgStudy

mathematics

Floor and ceiling functions

Floor and ceiling functions is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Floor and ceiling functions rather than just read about it. In short: In mathematics, the floor function is the function that takes a real number x as input and returns the greatest integer less than or equal to x, written ⌊x⌋ or floor(x). Similarly, the ceiling function returns the least integer greater than or equal to x, written ⌈x⌉ or ceil(x).

Floor and ceiling functions — main illustration
Floor and ceiling functions — illustration

Key takeaways

  • Floor and ceiling functions belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Floor and ceiling functions to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Floor and ceiling functions from memory before moving on to harder problems.

Reference excerpt

In mathematics, the floor function is the function that takes a real number x as input and returns the greatest integer less than or equal to x, written ⌊x⌋ or floor(x). Similarly, the ceiling function returns the least integer greater than or equal to x, written ⌈x⌉ or ceil(x). For example, for floor: ⌊2.4⌋ = 2, ⌊−2.4⌋ = −3, and for ceiling: ⌈2.4⌉ = 3, and ⌈−2.4⌉ = −2. The floor of x is also called the integral part, integer part, greatest integer, or entier of x, and was historically denoted [x] (among other notations). However, the term "integer part" is ambiguous, as it can also mean truncation towards zero, which differs from the floor function for negative numbers. For an integer n, ⌊n⌋ = ⌈n⌉ = n. Although floor(x + 1) and ceil(x) are equal for non-integer values of x, and thus produce graphs that appear exactly alike, they differ when x is an integer. For example, when x = 2.0001, ⌊2.0001 + 1⌋ = ⌈2.0001⌉ = 3. However, if x = 2, then ⌊2 + 1⌋ = 3 but ⌈2⌉ = 2.

Notation The integral part or integer part of a number (partie entière in the original) was first defined in 1798 by Adrien-Marie Legendre in his proof of the Legendre's formula. Carl Friedrich Gauss introduced the square bracket notation [x] in his third proof of quadratic reciprocity (1808). This remained the standard in mathematics until Kenneth E. Iverson introduced, in his 1962 book A Programming Language, the names "floor" and "ceiling" and the corresponding notations ⌊x⌋ and ⌈x⌉. (Iverson used square brackets for a different purpose, the Iverson bracket notation.) Both notations are now used in mathematics, although Iverson's notation will be followed in this article. In some sources, boldface or double brackets ⟦x⟧ are used for floor, and reversed brackets ⟧x⟦ or ]x[ for ceiling. The fractional part is the sawtooth function, denoted by {x} for real x and defined by the formula

{x} = x − ⌊x⌋ For all x,

0 ≤ {x} < 1. These characters are provided in Unicode and HTML entities:

U+2308 ⌈ LEFT CEILING (&lceil;, &LeftCeiling;) U+2309 ⌉ RIGHT CEILING (&rceil;, &RightCeiling;) U+230A ⌊ LEFT FLOOR (&LeftFloor;, &lfloor;) U+230B ⌋ RIGHT FLOOR (&rfloor;, &RightFloor;) In the LaTeX typesetting system, these symbols can be specified with the \lceil, \rceil, \lfloor, and \rfloor commands in math mode. LaTeX has supported UTF-8 since 2018, so the Unicode characters can now be used directly. Larger versions are\left\lceil, \right\rceil, \left\lfloor, and \right\rfloor.

Definition and properties Given real numbers x and y, integers m and n and the set of integers ℤ, floor and ceiling may be defined by the equations ⌊x⌋=max⁡{m∈ℤ∣m≤x}, ⌈x⌉=min⁡{n∈ℤ∣n≥x}. Since there is exactly one integer in a half-open interval of length one, for any real number x, there are unique integers m and n satisfying the equation x−1<m≤x≤n<x+1, where ⌊x⌋=m and ⌈x⌉=n may also be taken as the definition of floor and ceiling.

Equivalences These formulas can be used to simplify expressions involving floors and ceilings. ⌊x⌋=m if and only if m≤x<m+1,⌈x⌉=n if and only if n−1<x≤n,⌊x⌋=m if and only if x−1<m≤x,⌈x⌉=n if and only if x≤n<x+1. In the language of order theory, the floor function is a residuated mapping, that is, part of a Galois connection: it is the upper adjoint of the function that embeds the integers into the reals. x<n if and only if ⌊x⌋<n,n<x if and only if n<⌈x⌉,x≤n if and only if ⌈x⌉≤n,n≤x if and only if n≤⌊x⌋. These formulas show how adding an integer n to the arguments affects the functions: ⌊x+n⌋=⌊x⌋+n,⌈x+n⌉=⌈x⌉+n,{x+n}={x}. The above are never true if n is not an integer; however, for every x and y, the following inequalities hold: ⌊x⌋+⌊y⌋≤⌊x+y⌋≤⌊x⌋+⌊y⌋+1,⌈x⌉+⌈y⌉−1≤⌈x+y⌉≤⌈x⌉+⌈y⌉.

Monotonicity Both floor and ceiling functions are monotonically non-decreasing functions: x1≤x2⇒⌊x1⌋≤⌊x2⌋,x1≤x2⇒⌈x1⌉≤⌈x2⌉.

Relations among the functions It is clear from the definitions that ⌊x⌋≤⌈x⌉, with equality if and only if x is an integer, i.e. ⌈x⌉−⌊x⌋={0 if x∈ℤ1 if x∉ℤ In fact, for integers n, both floor and ceiling functions are the identity: ⌊n⌋=⌈n⌉=n. Negating the argument switches floor and ceiling and changes the sign: ⌊x⌋+⌈−x⌉=0−⌊x⌋=⌈−x⌉−⌈x⌉=⌊−x⌋ and: ⌊x⌋+⌊−x⌋={0if x∈ℤ−1if x∉ℤ, ⌈x⌉+⌈−x⌉={0if x∈ℤ1if x∉ℤ. Negating the argument complements the fractional part: {x}+{−x}={0if x∈ℤ1if x∉ℤ. The floor, ceiling, and fractional part functions are idempotent: ⌊⌊x⌋⌋=⌊x⌋,⌈⌈x⌉⌉=⌈x⌉,{{x}}={x}. The result of nested floor or ceiling functions is the innermost function: ⌊⌈x⌉⌋=⌈x⌉,⌈⌊x⌋⌉=⌊x⌋ due to the identity property for integers.

Quotients If m and n are integers and n ≠ 0, 0≤{mn}≤1−1|n|. If n is positive ⌊x+mn⌋=⌊⌊x⌋+mn⌋, ⌈x+mn⌉=⌈⌈x⌉+mn⌉. If m is positive n=⌈n1m⌉+⌈n−1m⌉+⋯+⌈n−m+1m⌉, n=⌊n1m⌋+⌊n+1m⌋+⋯+⌊n+m−1m⌋. For m = 2 these imply n=⌊n12⌋+⌈n12⌉. More generally, for positive m (See Hermite's identity) ⌈mx⌉=⌈x⌉+⌈x−1m⌉+⋯+⌈x−m−1m⌉, ⌊mx⌋=⌊x⌋+⌊x+1m⌋+⋯+⌊x+m−1m⌋. The following can be used to convert floors to ceilings and vice versa (with m being positive) ⌈n1m⌉=⌊n+m−1m⌋=⌊n−1m⌋+1, ⌊n1m⌋=⌈n−m+1m⌉=⌈n+1m⌉−1, For all m and n strictly positive integers: ∑k=1n−1⌊kmn⌋=(m−1)(n−1)+gcd⁡(m,n)−12, which, for positive and coprime m and n, reduces to ∑k=1n−1⌊kmn⌋=12(m−1)(n−1), and similarly for the ceiling and fractional part functions (still for positive and coprime m and n), ∑k=1n−1⌈kmn⌉=12(m+1)(n−1), ∑k=1n−1{kmn}=12(n−1).

Since the right-hand side of the general case is symmetrical in m and n, this implies that ⌊m1n⌋+⌊2mn⌋+⋯+⌊(n−1)mn⌋=⌊n1m⌋+⌊2nm⌋+⋯+⌊(m−1)nm⌋. More generally, if m and n are positive, ⌊x1n⌋+⌊m+xn⌋+⌊2m+xn⌋+⋯+⌊(n−1)m+xn⌋=⌊x1m⌋+⌊n+xm⌋+⌊2n+xm⌋+⋯+⌊(m−1)n+xm⌋. This is sometimes called a reciprocity law. Division by positive integers gives rise to an interesting and sometimes useful property. Assuming m,n>0, m≤⌊xn⌋⟺n≤⌊xm⌋⟺n≤⌊x⌋m. Similarly, m≥⌈xn⌉⟺n≥⌈xm⌉⟺n≥⌈x⌉m. Indeed, m≤⌊xn⌋⟹m≤xn⟹n≤xm⟹n≤⌊xm⌋⟹…⟹m≤⌊xn⌋, keeping in mind that ⌊xn⌋=⌊⌊x⌋n⌋. The second equivalence involving the ceiling function can be proved similarly. For d being a positive integer with x greater than d. Then {xd}={x}+rd and ⌊xd⌋=⌊x⌋−rd, where 0≤r≤d−1 is the remainder of dividing ⌊x⌋ by d

Nested divisions For a positive integer n, and arbitrary real numbers m and x: ⌊⌊xm⌋n⌋=⌊xmn⌋⌈⌈xm⌉n⌉=⌈xmn⌉.

… excerpt ends here. Continue reading the full article.

Illustrations

Floor and ceiling functions illustration
Floor and ceiling functions illustration
Floor and ceiling functions: int function from floating-point conversion in C
int function from floating-point conversion in C

Worked examples

Example 1 — a first encounter with Floor and ceiling functions

Start with the simplest possible case. Write down what Floor and ceiling functions claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Floor and ceiling functions before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Floor and ceiling functions ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Floor and ceiling functions

In research
Floor and ceiling functions appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Floor and ceiling functions in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Floor and ceiling functions is common in secondary-school and first-year university syllabi. It links to neighbouring topics Mathematical notation, Special functions, Unary operations, so understanding it makes those chapters shorter.
In everyday life
Look for Floor and ceiling functions outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Floor and ceiling functions” →

How to study Floor and ceiling functions in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Floor and ceiling functions means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Floor and ceiling functions out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Floor and ceiling functions in simple terms?

In mathematics, the floor function is the function that takes a real number x as input and returns the greatest integer less than or equal to x, written ⌊x⌋ or floor(x). Similarly, the ceiling function returns the least integer greater than or equal to x, written ⌈x⌉ or ceil(x).

Why does Floor and ceiling functions matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Floor and ceiling functions?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Floor and ceiling functions.

Tags

  • Mathematical notation
  • Special functions
  • Unary operations

Keep exploring