Ever noticed how a ride-share app charges one rate for the first few kilometres, then a different rate after that? The rule changes depending on how far you travel. That is exactly what a piecewise function does — and it is one of the most useful tools in applied mathematics.
Use the PDF for classwork, homework or revision. It includes key ideas, activities, questions, an extend task and success-criteria proof.
A delivery app charges $5 for any trip under 3 km, then adds $1.50 for every kilometre beyond 3 km. How much would a 2 km trip cost? How much would a 5 km trip cost? Why can't we describe both trips with a single simple formula like $C = 5 + 1.5d$?
Type your initial response below — you will revisit this at the end of the lesson.
Write your initial response in your book. You will revisit it at the end of the lesson.
Wrong: (a + b)² = a² + b².
Right: (a + b)² = a² + 2ab + b²; the middle term 2ab is essential and commonly forgotten.
📚 Core Content
A piecewise function is a function defined by different rules for different parts of its domain. Instead of one formula that works everywhere, we use multiple formulas, each with its own condition.
For example:
$$f(x) = \begin{cases} 2x + 1 & \text{if } x < 3 \\ 10 - x & \text{if } x \geq 3 \end{cases}$$
To evaluate this function, first check which condition the input satisfies, then apply the matching rule.
For the function above:
The absolute value of a number is its distance from zero on the number line. Distance is always non-negative, so absolute value always produces a positive result or zero.
We can define absolute value as a piecewise function:
$$|x| = \begin{cases} x & \text{if } x \geq 0 \\ -x & \text{if } x < 0 \end{cases}$$
This definition explains why $|-7| = 7$: because $-7 < 0$, we use the second piece and get $-(-7) = 7$.
If $|A| = B$ where $B \geq 0$, then there are two possibilities:
For example, to solve $|2x - 4| = 6$:
Both solutions should be checked in the original equation.
🧮 Worked Examples
🧪 Activities
1 Find $f(0)$.
Type your answer:
Answer in your workbook.
2 Find $f(1)$.
Type your answer:
Answer in your workbook.
3 Find $f(3)$.
Type your answer:
Answer in your workbook.
4 Find $f(5)$.
Type your answer:
Answer in your workbook.
1 A parking garage charges $\\$10$ for the first 2 hours and $\\$4$ for each additional hour (or part thereof). Write $C(h)$ for the cost of parking $h$ hours where $h \leq 2$ and $h > 2$, then find $C(1.5)$ and $C(4)$.
Type your answer:
Answer in your workbook.
2 Solve $|x - 3| = 5$. Show both cases clearly.
Type your answer:
Answer in your workbook.
3 Explain why $|x|$ is never negative. Use the piecewise definition in your explanation.
Type your answer:
Answer in your workbook.
Earlier you were asked: A delivery app charges $5 for any trip under 3 km, then adds $1.50 for every kilometre beyond 3 km. How much would a 2 km trip cost? How much would a 5 km trip cost? Why can't we describe both trips with a single simple formula?
A 2 km trip costs $5 because it falls under the flat-rate condition ($d < 3$). A 5 km trip costs $5 + 1.50(5-3) = \\$8$ because it exceeds the threshold. A single simple formula like $C = 5 + 1.5d$ would charge $5 + 1.5(2) = \\$8$ for the 2 km trip, which is wrong. The rule genuinely changes at the 3 km boundary, so a piecewise function is required to model the pricing accurately.
Now revisit your initial response. What did you get right? What has changed in your thinking?
Look back at your initial response in your book. Annotate it with what you now understand differently.
Look back at what you wrote in the Think First section. What has changed? What did you get right? What surprised you?
5 random questions from a replayable lesson bank — feedback shown immediately
✍️ Short Answer
8. Consider $\displaystyle f(x) = \begin{cases} 3x - 1 & \text{if } x < 2 \\ 5 & \text{if } x = 2 \\ x^2 - 1 & \text{if } x > 2 \end{cases}$. Find $f(0)$, $f(2)$, and $f(3)$. Show which piece you used for each. 3 MARKS
Type your answer below:
Answer in your workbook.
9. A theme park charges $\\$40$ for entry if you are under 16 years old, and $\\$60$ if you are 16 or older. Let $A(x)$ be the admission cost in dollars for a person of age $x$. (a) Write $A(x)$ as a piecewise function. (b) Find $A(15)$ and $A(16)$. (c) Explain why a single linear formula cannot model this pricing structure. 4 MARKS
Type your answer below:
Answer in your workbook.
10. A student solves $|2x - 4| = 8$ and writes: "$2x - 4 = 8$, so $x = 6$." Evaluate whether this answer is complete. If it is not, find the missing solution and explain why it must be included. 3 MARKS
Type your answer below:
Answer in your workbook.
1. $f(0) = 2(0) + 3 = 3$ (first piece, since $0 < 1$)
2. $f(1) = (1)^2 = 1$ (second piece, since $1 \leq 1 \leq 3$)
3. $f(3) = (3)^2 = 9$ (second piece, since $1 \leq 3 \leq 3$)
4. $f(5) = 12 - 5 = 7$ (third piece, since $5 > 3$)
1. $C(h) = \begin{cases} 10 & \text{if } h \leq 2 \\ 10 + 4(h - 2) & \text{if } h > 2 \end{cases}$ or simplified $C(h) = 2 + 4h$ for $h > 2$. $C(1.5) = \\$10$, $C(4) = 10 + 4(2) = \\$18$.
2. Case 1: $x - 3 = 5 \Rightarrow x = 8$. Case 2: $x - 3 = -5 \Rightarrow x = -2$. Solutions: $x = 8$ or $x = -2$.
3. When $x \geq 0$, $|x| = x$ which is non-negative. When $x < 0$, $|x| = -x$, and since $x$ is negative, $-x$ is positive. In both cases the result is $\geq 0$.
1. B — $x = 2$ satisfies $x \leq 2$, so $f(2) = 3(2) + 1 = 7$.
2. B — $|-5| = 5$.
3. A — $|x| = x$ if $x \geq 0$, and $-x$ if $x < 0$.
4. B — $4 \geq 3$, so $f(4) = 2(4) + 1 = 9$.
5. B — $y = |x - 2|$ has vertex at $(2, 0)$.
Q8 (3 marks): $f(0) = 3(0) - 1 = -1$ using $3x - 1$ because $0 < 2$ [1]. $f(2) = 5$ using the middle piece because $x = 2$ [1]. $f(3) = (3)^2 - 1 = 8$ using $x^2 - 1$ because $3 > 2$ [1].
Q9 (4 marks):
(a) $A(x) = \begin{cases} 40 & \text{if } x < 16 \\ 60 & \text{if } x \geq 16 \end{cases}$(b) $A(15) = \\$40$ and $A(16) = \\$60$ [1].
(c) A single linear formula would produce a gradual increase in cost as age increases, but the actual pricing jumps from $\\$40$ to $\\$60$ at exactly age 16 [1]. A piecewise function is needed because the rate of change is not constant across all ages.
Q10 (3 marks): The student's answer is incomplete [1]. They missed the second case: $2x - 4 = -8 \Rightarrow 2x = -4 \Rightarrow x = -2$ [1]. The missing solution must be included because absolute value represents distance from zero, so there are two values of $x$ that give an expression inside the absolute value with magnitude 8 [1].
Piecewise & Absolute Value Functions
Tick when you've finished all activities and checked your answers.