piecewise function
A piecewise function uses different rules on different stretches of its domain, like a phone plan that charges one rate for the first hundred minutes and another rate after that. Which formula applies depends on where the input falls.
It is written as a single function with a brace listing several cases, each paired with the interval of inputs it governs. To evaluate it, first decide which interval your input belongs to, then apply the matching rule. The pieces must not overlap in a contradictory way: each input still gets exactly one output, or it would not be a function.
The absolute value is a familiar example in disguise: |x| equals x when x ≥ 0 and equals -x when x < 0. Piecewise functions can be continuous, joining smoothly at the boundaries, or they can jump — taxes, shipping costs, and step functions all jump where the rule changes.
f(x) = x for x ≥ 0 and f(x) = -x for x < 0 is exactly |x|; here f(-3) = 3 and f(2) = 2.
Absolute value as a piecewise rule.