A piecewise function uses different formulas for different parts of its domain. The conditions are part of the definition: each permitted input must receive one unambiguous output.
Using non-overlapping conditions makes the choice of rule straightforward. If conditions overlap, every applicable formula must agree at the overlap; otherwise the definition does not describe a function.
On this page (8 sections)
Reading a piecewise definition
Choose the rule using the input condition before doing any calculation.
| Input | Applicable rule | Output |
|---|---|---|
The domain is the union of the two allowed input sets, which is all real numbers here. The formulas are alternatives; do not add them or apply both in succession.
Evaluating at a boundary
At , the condition includes equality, so the point belongs to the graph. The first branch is restricted to , so its limiting point is open.
Graph each rule only on its own inputs
- for
- for
Diagram explained
At zero, the second rule applies. The first rule approaches output 2 from the left but never assigns that endpoint. The graph therefore has a jump at zero.
| Input | Output |
|---|---|
Plot each formula only on the inputs named by its condition. Drawing the entire parabola and the entire line would represent extra pairs that do not belong to this function.
Piecewise functions can be continuous or discontinuous
A change of formula does not automatically create a break. In this example, the line approaches output as inputs approach zero from the left, while the parabola approaches from the right. The assigned value is , so the pieces do not join continuously.
By contrast, the two branches in the absolute-value definition below both meet at . Continuity concerns whether the outputs join, not whether the printed formula changes. A formal limit-based treatment appears in Continuity of Functions.
Absolute value is piecewise
For a negative input, is positive: at , it equals . For a non-negative input, the output is the input itself. Both branches therefore express distance from zero.
The two branches of the absolute-value function

The two branches of the absolute-value function · Qef, after Ævar Arnfjörð Bjarmason · CC BY-SA 3.0. Typography normalized; drawing unchanged.
Diagram explained
At inputs −2 and 2, the common output is 2. At input 0, the output is 0. Every input has one output, even though the graph uses two formulas. The two pieces meet continuously.
Piecewise models
A hypothetical parking charge
Let be parking time in hours. Suppose up to two hours costs dollars and each additional hour is charged proportionally at dollars per hour. For :
Then and . The extra charge uses , not , because the first two hours are already included. At the threshold, both formulas give , so the model joins continuously.
Charging for each started hour would require a different step rule. The conditions and billing convention must be specified; the formula alone does not determine them.
Practice questions
For the displayed piecewise function, find .
Find .
Find .
Check your answers
, so use the first rule: .
Use the rule that includes equality at zero: .
, so .
Related topics
Study the distance interpretation in Absolute Value Functions; use Domain and Range to combine the allowed intervals.
Sources and further reading
- OpenStax: Piecewise definitions and domains. Definitions, conventions and related examples.
- OpenStax Precalculus 2e. Functions, transformations, inverse functions and function families.
- Wolfram Language: FunctionDomain. Domain conventions and symbolic domain checks.
- Wolfram Language: FunctionRange. Range conventions and symbolic range checks.
