Category: Functions Level: 201
f(x) = x + 4 (x < -1), 1 (-1 ≤ x ≤ 2), x - 3 (x > 2)
A piecewise function uses different rules on different stretches of x. Solid dots mark endpoints that belong to a piece, and hollow dots mark endpoints that do not.
The rule changes at x = −1 and at x = 2. Those two cuts split the x-axis into three stretches, and each stretch gets its own rule.
cuts at x = -1 and x = 2
Left of −1, f(x) = x + 4. The line would reach 3 at x = −1, but −1 is not in this piece, so the end gets a hollow dot.
x + 4 → 3 at x = -1, open end
From −1 to 2 the function is flat at 1. Both ends belong to this piece, so both get solid dots.
f(x) = 1 on -1 ≤ x ≤ 2
Right of 2, f(x) = x − 3. It starts just above x = 2 at height −1, so that end is hollow too.
x - 3 → -1 at x = 2, open end
At a cut, use the solid dot. So f(−1) = 1, not 3, and f(2) = 1, not −1. A vertical line at a cut hits one solid dot, so f is still a function.
f(-1) = 1, f(2) = 1, f(5) = 2
cd svg-generator python3 -m svgmath render piecewise-function --out /tmp/piecewise-function
Source: svgmath/diagrams/function_families.py