Piecewise and Step Functions
Define, evaluate, and graph piecewise functions including the floor and ceiling functions. Identify where a piecewise function is continuous or discontinuous and write piecewise definitions from graphs.
A lesson of Pre-Calculus, in Functions and Their Graphs, about 10 minutes.
By the end of this lesson, you will be able to evaluate, graph, and write piecewise functions; identify continuity and discontinuities; and work with the floor/ceiling (greatest integer) function.
The Big Idea
A piecewise function is defined by different rules on different parts of the domain. This is not a limitation — it's the most honest way to model real-world situations where behavior changes: tax brackets, shipping rates, blood pressure responses, piecewise physical models. Understanding piecewise functions is essential for calculus, where limits require analyzing behavior from both sides.
Piecewise Function Notation
$$f(x) = \begin{cases} g(x) & \text{if } x < a \ h(x) & \text{if } x \geq a \end{cases}$$
The rules apply in their stated domains. At boundaries, only one rule applies.
Example 1 — Evaluating a Piecewise Function
$$f(x) = \begin{cases} x^2 - 1 & \text{if } x < 2 \ 3x + 1 & \text{if } x \geq 2 \end{cases}$$
$f(-3) = (-3)^2 - 1 = 8$ (use top rule, $-3 < 2$)
$f(2) = 3(2) + 1 = 7$ (use bottom rule, $2 \geq 2$)
$f(5) = 3(5) + 1 = 16$
Graphing Piecewise Functions
- Graph each piece on its domain only
- Use open circle at endpoints excluded from the rule
- Use closed circle at endpoints included
For Example 1:
- Parabola $y = x^2 - 1$ for $x < 2$ — open circle at $(2, 3)$
- Line $y = 3x + 1$ for $x \geq 2$ — closed circle at $(2, 7)$
Continuity in Piecewise Functions
A piecewise function is continuous at the boundary $x = a$ if:
$$\lim_{x \to a^-} f(x) = \lim_{x \to a^+} f(x) = f(a)$$
In Example 1 at $x = 2$: left-hand limit = 3, right value = 7 → discontinuous (jump discontinuity).
Example 2 — Finding the Value for Continuity
Make $f$ continuous at $x = 1$:
$$f(x) = \begin{cases} 2x + k & x < 1 \ x^2 + 3 & x \geq 1 \end{cases}$$
For continuity: $\lim_{x \to 1^-} = f(1)$
Left: $2(1) + k = 2 + k$; Right: $1 + 3 = 4$
$2 + k = 4 \implies k = 2$
Absolute Value as Piecewise
$$|x| = \begin{cases} x & x \geq 0 \ -x & x < 0 \end{cases}$$