Step Function — Definition, Graph & Examples
Step Function
A function that has a graph resembling a staircase. Examples are the floor function (below) and the ceiling function.

Key Formula
f(x)=⎩⎨⎧c1,c2,⋮cn,if x∈I1if x∈I2if x∈In
Where:
- c1,c2,…,cn = Constant output values on each interval (the heights of each "step")
- I1,I2,…,In = Non-overlapping intervals that partition the domain of the function
- x = The input variable
Worked Example
Problem: Evaluate the floor function (a step function) at x = 3.7, x = −1.2, and x = 5.
Step 1: Recall the floor function definition. The floor of x, written ⌊x⌋, is the greatest integer less than or equal to x.
⌊x⌋=max{n∈Z:n≤x}
Step 2: Evaluate at x = 3.7. The greatest integer less than or equal to 3.7 is 3.
⌊3.7⌋=3
Step 3: Evaluate at x = −1.2. The greatest integer less than or equal to −1.2 is −2 (not −1, since −1 > −1.2 is false — actually −1 > −1.2 is true, so we need the greatest integer ≤ −1.2). Since −2 ≤ −1.2 and −1 > −1.2 is false (−1 is greater than −1.2), we get −2.
⌊−1.2⌋=−2
Step 4: Evaluate at x = 5. Since 5 is already an integer, the floor of 5 is simply 5.
⌊5⌋=5
Step 5: Notice the staircase pattern: the output stays constant across each interval [n, n+1) and then jumps by 1 at every integer. This is why the floor function is a step function.
⌊x⌋=nfor n≤x<n+1
Answer: ⌊3.7⌋ = 3, ⌊−1.2⌋ = −2, and ⌊5⌋ = 5. The graph of these values forms flat steps that jump at each integer.
Another Example
This example shows a real-world application of a step function (pricing), whereas the first example focused on the pure floor function definition.
Problem: A parking garage charges 2forthefirsthourand1 for each additional hour or part of an hour. Write and evaluate the cost function for t = 0.5, t = 1, t = 2.3, and t = 4 hours.
Step 1: Model the cost. For any time t > 0, you pay 2forthefirsthourplus1 for each additional hour or fraction thereof. The ceiling function ⌈x⌉ rounds up to the nearest integer, which captures "any part of an hour."
C(t)=2+1⋅max(⌈t⌉−1,0)
Step 2: Simplify: since ⌈t⌉ ≥ 1 for t > 0, the max is just ⌈t⌉ − 1.
C(t)=1+⌈t⌉for t>0
Step 3: Evaluate at t = 0.5. The ceiling of 0.5 is 1.
C(0.5)=1+⌈0.5⌉=1+1=2
Step 4: Evaluate at t = 1, t = 2.3, and t = 4.
C(1)=1+1=2,C(2.3)=1+3=4,C(4)=1+4=5
Step 5: The cost stays flat within each hour interval and jumps up by $1 at each whole hour — a classic step function in a real-world setting.
Answer: C(0.5) = 2,C(1)=2, C(2.3) = 4,C(4)=5. The cost function is a step function that jumps at each integer hour.
Frequently Asked Questions
What is the difference between a step function and a piecewise function?
Every step function is a piecewise function, but not every piecewise function is a step function. A step function is specifically piecewise constant — the output is a fixed value on each interval. A general piecewise function can have linear, quadratic, or other non-constant pieces.
Is a step function continuous?
No. A step function is discontinuous at every point where it jumps from one constant value to another. At these jump points, the left-hand limit and right-hand limit differ, producing a jump discontinuity. Between jumps, the function is continuous.
When do you use step functions in real life?
Step functions model situations where a quantity changes in discrete jumps rather than smoothly. Common examples include postage rates (price jumps at each weight bracket), tax brackets, parking fees, and rounding operations in computing. Anywhere a value stays constant over an interval and then suddenly changes, a step function applies.
Floor Function ⌊x⌋ vs. Ceiling Function ⌈x⌉
| Floor Function ⌊x⌋ | Ceiling Function ⌈x⌉ | |
|---|---|---|
| Definition | Greatest integer ≤ x | Smallest integer ≥ x |
| Formula on integers | ⌊n⌋ = n for any integer n | ⌈n⌉ = n for any integer n |
| Example: x = 2.3 | ⌊2.3⌋ = 2 | ⌈2.3⌉ = 3 |
| Example: x = −2.3 | ⌊−2.3⌋ = −3 | ⌈−2.3⌉ = −2 |
| Direction of rounding | Always rounds down (toward −∞) | Always rounds up (toward +∞) |
| Relationship | ⌈x⌉ = −⌊−x⌋ | ⌊x⌋ = −⌈−x⌉ |
Why It Matters
Step functions appear in precalculus and calculus courses when you study piecewise functions, limits, and continuity — they provide the clearest examples of jump discontinuities. In advanced math and engineering, step functions (especially the Heaviside step function) are essential in signal processing and differential equations. Everyday applications like tax brackets, shipping rates, and digital signals are all modeled by step functions.
Common Mistakes
Mistake: Rounding negative numbers toward zero instead of toward −∞ when using the floor function.
Correction: The floor function always rounds down toward negative infinity. For example, ⌊−1.2⌋ = −2, not −1. Think of the number line: −2 is below −1.2, so that is the floor.
Mistake: Drawing the graph with slanted lines connecting the steps instead of horizontal segments with jump discontinuities.
Correction: A step function is constant on each interval. Draw flat horizontal segments, and use open/closed dots at each endpoint to show which value the function actually takes at the jump point.
Related Terms
- Function — A step function is a special type of function
- Floor Function — The most common example of a step function
- Ceiling Function — Rounds up; another classic step function
- Graph of an Equation or Inequality — Step function graphs show staircase patterns
- Piecewise Function — Step functions are piecewise constant functions
- Discontinuous — Step functions have jump discontinuities
- Greatest Integer Function — Another name for the floor function
