How to Graph Piecewise Functions
A piecewise function uses different rules on different parts of its domain. The mathematics is no harder than the pieces it is built from; what makes them fiddly is the boundaries, where a single filled or hollow circle changes the answer.
What the notation says
A piecewise definition is a list of rules, each with a condition:
f(x) = x + 3whenx < 1
f(x) = x²whenx ≥ 1
Read it as an instruction. Given an x, check the conditions
from the top, and use the first rule whose condition is satisfied. At
x = 0 the first applies, giving 3. At x = 2 the
second applies, giving 4.
The conditions must cover the whole domain and must not overlap. If two
rules both claimed x = 1 and disagreed about the answer, it
would not be a function at all.
Drawing one, step by step
Graph the function above.
- Take one piece at a time. Ignore the conditions for a
moment and picture
y = x + 3as a whole line, andy = x²as a whole parabola. - Keep only the part the condition allows. Draw the line
only to the left of
x = 1, and the parabola only fromx = 1rightwards. - Work out the boundary values. The line approaches
1 + 3 = 4; the parabola starts at1² = 1. - Mark the endpoints. The condition on the line is
x < 1, strict, so(1, 4)gets an open circle. The condition on the parabola isx ≥ 1, so(1, 1)gets a filled one. - Leave the gap. The function jumps from near 4 to 1 at
x = 1, and nothing is drawn in between.
Open and closed endpoints
This is where most of the marks are, and the rule is short:
| Condition | Endpoint | Draw |
|---|---|---|
x < a or x > a | Excluded | Open circle |
x ≤ a or x ≥ a | Included | Filled circle |
At every boundary exactly one of the two pieces owns the point, so you should end up with exactly one filled circle and, if the pieces disagree, one open circle directly above or below it.
Continuous, jump and removable
What happens at the boundary has a name, and questions often ask for it.
Continuous
Both pieces arrive at the same value, so the graph joins smoothly and you
could draw it without lifting the pen. For
f(x) = 2x when x < 3 and
f(x) = x + 3 when x ≥ 3, both give 6 at the
boundary. Continuous.
Jump discontinuity
The two pieces arrive at different values, as in the first example. The function is defined at the boundary — the filled circle says which value it takes — but it leaps.
Removable discontinuity
Both pieces approach the same value, but the function is defined as something else at that single point, or not defined at all. The graph looks continuous apart from one misplaced dot. It is called removable because redefining that one point would fix it.
Typing one into the calculator
There are two ways, and both are worth knowing.
Braces with conditions
Write the whole thing in one expression:
{x < 1: x + 3, x >= 1: x^2}
Each branch is a condition, a colon, then the value. A final branch with no
condition acts as the catch-all:
{x > 0: ln(x), -ln(-x)}.
One expression per piece
Often clearer while you are learning. Type each piece on its own line with a restriction attached:
(x + 3){x < 1} on one line, x^2{x >= 1} on the next.
A restriction in braces evaluates to 1 where the condition holds and to undefined elsewhere, so multiplying by it keeps the curve only where you want it. As a bonus, each piece gets its own colour, which makes the structure obvious.
On endpoint dots: the calculator breaks the curve
correctly at each boundary, but it does not draw the open and filled
circles for you. Add a filled one yourself by typing the coordinate pair,
for example (1, 1), as its own expression.
Where they turn up in real problems
Piecewise functions are not an artificial exercise. They are how you model anything with a threshold.
- Tax brackets. A different rate applies to each band of income.
- Shipping costs. One price up to a weight, another above it.
- Phone plans. A flat fee until an allowance runs out, then a per-unit charge.
- Overtime pay. Standard rate to forty hours, higher rate beyond.
All four produce continuous piecewise functions, because the two rules agree at the threshold. A jump discontinuity in a pricing model usually signals a mistake in the pricing.
Questions
How do I know whether to use a filled or an open circle?
Look at the inequality. A strict inequality such as x < 2 excludes the endpoint, so draw an open circle. A non-strict one such as x ≤ 2 includes it, so fill the circle in.
Can both pieces be defined at the same x-value?
No, not if it is to be a function. Exactly one piece owns each x-value, which is why the conditions must not overlap. One piece uses < and the neighbouring one uses ≥, never both ≤.
Is a piecewise function still a function?
Yes, as long as each input produces exactly one output. It passes the vertical line test even though it is defined by several rules, because only one rule applies at each x.
Why should the two pieces not be joined at a jump?
Because the function takes no values in between. Drawing a vertical connector implies outputs that do not exist, and it would also fail the vertical line test.
Is the absolute value function piecewise?
Yes. |x| equals x when x is at least 0 and −x when x is negative. It is written compactly but it is a two-piece function, which is why its graph has a corner at the origin.