Module 1 · L4 of 15~40 min⚡ +50 XP in Learn · +25 to complete
Piecewise & Absolute Value Functions
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.
Today's hook, 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$?
0/5QUESTS
1
You’re here
Orient and recall
Meet the destination, bring back what you already know, and gather the terms and formulas this lesson leans on.
Worksheets
Practise this lesson
Three printable worksheets that build from foundations to mastery, or build your own from any module’s questions.
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$?
auto-saved
02
Formula reference · this lesson
core notation
Piecewise
Use the rule whose condition the input satisfies
$|x|$ $= x$ if $x \geq 0$
$|x|$ $= -x$ if $x < 0$
$|ax + b| = c$ Solve $ax + b = c$ and $ax + b = -c$
Key insight: The absolute value of a negative number is positive because the negative sign flips the sign. For example, $|-7| = -(-7) = 7$.
03
What you'll master
Know
Key facts
The definition of a piecewise function
The piecewise definition of absolute value
How to evaluate piecewise functions at given inputs
Understand
Concepts
Why real-world pricing models often need piecewise rules
Why $|x|$ is always non-negative
How the graph of a piecewise function can change direction at a boundary point
Can do
Skills
Evaluate piecewise functions for numerical inputs
Write and interpret piecewise rules in context
Solve basic absolute value equations
Sketch piecewise linear functions
04
Key terms
piecewise function
a function defined by different rules for different parts of its domain
absolute value
the distance of a number from zero on the number line; always non-negative
boundary point
the input value where a piecewise function switches from one rule to another
condition
the inequality or equation that determines which piece of a piecewise function to use
surge pricing
a real-world example of piecewise pricing where the rate changes at a threshold distance or time
$-x$ (negative $x$)
the opposite of $x$; when $x$ is negative, $-x$ is positive, this is used in the piecewise definition of $|x|$
2
You’re here
Piecewise functions
Work through the core explanation before applying it.
05
Piecewise functions
core concept · +3 XP at end
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.
Surge pricing is piecewise. A ride-share app might charge $2$ per km for the first $5$ km, then $1.50$ per km after that. The rule for cost depends on whether the distance is less than or equal to $5$ km, or greater than $5$ km. One simple linear formula cannot capture both behaviours.
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.
How to evaluate a piecewise function
Look at the input value.
Find the condition that matches the input.
Apply only that rule.
Simplify.
For the function above:
$f(2)$: since $2 < 3$, use $2x + 1 \Rightarrow f(2) = 2(2) + 1 = 5$
$f(3)$: since $3 \geq 3$, use $10 - x \Rightarrow f(3) = 10 - 3 = 7$
$f(5)$: since $5 \geq 3$, use $10 - x \Rightarrow f(5) = 10 - 5 = 5$
Misconceptions to fix
✗
Wrong: (a + b)² = a² + b².
✓
Right: (a + b)² = a² + 2ab + b²; the middle term 2ab is essential and commonly forgotten.
A piecewise function uses different rules for different parts of the domain; Always check the condition before choosing which rule to apply
Pause, copy the piecewise definition (different rules for different parts of the domain) and the two-step evaluation procedure (check the condition first, then apply the matching rule) into your book.
Did you get this? True or false: for the piecewise function $f(x) = \begin{cases} 2x+1 & x < 3 \\ 10-x & x \geq 3 \end{cases}$, we evaluate $f(3)$ using the rule $2x + 1$.
Quick check: For $f(x) = \begin{cases} x^2+1 & x \leq 2 \\ 5x-3 & x > 2 \end{cases}$, what is $f(2)$?
06
Absolute value functions
core concept
We just saw that a piecewise function uses a different rule depending on which part of the domain the input falls into. That raises a question: is there a common function that already has a built-in two-piece rule baked into its definition? This card answers it → the absolute value function $|x|$ is itself piecewise: $x$ when $x \geq 0$, and $-x$ when $x < 0$.
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$.
Do not confuse $-x$ with a negative result. When $x$ is already negative, $-x$ becomes positive. The expression $-x$ means "the opposite of $x$," not "a negative number."
Solving absolute value equations
If $|A| = B$ where $B \geq 0$, then there are two possibilities:
$A = B$
$A = -B$
For example, to solve $|2x - 4| = 6$:
Case 1: $2x - 4 = 6 \Rightarrow 2x = 10 \Rightarrow x = 5$
Case 2: $2x - 4 = -6 \Rightarrow 2x = -2 \Rightarrow x = -1$
Both solutions should be checked in the original equation.
$|x|$ = distance from zero; always $\geq 0$; $|x| = x$ if $x \geq 0$; $|x| = -x$ if $x < 0$
Pause, copy the absolute value piecewise definition ($|x| = x$ if $x \geq 0$; $|x| = -x$ if $x < 0$) and the distance-from-zero interpretation into your book.
Fill the blanks: drag each token into the matching blank.
positivetwonegativeopposite
The absolute value of a ___ number is
___ because $-x$ means the
___ of $x$.
An absolute value equation $|A| = B$ always has ___ cases to solve.
Worked examples · reveal as you go
3
You’re here
Work examples end to end
Follow the reasoning through complete worked solutions.
Worked example 1 · evaluating a piecewise function+5 XP on full reveal
Evaluate $f(-1)$, $f(2)$, and $f(4)$ for $\displaystyle f(x) = \begin{cases} x^2 + 1 & \text{if } x \leq 2 \\ 5x - 3 & \text{if } x > 2 \end{cases}$
1
Evaluate $f(-1)$: $-1 \leq 2$, use the first rule
Always check the condition before substituting
2
$f(-1) = (-1)^2 + 1 = 1 + 1 = 2$
Use brackets around $-1$ to avoid sign errors
3
Evaluate $f(2)$: $2 \leq 2$, use the first rule
The boundary value $x = 2$ satisfies $\leq$, so it belongs to the first piece
Worked example 3 · writing a piecewise rule from context+5 XP on full reveal
A courier company charges $\$5$ for deliveries up to and including $2$ km, and $\$5$ plus $\$1.50$ for each kilometre beyond $2$ km for longer deliveries. Write a piecewise function $C(d)$ for the cost in dollars of a delivery of $d$ km.
1
Identify the conditions
Up to 2 km: flat rate of $\$5$. Beyond 2 km: $\$5$ plus $\$1.50$ per extra km.
2
$C(d) = 5 \quad \text{if } d \leq 2$
First piece: flat fee for short trips
3
Extra distance $= d - 2$, so $C(d) = 5 + 1.5(d - 2) \quad \text{if } d > 2$
Use $d - 2$ not $d$, the flat fee covers the first 2 km
4
$C(d) = 2 + 1.5d \quad \text{if } d > 2$ ✓
Simplified: $C(d) = \begin{cases} 5 & d \leq 2 \\ 2 + 1.5d & d > 2 \end{cases}$
Common mistakes · the 4 traps that cost marks
4
You’re here
Dodge the traps, then apply
Meet the mistakes that cost marks, then do it yourself.
1
Using the wrong piece at the boundary
At the boundary value, always check whether the condition includes $\leq$, $\geq$, $<$, or $>$. If the condition says $x \leq 3$, then $x = 3$ belongs to that piece. If it says $x < 3$, then $x = 3$ does not.
✓ Fix: Before substituting, write the condition next to the input and tick the one that matches.
2
Thinking $|x|$ is always positive, so $|x| = x$ for all $x$
Many students incorrectly write $|-5| = -5$ because they forget the piecewise definition. The negative piece $|x| = -x$ is what turns negative inputs into positive outputs.
✓ Fix: Always ask: is the expression inside the absolute value positive or negative? If negative, multiply it by $-1$.
3
Forgetting the second case in absolute value equations
Equations like $|2x - 1| = 7$ almost always have two solutions. Students frequently stop after finding the first one.
✓ Fix: Every time you see $|A| = B$, immediately write $A = B$ and $A = -B$ side by side.
4
Writing the extra-distance piece incorrectly in context problems
In a ride-share problem, students sometimes write $1.5d$ for the entire trip when only the distance beyond the threshold should be charged at the higher or lower rate.
✓ Fix: Use $d - \text{threshold}$ for the variable part, not $d$ itself. The fixed fee covers the first part of the trip.
Activity 1, Evaluate the piecewise function
Consider the function $\displaystyle f(x) = \begin{cases} 2x + 3 & \text{if } x < 1 \\ x^2 & \text{if } 1 \leq x \leq 3 \\ 12 - x & \text{if } x > 3 \end{cases}$
1
Find $f(0)$.
auto-saved
2
Find $f(1)$.
auto-saved
3
Find $f(3)$.
auto-saved
4
Find $f(5)$.
auto-saved
Quick check: For the piecewise function above, which rule is used to evaluate $f(3)$?
Quick-fire practice · 5 reps +2 XP per reveal
5
You’re here
Drill it, then lock it in
Run the quick drill and copy the summary into your book.
1
For $f(x) = \begin{cases} 3x-1 & x < 2 \\ x^2-1 & x \geq 2 \end{cases}$, find $f(0)$.
$0 < 2$, so use $3x - 1$: $f(0) = 3(0) - 1 = \mathbf{-1}$
2
Evaluate $|-8|$.
$-8 < 0$, so $|-8| = -(-8) = \mathbf{8}$
3
Solve $|x - 2| = 5$.
Case 1: $x - 2 = 5 \Rightarrow x = 7$. Case 2: $x - 2 = -5 \Rightarrow x = -3$. Answer: $\mathbf{x = 7}$ or $\mathbf{x = -3}$.
4
A shop charges $\$20$ flat for orders under $\$100$, and $\$20$ plus $5\%$ of the amount over $\$100$ for larger orders. What is $C(150)$?
When $x \geq 0$, $|x| = x \geq 0$. When $x < 0$, $|x| = -x$, and since $x$ is negative, $-x$ is positive. In both cases the result is $\geq 0$.
13
Revisit your thinking
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.
auto-saved
1
You’re here
Multiple choice
Answer the drill bank and rate your confidence.
01
Multiple choice
+5 XP per correct · +25 XP all-correct
Pick your answer, then rate your confidence, that tells the system what to drill next.
2
You’re here
Short answer
Write full responses, then check them against the model answers.
02
Short answer
ApplyBand 33 marks
Q1. 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)
auto-saved
ApplyBand 44 marks
Q2. 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)
auto-saved
EvaluateBand 53 marks
Q3. 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)
auto-saved
Comprehensive answers (click to reveal)
Multiple choice, drill bank
MC answers and feedback are shown inline as you complete each question. Use the retry button to attempt a fresh set.
Choosing the correct branch. $x = 2$ satisfies $x \leq 2$, so $f(2) = 3(2) + 1 = 7$.
Evaluating an absolute value. $|-5| = 5$.
Definition of absolute value. $|x| = x$ if $x \geq 0$, and $-x$ if $x < 0$.
Q1 (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].
Q2 (4 marks):
(a) $A(x) = \begin{cases} 40 & \text{if } x < 16 \\ 60 & \text{if } x \geq 16 \end{cases}$ [1] (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 [1].
Q3 (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].
1
You’re here
Review and finish
Take the module quiz if you are ready, then mark the lesson complete.
01
Take the full module quiz
quiz
A full module quiz covering every lesson in this module, not just this one. Set aside a decent block of time and treat it like a real assessment.