Split the domain into stretches, give each its own line, and mind the dots at the joints.
Some rules change partway through. A parking garage is free for the first half-hour, then charges by the hour; a phone plan is flat up to a data cap, then bills per gigabyte. One single formula can't capture a rule that switches, so we write it in pieces — a different line for each stretch of the domain, stitched together with one big brace. This lesson reads, writes, and graphs piecewise functions, minds the open and filled dots at the joints, and ends with the most famous two-piece function of all: absolute value.
Picture a parking garage: free for the first 30 minutes, then $2 per hour. For the first half-hour the cost is locked at $0 — no rule about a rate applies yet. After that, the cost climbs steadily at $2 an hour. Those are two different rules governing two different stretches of time, so one straight line cannot describe the whole story.
Try to force a single line through it and you'll be wrong on one stretch or the other: a line that's flat at 0 keeps the cost at 0 forever, and a line that rises from the start charges you before 30 minutes are up. The honest description needs a rule per stretch — flat at first, then rising.
When a rule changes partway, no single formula will do. Describe it in pieces: split the domain into stretches and give each stretch its own rule.
We collect the pieces under one big brace, and beside each rule we write the stretch of x it governs. Our running example for the rest of the lesson is
| x + 1 | if | x < 1 |
| 4 | if | 1 ≤ x < 3 |
| −x + 7 | if | x ≥ 3 |
The conditions on the right do all the bookkeeping. Notice that they tile the whole number line with no overlap and no gap: every real number x is less than 1, or between 1 and 3, or at least 3 — and never two of these at once. That is the whole requirement for a legal piecewise rule.
Every x must belong to exactly one piece — the conditions can't overlap and can't leave a gap. Mind which side of a boundary gets the ≤ and which gets the <: here x = 1 belongs to the middle piece (because 1 ≤ x), not to the first.
To graph a piecewise function, draw each piece only over its own stretch — a segment or a ray, never the whole infinite line. The interesting moments are the joints, where one stretch ends and the next begins. At a joint you must decide which piece includes the endpoint:
a filled dot marks the piece that owns the endpoint (its condition uses ≤ or ≥), and an open dot marks a piece that approaches but excludes it (its condition uses < or >).
Where the two pieces arrive at the same height, the graph is continuous — one filled dot is enough, the picture has no break. Where they arrive at different heights, there is a jump: an open dot at the height the lower piece never reaches, a filled dot at the height that is actually taken.
On our function, walk through the two joints. At x = 1: the left piece x + 1 climbs toward 2 but stops short (its condition is x < 1, so it never reaches x = 1) — an open dot at (1, 2); the middle piece is the constant 4 starting right at x = 1 — a filled dot at (1, 4). The two heights differ, so x = 1 is a jump. At x = 3: the middle piece sits at 4 and the right piece −x + 7 gives −3 + 7 = 4 too — same height, so the graph is continuous there.
At a joint, open = excluded, filled = included. Same height on both sides ⇒ continuous (one filled dot); different heights ⇒ a jump (open below, filled above).
Evaluating a piecewise function is a two-step move: first find which stretch x falls in, then use that stretch's rule. Reach for the wrong piece and you'll get a confident, wrong answer. Work the three sample inputs on our function:
f(0): since 0 < 1, use x + 1 → 0 + 1 = 1.
f(2): since 1 ≤ 2 < 3, use the constant 4 → 4.
f(5): since 5 ≥ 3, use −x + 7 → −5 + 7 = 2.
Check the boundary's ≤ / < before you pick the rule. Here f(1) = 4, not 2 — because x = 1 satisfies 1 ≤ x < 3 and so belongs to the middle piece.
The most famous piecewise rule of all is hiding in plain sight: absolute value. The number |x| keeps a number as-is when it's non-negative and flips its sign when it's negative. That is exactly a two-piece rule:
| x | if | x ≥ 0 |
| −x | if | x < 0 |
Graph the two pieces and you get a V: the ray y = x for x ≥ 0 climbing to the right, and the ray y = −x for x < 0 climbing to the left, meeting at the origin. Check a few values: |3| = 3, |−4| = 4, |0| = 0. And the same V can be slid sideways — y = |x − 2| is the very same V with its corner moved to sit at x = 2.
Absolute value is the simplest piecewise rule: |x| = x for x ≥ 0 and −x for x < 0. Its graph is a V stitched at the origin.
A piecewise function uses a different rule on each stretch of the domain, collected under one big brace. The conditions must tile the domain — every x lands in exactly one piece, with no overlap and no gap, so mind the ≤ versus < at every boundary.
To graph it, draw each piece only over its own stretch and decide the joints: a filled dot for the piece that owns the endpoint, an open dot for the piece that excludes it. Same height on both sides ⇒ continuous; different heights ⇒ a jump. To evaluate, first find the stretch x belongs to, then use that stretch's rule. And absolute value is the simplest piecewise function of all: |x| = x for x ≥ 0, −x for x < 0 — a V meeting at the origin. Next, in 21.7, we turn every linear idea loose on the real world.
f(−1): −1 < 1, so use x + 1 → −1 + 1 = 0. f(2): 1 ≤ 2 < 3, so the constant piece → 4. f(4): 4 ≥ 3, so −x + 7 → −4 + 7 = 3.
Yes. The left piece x + 1 approaches 2 (open dot, since x < 1 never reaches 1); the middle piece gives 4 (filled dot, since 1 ≤ x owns it). The heights 2 and 4 differ, so it's a jump — open at 2, filled at 4.
|x| = { x if x ≥ 0 ; −x if x < 0 }. When x is non-negative we keep it; when x is negative we flip its sign so the output is non-negative.
|−7| = 7 (−7 < 0, so flip the sign). For |6 − 10|, simplify inside first: 6 − 10 = −4, so |−4| = 4.
One filled dot. Both pieces reach the same height, so there's no jump — the graph is continuous at that joint, passing through it without a break.
Yes. Just before 30 minutes the cost is still $0, and the second rule starts charging from $0 at exactly 30 minutes — both pieces meet at the same height ($0), so there's no jump. (There is a kink, where the graph bends from flat to rising, but no break.)
Six questions to lock it in. Tap the answer you think is right.
This lesson introduces piecewise-defined functions as the natural next step once linear functions are fluent: a rule that switches partway needs a separate line on each stretch of the domain. It builds toward CCSS F-IF.C.7b (graph piecewise-defined functions, including step and absolute-value functions), F-IF.A.2 (evaluate functions, including piecewise, for inputs in their domains), and 6.NS.C.7c (absolute value as magnitude).
Three misconceptions to head off: (1) using the wrong piece at a boundary — students must read the ≤ versus < before choosing a rule; have them say aloud "x = 1 satisfies 1 ≤ x, so the middle piece owns it." (2) Drawing the whole line instead of just its stretch — each piece is a segment or ray, clipped to its interval. (3) Filling a dot that should be open at a jump — the open dot marks the height a piece approaches but never reaches. The two interactive figures let a learner walk x across the joints and watch the active piece, the dot type, and the computed value update together — the safest way to build the "find the stretch first, then apply its rule" habit.