Domain and Range of Piecewise Functions
Find the domain and range of piecewise functions piece by piece: combine the intervals, watch endpoints and open circles, and union the ranges.
Domain and Range of Piecewise Functions
A student stares at a piecewise function: f(x) = { x+1 for x < 2; 4 for x = 2; x² for x > 2 }. They know how to plug in numbers but cannot say what x-values are allowed or what y-values come out. finding the domain and range of piecewise functions by treating each piece separately and combining the results requires the domain to be the union of the x-intervals where each piece is defined. The range is the union of the y-values each piece produces over its own interval. Open and closed dots at the boundaries determine whether an endpoint is included. Step functions and absolute value functions are just piecewise functions in disguise, and the method is shown with three worked examples and graphs. The rules come from OpenStax Precalculus 2e, Section 3.2 'Domain and Range', and the function notation from Section 3.1 'Functions and Function Notation'.
Piecewise Function Domain: The Union of Intervals
The piecewise function domain is the set of x-values where any piece of the function applies. You find it by taking every x-interval listed in the function definition and combining them with a union symbol (∪).
For example, a function defined on x < 0, 0 ≤ x < 3, and x ≥ 3 has the domain (-∞, 0) ∪ [0, 3) ∪ [3, ∞). That simplifies to (-∞, ∞) because the intervals cover all real numbers without gaps. A function defined on x ≤ 1 and x > 4 has the domain (-∞, 1] ∪ (4, ∞). The gap between 1 and 4 is excluded.
The most common failure mode is forgetting the union symbol. A student writes (-∞, 1], (4, ∞) as two separate intervals and calls it done. That is not a domain. It is two fragments. The union symbol is what makes it one set.
How to Check Your Work
Pick a test point from each interval. Plug it into the correct piece. If the function gives a real number, the interval belongs in the domain. If the function is undefined at that point (denominator zero inside a piece, for example), that x is excluded.
This is the same method you use when finding a domain range from graph: look at which x-values the graph covers. But here you must also check the boundaries where the pieces switch, because a closed dot includes the endpoint and an open dot excludes it.
Range of Piecewise Function: Evaluate Each Piece
The range of piecewise function is the set of y-values that the function can output. You find the range by evaluating each piece over its own x-interval, then taking the union of those y-value sets.
For a linear piece like f(x) = 2x + 1 on the interval [0, 3], the y-values run from f(0) = 1 to f(3) = 7, so the range for that piece is [1, 7]. For a constant piece like f(x) = 5 on the interval (3, 5), the range for that piece is just {5}. The union of [1, 7] and {5} is [1, 7], because 5 is already inside that interval.
A frequent error is assuming the range is always 'all real numbers'. That is true for linear functions that cover an infinite x-interval, but false for piecewise functions with bounded pieces. Check the vertex of any quadratic piece and the asymptotes of any rational piece.
When the Range Has Gaps
If one piece produces y-values from 1 to 3 and a second piece produces y-values from 7 to 9, the range is [1, 3] ∪ [7, 9]. The gap from 3 to 7 is missing since no input gives those y-values. This is common when the pieces do not connect at the boundaries.
Endpoints and Open/Closed Dots: What Changes the Range
An open dot at a boundary means the exact y-value at that x is not included in the range. A closed dot means it is. This distinction matters most when a piece ends at an open dot and the next piece begins at a closed dot at the same x-value.
Consider a function where f(x) = x + 1 for x < 2, with an open dot at (2, 3), and f(x) = 5 for x ≥ 2, with a closed dot at (2, 5). The y-value 3 is not in the range because the open dot excludes it. The y-value 5 is in the range. The step function range often has these jumps, where the function takes one value immediately after a boundary and the previous value is unreachable.
To verify, evaluate the function at the boundary x-value using the piece that applies at that point. If the piece has an open dot, the y-value is not in the range even if the x-value is in the domain. This is a common confusion pair: open vs closed intervals.
Step and Absolute Value Functions as Piecewise
A step function is a piecewise function where each piece is a constant. The domain is all real numbers (or a union of intervals), and the range is the set of those constant values. The greatest integer function f(x) = ⌊x⌋ is a step function: its range is all integers, and its domain is all real numbers.
An absolute value function is also piecewise: f(x) = |x| can be written as { -x for x < 0; x for x ≥ 0 }. Its domain is all real numbers. Its range is [0, ∞), which you can find by evaluating each piece: for x < 0, the outputs are positive; for x ≥ 0, the outputs are zero or positive.
The range of absolute value functions is [k, ∞) if the coefficient of the absolute value is positive, or (-∞, k] if negative. This comes from the vertex of the V-shape.
Worked Example 1: Two Linear Pieces
Function: f(x) = { 2x + 1 for x ≤ 3; -x + 7 for x > 3 }
Domain: The first piece covers x ≤ 3. The second covers x > 3. The union is (-∞, 3] ∪ (3, ∞) = (-∞, ∞). All real numbers are included because the intervals meet at 3.
Range: For the first piece on (-∞, 3], as x → -∞, y → -∞; at x = 3, y = 7. The range for this piece is (-∞, 7]. For the second piece on (3, ∞), as x → 3⁺, y → 4 (open dot at (3, 4)); as x → ∞, y → -∞. The range for this piece is (-∞, 4). The union of (-∞, 7] and (-∞, 4) is (-∞, 7].
Graph: The graph shows a rising line up to (3, 7) with a closed dot, then a falling line starting from just below (3, 4) with an open dot. The y-values go up to 7 and include 7, but never reach 4 from the second piece. The range is (-∞, 7].
Worked Example 2: A Quadratic and a Constant Piece
Function: f(x) = { x² for x < 0; 3 for x ≥ 0 }
Domain: The first piece covers (-∞, 0). The second covers [0, ∞). The union is (-∞, ∞).
Range: For the first piece on (-∞, 0), as x → -∞, y → ∞; as x → 0⁻, y → 0 (open dot at (0, 0) because x < 0). The range for this piece is (0, ∞). For the second piece on [0, ∞), the output is always 3. The range for this piece is {3}. The union of (0, ∞) and {3} is (0, ∞), because 3 is already in that interval.
Graph: A parabola opening upward for negative x, stopping at an open dot at (0, 0), then a horizontal line at y = 3 starting from a closed dot at (0, 3). The y-values are all positive numbers. Zero is not included because the open dot at (0, 0) excludes it.
Worked Example 3: Three Pieces with a Gap
Function: f(x) = { 1 for x < -2; x + 3 for -2 ≤ x < 1; -x + 5 for x > 1 }
Domain: The intervals are (-∞, -2), [-2, 1), and (1, ∞). The union is (-∞, -2) ∪ [-2, 1) ∪ (1, ∞) = (-∞, ∞). All real numbers are included; the gap at x = 1 is excluded because neither piece includes x = 1.
Range: For the first piece on (-∞, -2), the range is {1}.The range for this piece is [1, 4).The range for this piece is (-∞, 4). The union of {1}, [1, 4), and (-∞, 4) is (-∞, 4) because the closed dot at x = -2 gives y = 1, and the open dot at x = 1 gives a y-value of 4 that is not included, but the first piece includes y = 1. The y-value 4 is not in the range.
Graph: A horizontal line at y = 1 for x < -2 (open dot at (-2, 1) for this piece, but the second piece has a closed dot at (-2, 1), so the point is included). A rising line from (-2, 1) to (1, 4) with an open dot at (1, 4). A falling line from just below (1, 4) to -∞. The y-values go up to but not including 4, and down to -∞. The range is (-∞, 4).
Common Questions
How do I find the domain of a piecewise function that includes a rational expression?
Find the domain of each piece separately. For a rational piece, set the denominator not equal to zero and solve. Then intersect that result with the x-interval given for that piece. Finally, take the union of all valid intervals across all pieces.
What happens when a piecewise function has an open dot at the same x-value where another piece has a closed dot?
The closed dot includes that x-value in the domain, and the open dot does not. For the range, evaluate the piece with the closed dot at that x to get the y-value that is included. The y-value from the open dot piece is not included.
Can the range of a piecewise function be a single number?
Yes, if all pieces produce the same output value over their intervals. For example, f(x) = 5 on (-∞, 0) and f(x) = 5 on [0, ∞) has range {5}. This is a constant function written as a piecewise function.
How do I write the domain of a piecewise function with three or more intervals?
List each interval in increasing order of x. Connect them with the union symbol (∪). For example, (-∞, -1) ∪ [0, 2) ∪ (5, ∞). Use parentheses for open endpoints and brackets for closed endpoints. Do not omit the union symbol.
Why does my calculator show a different range for a piecewise function than I calculated?
Graphing calculators often do not show open dots clearly, and they may connect pieces that should not be connected. Check the table of values at the boundary x-values to see which y-values are actually produced. The calculator's default window may also hide parts of the range.