What Is a Piecewise Function?
A piecewise function is a function defined by different expressions for different parts of its domain. Instead of a single rule applying everywhere, they apply different formulas in multiple intervals.
A piecewise function is a function that “pieces together” multiple sub-functions. Each sub-function governs the output for specific input values. For example, they might use one formula for all negative numbers and another formula for all positive numbers. This flexibility makes them useful for describing real-world processes that change behavior at certain thresholds.
Example of a Piecewise Function
Imagine a taxi company that charges a flat fee of $5 for rides up to 2 miles, and then charges $2 per mile beyond 2 miles. This situation can be modeled by the following piecewise function:

Here:
- The first part, 5, applies when the distance x is 2 miles or less.
- The second part, 5 + 2(x – 2), applies when the distance is greater than 2 miles.
This function captures the real-world pricing structure: a fixed base fee for short rides and a per-mile rate for longer rides.
How to Graph Piecewise Functions
To graph a piecewise function, follow these steps:
- Identify the different rules and their corresponding domains.
- Graph each rule only over its specified interval.
- Pay attention to open and closed circles at boundary points, which show whether the boundary is included in that interval.
- Combine the pieces into a single graph.
These graphs often look “broken” or segmented because different formulas apply to different ranges of x-values.
The graph below depicts this piecewise function for the taxi fare example.

Key Characteristics
- Defined by two or more rules.
- Different rules apply to different intervals of the input.
- Graphs are created by combining the pieces.
- Useful in real-world scenarios with thresholds, limits, or conditional pricing.
In short, a piecewise function is a function that uses different rules for different ranges of inputs. Understanding how to graph them is essential for visualizing situations where relationships change depending on the input.
« Back to Glossary Index