y=xy = \lceil x \rceil

Graph of the Ceiling Function y=xy = \lceil x \rceil

y=xy = \lceil x \rceil is called the ceiling function, and it returns the smallest integer that is at least xx1. The symbol  \lceil\ \rceil suggests a ceiling, and the function is the counterpart of the floor function x\lfloor x \rfloor.

xxx\lceil x \rceil
2222
2.12.133
2.92.933
1.2-1.21-1

An integer is returned unchanged, and anything else is rounded up to the next integer. For negative numbers the rounding goes toward 00, that is to the right along the number line.

Domain and range

The domain is all real numbers and the range is the set of all integers. The graph is a staircase of horizontal segments at integer heights.

IntervalValue
(1,0](-1, 0]00
(0,1](0, 1]11
(1,2](1, 2]22

Each step has width 11 and includes its right end, the integer point, while excluding its left end. Which end is included is exactly the reverse of the floor function.

Discontinuities and jumps

The function is discontinuous at every integer. At an integer nn the limit from the left is nn and the value is nn too, so it is continuous from the left; but the moment xx passes nn the value leaps to n+1n+1. The jump is always of size 11.

The ceiling function is left-continuous, in contrast to the floor function, which is right-continuous.

Relation to the floor function

The two are related by a reversal of sign.

x=x\lceil x \rceil = -\lfloor -x \rfloor

Moreover x=x+1\lceil x \rceil = \lfloor x \rfloor + 1 when xx is not an integer, and the two agree when it is. Given the floor function, the ceiling function follows at once.

xxx\lfloor x \rfloorx\lceil x \rceilxx\lceil x \rceil - \lfloor x \rfloor
2.32.3223311
1.2-1.22-21-111
33333300

Applications

The number of boxes needed to pack nn items kk at a time is found by rounding up.

nk\left\lceil \frac{n}{k} \right\rceil

Packing 1717 items five to a box, for instance, takes 44 boxes.

  • The number of boxes or buses required
  • The number of pages needed
  • The number of memory blocks to allocate

Rounding up is always the right choice in such settings, so that the last, partly filled unit is not overlooked.

  1. Floor and ceiling functions, Wikipedia