How to Graph Piecewise Functions
Learn how to graph piecewise functions step by step. Covers domain intervals, open and closed endpoints, continuity, and examples with two and three pieces.
What Is a Piecewise Function?
A piecewise function is defined by different formulas on different parts of its domain. Instead of a single equation covering all x-values, the function is split into pieces, each valid on a specific interval. For example, a piecewise function might equal x² when x < 0 and equal 2x + 1 when x ≥ 0. Each piece is a standard function, but the rule changes at specified boundary points called breakpoints. Piecewise functions model real-world situations where behavior genuinely changes at certain thresholds, such as tax brackets, parking rates, shipping costs, and electrical circuits with switching behavior.
Reading Piecewise Notation
A piecewise function is written using a brace notation that lists each formula alongside its domain restriction. The restrictions use inequalities: x < a, x ≤ a, x > a, x ≥ a, or a < x < b. You apply whichever formula matches the x-value you are evaluating. For example, given f(x) = {x + 1 for x < 2; 5 for x = 2; x² - 1 for x > 2}, to find f(0): since 0 < 2, use x + 1, giving 1. To find f(2): use the middle piece, giving 5. To find f(4): since 4 > 2, use x² - 1 = 15. It is essential to check which interval applies before substituting.
Open and Closed Endpoints
At each breakpoint, some pieces include the boundary (closed endpoint, indicated by a filled circle on the graph) and some exclude it (open endpoint, indicated by an open circle). If a restriction uses ≤ or ≥, the boundary point is included and drawn as a solid dot. If the restriction uses < or >, the boundary is excluded and drawn as an open dot. When two pieces share a breakpoint, one piece typically claims the point with a closed endpoint while the other shows an open endpoint, preventing any ambiguity about the function's value there. If both pieces give the same value at the breakpoint, the function is continuous at that point and you need only a single solid dot.
Continuity at Breakpoints
A piecewise function is continuous at a breakpoint x = a if the left piece and right piece both approach the same value as x approaches a, and the function value at a equals that limit. If the two pieces approach different values, there is a jump discontinuity at x = a. If the pieces meet but the function value at a is different from both limits, there is a removable discontinuity. For graphing, jump discontinuities appear as gaps between pieces (one piece ends at an open circle, the other begins at an open or closed circle at a different height). Continuity at all breakpoints means the pieces connect seamlessly into a single unbroken curve.
Step-by-Step Graphing Process
To graph a piecewise function, handle each piece separately. For each interval, identify the formula and its domain. Graph the formula only over that interval, as if you had a restricted version of a standard function. At each endpoint of the interval, draw either a solid dot (if the endpoint is included) or an open dot (if excluded). Repeat for every piece. When finished, you should have a complete graph composed of several segments or curves, each with proper endpoints, covering the entire domain of the piecewise function. Double-check that no two pieces both claim a solid dot at the same x-value with different y-values.
Example: Three-Piece Function
Consider f(x) = {-x for x < 0; 1 for 0 ≤ x < 3; (x-3)² + 1 for x ≥ 3}. For x < 0: graph the line y = -x restricted to x < 0. This is a ray starting from an open dot just to the left of the origin and increasing leftward. For 0 ≤ x < 3: graph the horizontal line y = 1 from x = 0 (solid dot) to x = 3 (open dot). For x ≥ 3: graph y = (x-3)² + 1 starting from x = 3 (solid dot at (3,1)) and curving upward. The function is continuous at x = 0 because both pieces give 1 there. At x = 3, the horizontal segment ends at an open dot at (3,1) and the parabola begins at a solid dot at (3,1), so the function is continuous there as well.
Real-World Examples of Piecewise Functions
Many everyday scenarios produce piecewise functions. A flat shipping rate up to 5 pounds, then a per-pound charge above that, is piecewise linear with a breakpoint at 5. The absolute value function itself is a classic piecewise function: |x| = -x for x < 0 and x for x ≥ 0. Progressive income tax brackets define a piecewise function where different marginal rates apply to different income ranges. The floor function (rounding down to the nearest integer) is an extreme piecewise function with infinitely many constant pieces, one for each unit interval. Recognizing piecewise structure in applied problems is as important as being able to graph the pieces.
Try These Calculators
Put what you learned into practice with these free calculators.
Try It Yourself
Put what you learned into practice with our free graphing calculator.
Related Guides
How to Graph Absolute Value Functions
Learn how to graph absolute value functions step by step. Covers the V-shape, vertex, reflections, stretches, and transformations of y = |x| with examples.
How to Graph Linear Equations
Learn how to graph linear equations using slope-intercept form, point-slope form, and two-point methods. Step-by-step guide with examples.
Graphing Calculator Tutorial - Complete Guide
Learn how to use the free online graphing calculator at ThePrimeCalculator. Enter equations, pan, zoom, add multiple graphs, pin points, and use 3D mode.