IB Maths AI HLLog, Logistic & PiecewisePaper 2 & 3Continuity, intervals~9 min read
Piecewise Models
A piecewise model stitches together two or more functions, each on its own interval of the domain. Linear piecewise models (different rates over different intervals) handle tariffs, charges, and motion with constant acceleration phases. Non-linear pieces (quadratic, cubic, exponential) handle anything more curved. Continuity at the join lets you pin down unknown parameters.
📘 What you need to know
Structure: f(x) = { f1(x) on a ≤ x < b ; f2(x) on b ≤ x < c }. Each piece has its own formula and domain.
Pick the right piece: when evaluating f(v), check which interval v falls into, then use that piece only.
Linear piecewise: fi(x) = mix + ci. Different slopes for different intervals — tariffs, taxis, allowance plans.
Non-linear piecewise: pieces can be quadratic, cubic, exponential, etc. Common for physical processes with phases.
Continuity at joins: f1(b) = f2(b) — the graphs meet at x = b. Use this equation to find unknown parameters.
Solving f(x) = target: figure out which piece can produce the target by checking endpoint values, then solve in that piece. Check that the solution lies in its piece’s domain.
Choosing the right piece
Two questions arise constantly: “what is f at this x?” and “for what x does f equal this value?”. For the first, locate x in its interval, then plug into the matching piece — only the matching piece, never both. For the second, compute the piece endpoint values to see which interval can produce the target, then solve in that piece. A subtle trap: a solution from algebra might fall outside the piece’s domain, in which case you reject it and try the other piece. Always double-check that any candidate x actually lies in the interval whose formula you used.
Continuity at the join
Real-world piecewise models usually need to be continuous — you can’t have a tank’s water level jumping instantly from one value to another. So if a model is given as continuous and one of its parameters is unknown, the join equation f1(b) = f2(b) is your way in: it’s a single equation that usually has a single unknown. Substitute the join value b into both pieces, set the expressions equal, and solve for the parameter.
Both models are continuous: the pieces meet exactly at the join (orange dot). The left model has a corner (slope changes abruptly); the right model joins smoothly from curve to line at (4, 8).
Piecewise model at a glancef(x) = { f1(x) on a ≤ x < b ; f2(x) on b ≤ x < c }
continuity: f1(b) = f2(b) · check which piece a value or target falls in
Solving piecewise inverse problems
To find x given a target output, compute the piece-endpoint values to see which piece can produce the target, then solve in that piece. If a candidate solution falls outside that piece’s domain, reject it. Sometimes the target falls in a piece’s range but algebra also produces a solution in another piece’s range — check both. If a piece is monotonic, there’s at most one solution per piece; quadratic pieces can produce two candidates of which one (or both) might be valid.
Sanity check: after solving, plug your x back into the model. If the domain restriction or piece selection was wrong, the output will give the answer away.
🧠Recipe — piecewise models
Evaluate f(v): locate v in the right interval, plug into that piece only.
Find unknown parameter by continuity: f1(b) = f2(b) at the join.
Find x for a target: compute the piece endpoints to identify which piece’s range contains the target.
Solve within that piece, then verify the answer lies in the piece’s domain.
Multiple candidates: a quadratic piece can give two answers — reject any that fall outside the piece’s interval.
Worked examples
WE 1
Linear piecewise — water filling
The volume V(t) in litres of water collected at a filling station after t seconds is V(t) = {0.4t for 0 ≤ t ≤ 5; 2 + 0.6(t − 5) for t > 5}. (a) Find V(3). (b) Find V(10). (c) Find t when V(t) = 8.
A monthly mobile bill C(d) in dollars when using d MB of data is C(d) = {5 for 0 ≤ d ≤ 500; 5 + 0.01(d − 500) for d > 500}. (a) Find C(300). (b) Find C(1200). (c) Find d when C = $20.
(a) d = 300 ≤ 500 → first pieceC(300) = $5(b) d = 1200 > 500 → second pieceC(1200) = 5 + 0.01(700) = 5 + 7C(1200) = $12(c) target 20 > 5 → second piece5 + 0.01(d − 500) = 200.01(d − 500) = 15 ⇒ d − 500 = 1500d = 2000 MB
WE 3
Find missing parameter by continuity
A car accelerates from rest then maintains a constant speed. Its speed s(t) (m/s) at time t (s) is s(t) = {kt for 0 ≤ t ≤ 4; 12 for t > 4}, where the model is continuous. (a) Find k. (b) Find s(2).
(a) continuity at t = 4k(4) = 12k = 3 m/s²(b) t = 2 ≤ 4 → first pieces(2) = 3(2)s(2) = 6 m/s
WE 4
Quadratic + linear — water tank
The water height h(t) cm in a tank at time t seconds is h(t) = {0.5t2 for 0 ≤ t ≤ 4; a + 2(t − 4) for t > 4}. The model is continuous. (a) Find a. (b) Find h(2) and h(10). (c) Find t when h(t) = 12.
(a) continuity at t = 40.5(4)² = a + 08 = aa = 8(b) t = 2 ≤ 4 → first pieceh(2) = 0.5(4) = 2t = 10 > 4 → second pieceh(10) = 8 + 2(6) = 20h(2) = 2 cm, h(10) = 20 cm(c) h(4) = 8; target 12 > 8 → second piece8 + 2(t − 4) = 12 ⇒ t − 4 = 2t = 6 sec
WE 5
Linear then quadratic — distance travelled
A vehicle’s distance from base d(t) km at time t hours is d(t) = {60t for 0 ≤ t ≤ 2; −5(t − 10)2 + A for 2 < t ≤ 10}. The model is continuous. (a) Find A. (b) Find d(5) and d(10). (c) Find t when d(t) = 260.
(a) continuity at t = 260(2) = −5(2 − 10)² + A120 = −5(64) + A = A − 320A = 440(b) second piece for bothd(5) = −5(25) + 440 = 315d(10) = −5(0) + 440 = 440 (vertex)d(5) = 315 km, d(10) = 440 km(c) d(2) = 120, d(10) = 440; 260 is between → second piece−5(t − 10)² + 440 = 2605(t − 10)² = 180 ⇒ (t − 10)² = 36t − 10 = ±6 ⇒ t = 4 or t = 16domain 2 < t ≤ 10 → reject 16t = 4 hours (clean!)
WE 6
Comprehensive: parameter, max, target across pieces
A product’s monthly sales S(m) (in hundreds of units) over m months is S(m) = {100 + 30m for 0 ≤ m ≤ 8; a − 5(m − 12)2 for 8 < m ≤ 16}. The model is continuous. (a) Find a. (b) State the maximum sales and when. (c) Find S(15). (d) Find m when sales were 280.
(a) continuity at m = 8100 + 30(8) = a − 5(8 − 12)²340 = a − 80a = 420(b) second piece is downward parabolavertex at m = 12, S = 420max 420 hundred units at m = 12(c) m = 15 in second pieceS(15) = 420 − 5(9) = 375S(15) = 375 hundred units(d) S(8) = 340; target 280 < 340 → first piece100 + 30m = 28030m = 180m = 6checking the second piece for 280 gives m = 12 ± √28, but neither is in (8, 16] in a way that beats the first solution — so m = 6 from the first piece is correct.
💡 Top tips
Always check which piece your x belongs to before substituting — don’t use both pieces for the same value.
Continuity equation is the standard way to find missing parameters: set f1(b) = f2(b) at the join.
For inverse problems, compute endpoint values of each piece to see which range a target falls in.
Reject solutions outside the piece’s interval — especially common with quadratic pieces that give two candidates.
GDC piecewise plot: most GDCs let you graph piecewise functions directly — useful for visualising and finding solutions graphically.
âš Common mistakes
Using the wrong piece for a given x — always verify the interval first.
Forgetting continuity — missing the equation that determines a missing parameter.
Accepting a quadratic candidate outside its piece’s domain — algebra can produce solutions that the piece doesn’t reach.
Ignoring open versus closed intervals at the join — usually it doesn’t change the value but can affect domain wording.
Treating the model as one global function — trying to combine pieces algebraically across the join often produces nonsense.
Chapter complete — you now have all three modelling-with-functions topics: Natural Logarithmic, Logistic, and Piecewise. Together they cover the heart of AI HL Paper 2 and 3 modelling problems.
Need help with Piecewise Models?
Get 1-on-1 help from an IB examiner who knows exactly what Paper 1 & 2 are looking for.