Piecewise Linear Function
A piecewise linear function is a function built from two or more straight-line segments, each applying to a specific interval of the domain. The formula changes from one interval to the next, but every piece is a linear expression.
A piecewise linear function is defined by a set of linear expressions , each valid on a distinct interval of the domain. The overall function switches between these expressions at specified boundary points. The graph consists entirely of line segments (or rays), though the segments may or may not connect at the boundary points.
Key Formula
Where:
- = the slope of the line segment on the $i$-th interval
- = the y-intercept of the linear expression on the $i$-th interval
- = the boundary points where the function switches between expressions
Worked Example
Problem: Evaluate the piecewise linear function at , , and :
Step 1: For : since , use the first piece.
Step 2: For : since , use the second piece.
Step 3: For : since , use the third piece.
Step 4: Check continuity at the boundary points. At : the first piece gives , and the second piece gives . They match, so the function is continuous there. At : the second piece gives , and the third piece gives . They match as well.
Answer: , , and . The function is continuous at both boundary points.
Visualization
Why It Matters
Piecewise linear functions model situations where a rate changes abruptly. Tax brackets, for instance, apply different rates to different income ranges — each bracket is a separate linear segment. In data science and computer graphics, smooth curves are often approximated by chains of short line segments, which is exactly what a piecewise linear function describes.
Common Mistakes
Mistake: Using the wrong piece for a boundary point
Correction: Pay close attention to whether each interval uses or . The inequality symbols tell you exactly which formula applies at the boundary. Only one piece should cover each boundary value.
Mistake: Assuming the function must be continuous
Correction: Piecewise linear functions can have jumps. The segments do not have to connect at boundary points — always check by plugging the boundary value into both adjacent pieces.
