Sub topic 7
Greatest-Integer and Ceiling Functions
Prerequisites and definitions
Assume you can work with inequalities, integers, and the number line. The greatest-integer function, also called the floor function, gives the greatest integer less than or equal to a number. It is written as
\[ \lfloor x \rfloor. \]
The ceiling function gives the least integer greater than or equal to a number. It is written as
\[ \lceil x \rceil. \]
For example,
\[ \lfloor 3.8 \rfloor=3,\qquad \lceil 3.8\rceil=4. \]
For an integer, both functions return the integer itself:
\[ \lfloor 5\rfloor=\lceil 5\rceil=5. \]
Negative numbers often cause mistakes. Since \(-2\) is the greatest integer less than or equal to \(-2.3\),
\[ \lfloor -2.3\rfloor=-3,\qquad \lceil -2.3\rceil=-2. \]
| Expression | Meaning | Value |
|---|---|---|
| \(\lfloor 4.6\rfloor\) | greatest integer \(\leq 4.6\) | \(4\) |
| \(\lceil 4.6\rceil\) | least integer \(\geq 4.6\) | \(5\) |
| \(\lfloor -1.2\rfloor\) | greatest integer \(\leq -1.2\) | \(-2\) |
| \(\lceil -1.2\rceil\) | least integer \(\geq -1.2\) | \(-1\) |
Graphs and intervals
The graph of \(y=\lfloor x\rfloor\) is a staircase. For every integer \(n\),
\[ \lfloor x\rfloor=n \quad \text{when} \quad n\leq x<n+1. \]
Thus, the horizontal segment at height \(n\) includes its left endpoint and excludes its right endpoint.
The graph of \(y=\lceil x\rceil\) follows the same staircase shape, but the endpoint convention is reversed:
\[ \lceil x\rceil=n \quad \text{when} \quad n-1<x\leq n. \]
At each jump, a floor graph has a closed point on the left and an open point on the right. A ceiling graph has an open point on the left and a closed point on the right.
Useful identities and errors
For every real number \(x\),
\[ \lceil x\rceil=-\lfloor -x\rfloor. \]
Also,
\[ \lfloor x\rfloor\leq x<\lfloor x\rfloor+1, \]
and
\[ \lceil x\rceil-1<x\leq\lceil x\rceil. \]
A common error is to truncate the decimal part toward zero. Truncating \(-2.3\) toward zero gives \(-2\), but
\[ \lfloor -2.3\rfloor=-3. \]
For an expression such as \(\lfloor 2x+1\rfloor=4\), convert the function equation into an inequality:
\[ 4\leq 2x+1<5. \]
Therefore,
\[ \frac32\leq x<2. \]
import math
print(math.floor(2.7))
print(math.floor(-2.3))
print(math.ceil(-2.3))Exercise
Solve \(\lceil 3x-2\rceil=5\).
Show answer
Use \(4<3x-2\leq5\). Hence \(6<3x\leq7\), so \(\boxed{2<x\leq\frac73}\).