Two rules that disagree
Take the piecewise function f(x) = x + 1 for x < 2, and f(x) = 6 − x for . Its graph is made of two straight pieces, one for each rule.
Work out some values of the first rule. At x = −1, 0 and 1, x + 1 gives 0, 1 and 2. Closer to the boundary, x = 1.9 gives 2.9 and x = 1.99 gives 2.99. As x comes closer to 2, the value comes closer to 3, but x = 2 itself is not in the piece x < 2, so this rule never gives the value 3.
The second rule starts at the boundary. At x = 2, 3, 4 and 5, 6 − x gives 4, 3, 2 and 1. So at x = 2 the first rule is heading for 3 while the second rule gives 4. The rules disagree at the boundary.
Each rule only over its own inputs
The rule x + 1 is the equation of a whole straight line, y = x + 1. But f uses that rule only for x < 2, so only the part of the line to the left of x = 2 belongs to the graph of f. The same is true of y = 6 − x, which belongs to the graph only from x = 2 to the right.
So draw each piece only across its own interval of inputs, and stop it at the boundary. Where the two pieces reach x = 2 at different heights, the graph has a break: it jumps from one piece to the other.
The line y = x + 1. The gold part, left of x = 2, is the first piece of f. The white part, from x = 2 on, is the rest of the line, which f does not use. The gold piece stops at a hollow dot at (2, 3).
Filled dots and hollow dots
The end of each piece at the boundary is drawn with a dot. A filled dot means the point is on the graph. A hollow dot, an open circle, means the point is not on the graph: the piece comes as close to it as you like but does not include it.
Read the dots from the inequalities. The first piece is for x < 2, and the strict < leaves 2 out, so its end, (2, 3), is a hollow dot. The second piece is for , and includes 2, so its end, (2, 4), is a filled dot. So f(2) = 4, which is also what the rule 6 − x gives: 6 − 2 = 4.
The graph of f. The left piece ends in a hollow dot at (2, 3), and the right piece starts from a filled dot at (2, 4), so f(2) = 4.
One point above each input
A function gives each input exactly one output, so above each value of x its graph has at most one point. Put another way, any vertical line meets the graph of a function at most once. This is called the vertical line test.
At the boundary, the vertical line x = 2 passes through both dots, but only the filled dot, (2, 4), is on the graph, so the line meets the graph once. If both dots were filled, the line would meet the graph twice, and f(2) would be both 3 and 4. If both were hollow, the line would miss the graph, and f(2) would have no value. One filled dot and one hollow dot is what "exactly one output at x = 2" looks like.
x = 2.5 > 1: the second rule is in charge, f(x) = 5 − x = 2.5, and the first line is not consulted
Drag x to exactly 1 and read which rule owns it
This function is 2x + 1 for x < 1 and 5 − x for . Its left piece ends in a hollow dot at (1, 3) and its right piece starts from a filled dot at (1, 4). Press the button marked to give the "or equal to" to the first rule instead: the dots swap, (1, 3) is filled and (1, 4) is hollow, and f(1) becomes 3. Drag x to 1 to read which rule owns it.
When the pieces meet
Change the second rule from 6 − x to 5 − x. At x = 2 it now gives 5 − 2 = 3, the same height that the first piece is heading for. The filled dot of the second piece lands exactly on the hollow end of the first, and fills it, so the graph has no break: it can be drawn without lifting the pen.
Whether two pieces meet depends on one comparison: the value each rule gives at the boundary. Here x + 1 and 5 − x both give 3 at x = 2. Looking ahead: choosing a number in one rule so that the two values agree is how a piecewise function is made continuous, with no break in its graph.
With 5 − x as the second rule, both pieces reach (2, 3), and the graph runs through without a break.
A function in three pieces
The method is the same for any number of pieces. Take g(x) = 1 for x < 1, g(x) = x + 1 for , and g(x) = 2 for . For each piece, work out the value at each end of its interval, draw the piece over that interval only, and choose each end's dot from its inequality.
The first piece is the flat line y = 1, up to a hollow dot at (1, 1). The middle piece starts at x = 1 with a filled dot, because of the , at 1 + 1 = 2, so at (1, 2). It rises to x = 3, where the strict < gives a hollow dot at 3 + 1 = 4, so at (3, 4). The last piece is the flat line y = 2 from a filled dot at (3, 2). Check with vertical lines: at x = 1 only (1, 2) is filled, and at x = 3 only (3, 2) is filled, so g(1) = 2 and g(3) = 2.
The graph of g. The hollow dots are at (1, 1) and (3, 4). The filled dots are at (1, 2) and (3, 2), so g(1) = 2 and g(3) = 2.
The usual mistakes
Drawing each rule across the whole grid. The line y = x + 1 continues past x = 2, but f does not use it there. Each piece stops at its boundary.
Swapping the dots. The hollow dot goes on the piece whose inequality is strict, x < 2, so it is at (2, 3). The filled dot goes on the piece with , at (2, 4).
Joining the pieces with a vertical line at the boundary. A vertical segment from (2, 3) to (2, 4) would put many points above x = 2, as if f(2) took every value between 3 and 4. The graph jumps; it is not joined.
Writing the filled end as (4, 2). The input comes first: the end is at x = 2, at a height of 4, so it is (2, 4).