Prices set in bands
Many prices are set in bands. A postal service might charge $1 to send a letter that weighs up to 100 g, and $2 for a letter that weighs over 100 g and up to 250 g. The price is a function of the weight, but no single formula gives it: which rule applies depends on the band the weight falls in.
Write the weight in grams as w and the price in dollars as P(w). Then P(w) = 1 for , and P(w) = 2 for . A function defined by different rules on different parts of its domain is called a piecewise function. Each rule comes with an inequality that says which inputs it governs.
Each input belongs to exactly one piece
A letter that weighs exactly 100 g is in the first band, because "up to 100 g" includes 100. The second band says "over 100 g", which leaves 100 out. So P(100) = 1.
Suppose the second band were written "100 g and over" instead. Then a letter of exactly 100 g would be in both bands, and its price would be $1 and $2 at the same time. P(100) would have two outputs, and a function gives each input exactly one output. That is why the inequalities of a piecewise function are written so that every input in the domain lies in exactly one piece: at each boundary, one inequality includes the boundary value and the other leaves it out.
Find the piece, then use its rule
Here is a piecewise function with two rules: f(x) = 2x + 1 for x < 3, and f(x) = 10 − x for . The number 3, where the rule changes, is the boundary.
To evaluate f, first decide which piece the input is in, then use that piece's rule and no other. For f(0): 0 < 3, so use 2x + 1, and f(0) = 2 × 0 + 1 = 1. The other rule would give 10 − 0 = 10, but 10 − x governs only the inputs from 3 upward, so 10 is not f(0).
For f(8): , so use 10 − x, and f(8) = 10 − 8 = 2. A negative input works the same way: −2 < 3, so f(−2) = 2 × (−2) + 1 = −3.
The graph of f. Left of x = 3 it is the line y = 2x + 1, which passes through (0, 1). From x = 3 on it is the line y = 10 − x, which passes through (8, 2). The two pieces meet at (3, 7).
The boundary value
For f(3), check each inequality. 3 < 3 is false, because 3 is not less than itself, so the first rule does not apply. is true, because means "greater than or equal to". So the second rule answers: f(3) = 10 − 3 = 7. The boundary belongs to the rule whose inequality carries the "or equal to".
For this f, the first rule would also have given 2 × 3 + 1 = 7 at x = 3, so the two pieces happen to meet there. Usually they do not, and then the rule that owns the boundary decides the answer.
x = −1 < 1: the first rule is in charge, f(x) = 2x + 1 = −1, and the other line is not consulted
Drag x to exactly 1 and read which rule owns it
Here is a second function: f(x) = 2x + 1 for x < 1 and f(x) = 5 − x for . Drag x along the axis, and the rule in charge lights up. At exactly x = 1 the gives the input to 5 − x, so f(1) = 4 and the filled dot is at (1, 4). The button moves the "or equal to" to the first rule, which then owns x = 1 and gives f(1) = 3. Here the two rules disagree at the boundary, so exactly one of them must own it.
Working backward from an output
Go back to f(x) = 2x + 1 for x < 3 and f(x) = 10 − x for , and ask which inputs give the output 5. Try each rule, and keep a solution only if it lies in that rule's piece. The first rule: 2x + 1 = 5, so 2x = 4 and x = 2. It lies in its piece, because 2 < 3. The second rule: 10 − x = 5, so x = 5, and , so it counts too. Both inputs give 5: f(2) = 5 and f(5) = 5.
Now try f(x) = 9. The first rule gives 2x + 1 = 9, so x = 4, but 4 is not less than 3, so that rule does not apply at 4, and the solution is rejected. The second rule gives 10 − x = 9, so x = 1, but 1 is not 3 or more, so it is rejected too. No input gives 9. The graph shows why: its highest point is (3, 7).
The usual mistakes
Using the other rule. For f(0), 10 − 0 = 10 comes from the rule for , and 0 is not in that piece. f(0) = 1.
Stopping partway through a rule. For f(2), 2 × 2 = 4 is only the multiply; the rule 2x + 1 then adds 1, so f(2) = 5.
Giving the boundary to the strict inequality. At x = 3, the rule for x < 3 does not apply, because 3 is not less than 3. The rule for owns the boundary.
Saying the boundary has no value. The includes 3, so f(3) has exactly one value, 7.
Bands on a graph
On a graph, each piece is drawn only over its own interval of inputs. At an end the piece includes, marked by or , the graph ends in a filled dot. At an end it does not include, marked by < or >, it ends in a hollow dot, which means that point is not on the graph.
For the postage price, the $1 band covers , so it runs from a hollow dot at (0, 1), since a letter must weigh something, to a filled dot at (100, 1). The $2 band covers , so it starts with a hollow dot at (100, 2) and ends with a filled dot at (250, 2). At w = 100 the only filled dot is at a height of 1, so P(100) = 1.
The postage price P(w) in dollars for a letter of w grams. The $1 band ends in a filled dot at (100, 1), and the $2 band starts with a hollow dot at (100, 2), because a letter of exactly 100 g is in the first band.
Worked example: A Car Park Tariff in Three Bands: The Charge for a Stay and the Stay for a Charge
Question A car park charges C(x) dollars for a stay of x hours, where C(x) = 3 for 0 < x ≤ 1, C(x) = 2x + 2 for 1 < x ≤ 4, and C(x) = 12 for 4 < x ≤ 10. (a) Find the charge for a stay of exactly 1 hour and the charge for a stay of 2.5 hours. (b) A driver was charged $8. For how long did she park?
1.Find the band before using a rule. A stay of exactly 1 hour satisfies 0 < x ≤ 1, so it belongs to the first band and C(1) = 3. On the graph the first band ends with a filled end at (1, 3), and the second band starts with a hollow end at (1, 4) because x = 1 does not belong to it.
A stay of exactly 1 hour is in the band 0 < x ≤ 1, so C(1) = 3. The filled end at (1, 3) belongs to the graph. The hollow end at (1, 4) does not. 2.A stay of 2.5 hours satisfies 1 < x ≤ 4, so use the second rule: C(2.5) = 2 × 2.5 + 2 = 7.
A stay of 2.5 hours is in the band 1 < x ≤ 4, so C(2.5) = 2 × 2.5 + 2 = 7. 3.(a) A stay of exactly 1 hour costs $3 and a stay of 2.5 hours costs $7.
(a) Exactly 1 hour costs $3, and 2.5 hours cost $7. 4.For a charge of $8, look at each band. The first band always gives 3 and the third always gives 12, so only the second rule can give 8: 2x + 2 = 8, so 2x = 6 and x = 3.
The line at a charge of 8 meets only the middle band, where 2x + 2 = 8 and so x = 3. 5.(b) Check that the solution lies in the band whose rule gave it: 1 < 3 ≤ 4 is true. She parked for 3 hours. Check: C(3) = 2 × 3 + 2 = 8.
(b) 3 lies in the band 1 < x ≤ 4, so the solution stands: she parked for 3 hours.
Answer: (a) $3 for exactly 1 hour and $7 for 2.5 hours; (b) 3 hours
Common mistakes
- Using the rule 2x + 2 for a stay of exactly 1 hour and answering $4. The second band is 1 < x ≤ 4, and the sign < leaves x = 1 out of it. The value x = 1 belongs to the first band, where the charge is $3.
- Solving an equation with one rule and accepting the solution without looking at the band. For a charge of $12 the second rule gives 2x + 2 = 12 and x = 5, but 5 is not between 1 and 4, so that rule does not apply there. A charge of $12 belongs to the third band, which is every stay of more than 4 hours.