Real-world rates often change at fixed thresholds: a taxi might double its rate after midnight, a phone plan might charge less per minute over an allowance, water utilities use tiered pricing (cheaper for the first few cubic metres, more expensive thereafter). Each interval is its own linear model; together they form a single piecewise function.
Boundary trick: compute
f at each boundary of the piecewise function first. If you’re solving
f(
x) =
k, you can quickly see which piece’s output range contains
k, and only solve that one. Saves you from solving in the wrong piece.
Limitations of linear models
Real-world quantities don’t always change at a constant rate forever. A car’s speed levels off at its terminal velocity; a population stops growing when resources run out; a savings account compounds rather than adding the same amount yearly. When you see the data curving on a plot, a linear model is no longer appropriate — pick a quadratic, exponential, or other shape instead.
🧭 Recipe — using a linear or piecewise linear model
- Identify what m and c represent: m is the per-unit rate, c is the value before any units are used. Write it down in words for a sanity check.
- If finding m from data: m = (change in y)/(change in x) using any two known points. Then substitute one point to find c.
- For a value of the function: substitute the input. If piecewise, FIRST identify which interval contains the input, then use that piece’s rule.
- For working backwards (given output, find input): for a single linear model, just rearrange. For piecewise, compute the output at each boundary first to see which piece the target value belongs to.
- Sanity-check against the context: is the rate of change reasonable? Should the answer be a whole number (people, days)? If it’s a “minimum number” question, round UP.
Worked examples
WE 1Linear model — interpret and use
A taxi company charges customers using the model C(d) = 4.50 + 1.25d, where C is the cost in dollars and d is the distance in km. (a) State what the values 4.50 and 1.25 represent. (b) Find the cost for a 12 km journey. (c) A customer paid $25. How far did they travel?
(a) interpretation
4.50 = initial charge (flag-fall) before moving
1.25 = cost per km travelled
(b) substitute d = 12
C(12) = 4.50 + 1.25(12) = 4.50 + 15 = 19.50
(c) solve C(d) = 25
25 = 4.50 + 1.25d
1.25d = 20.50
d = 20.50/1.25 = 16.4
(a) initial $4.50, rate $1.25/km · (b) $19.50 · (c) 16.4 km
these three sub-parts are the classic linear-model exam pattern: interpret, evaluate, invert. Every “linear model” question is some combination of them.
WE 2Find the linear model from two data points
A water tank is being filled at a constant rate. After 3 minutes it contains 18 litres; after 8 minutes it contains 38 litres. Find a linear model V(t) = mt + c for the volume and state the initial amount of water.
Step 1 — find the rate m from the two points
m = (38 − 18)/(8 − 3) = 20/5 = 4
(4 litres per minute)
Step 2 — substitute one point to find c
at t = 3, V = 18:
18 = 4(3) + c ⇒ c = 6
Step 3 — equation & initial value
V(t) = 4t + 6
at t = 0, V = 6 litres
V(t) = 4t + 6, initial volume = 6 litres
verify with the OTHER point: V(8) = 4(8) + 6 = 38 ✓. Always cross-check — it catches arithmetic slips instantly.
WE 3Build your own linear model from a description
A delivery driver earns a base wage of $80 per shift plus $1.50 for every parcel delivered. (a) Write a model E(p) for the driver’s earnings if they deliver p parcels. (b) Find E(60). (c) The driver earned $200 in a shift. How many parcels did they deliver?
(a) construct the model
base wage: c = 80 (initial, before delivering any)
per-parcel rate: m = 1.50
E(p) = 80 + 1.50p
(b) substitute p = 60
E(60) = 80 + 1.50(60) = 80 + 90 = 170
(c) solve E(p) = 200
200 = 80 + 1.50p
1.50p = 120 ⇒ p = 80
(a) E(p) = 80 + 1.50p · (b) $170 · (c) 80 parcels
building a model from words: identify the fixed part (becomes c) and the per-unit part (becomes m). The variable name (p, t, d) doesn’t matter — just stick to it.
WE 4Piecewise linear — evaluate at three points
A parking garage charges C dollars for t hours:
C(t) = 3.50 if 0 ≤ t ≤ 1,
C(t) = 3.50 + 2.00(t − 1) if 1 < t ≤ 4,
C(t) = 9.50 + 1.00(t − 4) if t > 4.
Find C(0.5), C(3) and C(6).
Identify which interval each input is in
t = 0.5: in [0, 1] → first rule (flat fee)
C(0.5) = 3.50
t = 3: in (1, 4] → second rule
C(3) = 3.50 + 2.00(3 − 1) = 3.50 + 4 = 7.50
t = 6: in (4, ∞) → third rule
C(6) = 9.50 + 1.00(6 − 4) = 9.50 + 2 = 11.50
C(0.5) = $3.50 · C(3) = $7.50 · C(6) = $11.50
notice the rate per hour DECREASES across intervals: $0 (flat), $2/hr, then $1/hr — encouraging longer stays. The kink at each boundary shows the rate change.
WE 5Piecewise — find input given output
A mobile phone plan charges C dollars for g GB of data:
C(g) = 15 if 0 ≤ g ≤ 10,
C(g) = 15 + 1.20(g − 10) if 10 < g ≤ 30,
C(g) = 39 + 2.50(g − 30) if g > 30.
A customer’s monthly bill is $54. How many GB did they use?
Step 1 — check output at each boundary
C(10) = 15
C(30) = 39 (top of second piece)
54 > 39, so we’re in the THIRD piece
Step 2 — solve third rule for g
54 = 39 + 2.50(g − 30)
2.50(g − 30) = 15
g − 30 = 6 ⇒ g = 36
g = 36 GB
the trick for “work backwards”: compute the output at each boundary FIRST. That tells you which piece to invert — no wasted algebra trying the wrong one.
WE 6Build a piecewise model from tiered pricing
A city’s water authority uses three-tier pricing per month: $1.50 per m³ for the first 20 m³, $2.20 per m³ for the next 30 m³ (i.e. from 20 to 50 m³), and $3.00 per m³ for anything above 50 m³. (a) Write the cost function C(v) as a piecewise model. (b) A household uses 65 m³ in a month. Find the cost.
(a) build the three pieces
v in [0, 20]: C(v) = 1.50v
at v = 20: C = 30 (boundary value)
v in (20, 50]: C(v) = 30 + 2.20(v − 20)
at v = 50: C = 30 + 66 = 96 (boundary)
v > 50: C(v) = 96 + 3.00(v − 50)
(b) v = 65 is in the third piece
C(65) = 96 + 3.00(65 − 50) = 96 + 45 = 141
(a) three-piece function as above · (b) $141
tiered pricing always builds up: each piece STARTS at the cost charged up to the boundary, then adds the new rate beyond. Don’t restart from zero at each tier — that would make it cheaper to use more, which contradicts the design.
💡 Top tips
- State what m and c mean: not just numbers — “m = $1.25 per km” and “c = initial flag-fall of $4.50″ earns interpretation marks.
- “Round up” for minimum-number questions: 98.327 weeks to reach a target means you need 99 full weeks — not 98 (haven’t crossed yet) and not 98.327 (decimals don’t fit a weekly count).
- For piecewise, find boundary values first: evaluating at the cutoff points (x = 10, 30, etc.) tells you the range of each piece — useful for picking the right rule.
- Plot piecewise on your GDC: most GDCs let you enter functions with domain restrictions like “{0 ≤ x ≤ 10}” — useful for sketching and finding intersections.
- Check whether the answer should be a whole number: parcels, people, weeks, GBs — many real-world inputs are integers, so round to suit the context.
⚠ Common mistakes
- Using the wrong piece in a piecewise function: e.g. plugging x = 12 into the rule for 0 ≤ x ≤ 10. Always identify the interval first.
- Computing the rate m backwards: m = (y2 − y1)/(x2 − x1), top and bottom in the SAME order. Reversing gives the wrong sign.
- Confusing total charge with marginal rate: in tiered pricing, $2.20 per m³ in the middle tier doesn’t mean you pay $2.20 × total volume — it’s only the rate on the volume in that tier.
- Forgetting the initial value c: f(x) = mx alone (without c) gives f(0) = 0 — only correct if there really is NO baseline cost.
- Treating the model as valid for all inputs: a linear model usually has a sensible domain (e.g. t ≥ 0 for time). Don’t predict negative values for quantities like distance or weight.
Up next: Quadratic Models. When a quantity grows and then falls (or vice versa) — like a thrown ball, profit vs. price, or a rectangular area for a fixed perimeter — a single quadratic is the right shape. The vertex of the parabola is exactly the maximum (or minimum), making it the standard tool for optimisation problems at AI SL.
Need help with AI SL Modelling with Functions?
Get 1-on-1 help from an IB examiner who knows exactly what Paper 1 & 2 are looking for.
Book Free Session →