Floors and Ceilings
Floors and ceilings: definitions, defining inequalities, identities and counting
Two definitions, and why the wording matters
For a real number x, the floor ⌊x⌋ is the greatest integer that is less than or equal to x, and the ceiling ⌈x⌉ is the least integer that is greater than or equal to x. Both functions map R to Z; neither is injective, since every value is attained on a whole interval.
Read the definitions as instructions about position on the number line rather than as instructions about digits. Floor moves left (down) to the nearest integer, ceiling moves right (up).
For positive numbers this coincides with chopping off the decimal part, which is exactly why so many students get negatives wrong: truncation moves toward zero, and toward zero is right for a negative number, so truncating a negative computes the ceiling, not the floor.
- ⌊5.8⌋=5 and ⌈5.8⌉=6.
- ⌊−4.3⌋=−5 and ⌈−4.3⌉=−4. Note that −5<−4.3, so −5 really is the largest integer at or below −4.3; −4 is above it.
- ⌊9⌋=⌈9⌉=9. At an integer the two functions agree, and this is the only situation in which they do.
The defining inequalities
Most floor and ceiling problems become routine once you replace the bracket notation with an inequality. For an integer n:
- ⌊x⌋=n exactly when n≤x<n+1.
- ⌈x⌉=n exactly when n−1<x≤n.
Watch which endpoint is included. The floor condition is closed on the left and open on the right; the ceiling condition is the reverse. That asymmetry is not decoration, it is what makes each function single-valued at the integers.
Two consequences are used constantly: x−1<⌊x⌋≤x and x≤⌈x⌉<x+1. In words, each bracket function stays within one unit of x, on the stated side.
Worked example. Solve ⌊x⌋=7. By the defining inequality, the solution set is the interval 7≤x<8, that is [7,8). It is an interval, not a single number. Compare ⌈x⌉=7, whose solution set is (6,7], a different interval, with the inclusion at the other end.
Identities: which ones survive every real number
Let n denote an integer and x,y arbitrary real numbers. A handful of relations hold universally, and many plausible-looking ones do not.
Statement | Status | Reason or counterexample |
|---|---|---|
⌊x+n⌋=⌊x⌋+n | Always true | An integer shift slides the defining interval without changing the fractional part |
⌈x+n⌉=⌈x⌉+n | Always true | The same argument applied to the ceiling's defining inequality |
⌊x⌋+⌊y⌋≤⌊x+y⌋≤⌊x⌋+⌊y⌋+1 | Always true | The discarded fractional parts sum to less than 2, so at most one unit carries |
⌊x⌋+⌊−x⌋=0 | Only when x∈Z | At x=2.4 the sum is 2+(−3)=−1, not 0 |
⌊x+y⌋=⌊x⌋+⌊y⌋ | Not always | At x=y=0.6: the left side is 1, the right side is 0 |
A pattern is visible in these rows. Floor and ceiling commute with adding an integer, because a whole-unit shift cannot change where x sits within its unit interval. They do not commute with adding an arbitrary real or with multiplying, because those operations alter the fractional part, which can then carry into the integer part.
How to test a proposed identity
Given a candidate relation, do not try to prove it first. Try to break it, using a short list of deliberately awkward values.
- An integer, such as x=4. Floor and ceiling coincide there and nowhere else, so any relation that treats them as differing will fail at exactly these points. This is the single most productive test.
- A half-integer, such as x=0.5. Doubling carries the fractional part across a boundary, which breaks relations that assume the bracket functions are linear.
- A negative non-integer, such as x=−4.3. This catches any argument that silently assumed truncation, since truncation moves toward zero and floor moves away from it.
- A second variable, as with x=y=0.6. Two fractional parts that sum past 1 defeat relations that assume additivity.
If a candidate survives all four, then look for a proof. One further technique is worth having: floor and ceiling are related to each other by reflection through 0, since negating a number exchanges what lies above it with what lies below.
Applying −1 to a floor's defining inequality and reversing the direction of the inequalities will produce a ceiling statement, and it is worth carrying out that manipulation yourself to see which identity it yields.
Proving a floor identity: the fractional-part method
Nearly every identity in this topic is proved the same way. Write x=m+f where m=⌊x⌋∈Z and the fractional part satisfies 0≤f<1. Then handle the cases into which f falls.
For instance, to show ⌊x+n⌋=⌊x⌋+n for integer n: from m≤x<m+1, adding n gives m+n≤x+n<m+n+1. Since m+n is an integer, the defining inequality identifies it as ⌊x+n⌋, which is ⌊x⌋+n. Notice the whole proof is the definition applied twice; no case split is needed here because the shift is by a whole unit.
Counting with floors and ceilings
The two most useful applications in a discrete mathematics course are counting and packing.
Counting multiples. The number of positive multiples of d that do not exceed N is ⌊N/d⌋, because those multiples are d,2d,…,kd with k the largest integer satisfying kd≤N, i.e. k≤N/d. For example, the multiples of 6 up to 250 number ⌊250/6⌋=⌊41.67⌋=41, and the check is that 6×41=246≤250 while 6×42=252 overshoots.
Packing. When items must be distributed into groups of fixed capacity and no item may be left over, the number of groups is a ceiling. If 290 delegates must travel in coaches seating 24, the requirement is ⌈290/24⌉=⌈12.083⌉=13 coaches.
Twelve coaches seat only 288. Floor would answer 12 and strand two people; the choice between the two functions is a modelling decision, decided by asking whether a partial group is acceptable.
Errors worth rehearsing
- Truncating negatives. ⌊−4.3⌋ is −5, not −4. Sketch the number line if in doubt.
- Rounding. Neither function rounds to nearest. ⌊5.8⌋=5, even though 5.8 is much closer to 6.
- Treating ⌊x⌋=n as an equation with one solution. Its solution set is always a half-open interval of length 1.
- Skipping the integer case. Many relations between floor and ceiling behave differently when x happens to be an integer, and that is where a careless argument usually breaks. Test it separately, every time.
A university must run a compulsory safety briefing for all 371 enrolled students. The lecture hall seats 48 students, and every student must attend one of the sittings.
What is the smallest number of sittings that will accommodate all the students?
Give your answer in sittings.
Which of the following statements is true for every real number x?