A piecewise function is useful when one situation cannot be described well by one formula. The domain is split into intervals, and each interval uses its own rule.
For example, electricity cost can be cheaper for the first usage tier and more expensive after a certain boundary. A boundary like this is a sign that the model should be written in pieces.
A linear piecewise function uses a linear function on each interval. This form often appears when the rate of change is constant for a while, then changes after a certain point.
Linear Piecewise Function
Example of a linear piecewise function with three different pieces.
The function above can be written as:
f(x)=⎩⎨⎧2x+3,−x+3,0.5x,if −2≤x<0if 0≤x<2if x≥2
The three rows are not three separate functions. They work together as one function, and the chosen formula depends on the value of x.
A piecewise function is continuous if the graph does not jump at a connection point. The value from the left, the value from the right, and the function value at that point must match.
Many real-world situations can be modeled with piecewise functions because their rules change after certain boundaries. Progressive taxes, tiered parking fees, and tiered electricity rates are common examples.
The number 50,000 in the second row comes from the first 50 kWh. The number 125,000 in the third row comes from the cost up to the first 100 kWh. This keeps the cost from restarting at 0 when the usage enters a new interval.
The constants 2.5 and 17.5 keep the total distance moving forward from the last position, instead of returning to 0 when the transportation mode changes.