
IB Math AI SL/HL Paper 1 Exam Style Practice Questions: Functions-Algebraic Modelling
Piecewise Cost Functions and Mean Price
IB Mathematics HL • Functions • Algebraic Modelling • Piecewise Functions
Lesson Overview
In this lesson, we model the total cost of ordering custom mugs using a piecewise function. The pricing changes after the first 20 mugs, so the total cost must be written carefully in two parts.
This question also links total cost, mean price, and budget constraints. These are common IB modelling skills because students must interpret the wording accurately and build a correct algebraic model before solving.
⭐ Key Concepts
- A piecewise function is used when different rules apply in different cases.
- If the price per item changes after a certain number, split the total into separate parts.
- The mean price is
![]()
- A budget problem often requires solving an inequality and then choosing the greatest whole-number solution.
📘 Clear IB-Style Explanation
For orders of 20 mugs or fewer, every mug costs
dollars. For orders above 20 mugs, the first 20 mugs still cost
dollars each, but every extra mug costs
![]()
This means the cost function changes at
![]()
so the model must be written carefully.
A common mistake in questions like this is to assume that once the order is above 20, all mugs cost the reduced price. That is not correct. Only the mugs after the first 20 receive the discount.
📌 Worked Example 1 — Forming the Cost Function
A company sells custom mugs.
For an order of 20 mugs or fewer, the price per mug is
dollars.
For larger orders, each mug after the first 20 costs 4 dollars less than
.
Let
be the total cost, in dollars, of ordering
mugs.
(a) Write down an expression, in terms of
, for the total cost of ordering 20 mugs.
(b) Write down an expression for
, in terms of
and
, when
.
Solution
(a) Cost of 20 mugs
If each of the 20 mugs costs
dollars, then the total cost is
![]()
📊 Marks: A1
(b) Cost function for ![]()
For more than 20 mugs:
- the first 20 mugs cost
, - the remaining
mugs each cost
.
So
![]()
This may also be simplified:
![]()
![]()
Hence, for
,
![]()
or equivalently
![]()
📊 Marks: M1 A1 A1
📌 Worked Example 2 — Using Mean Price to Find 
A business orders 120 mugs. The mean price per mug for this order is $18.50.
(a) Calculate the exact total cost of the order.
(b) Hence find the value of
, correct to 2 decimal places.
Solution
(a) Total cost of 120 mugs
Mean price
![]()
So
![]()
![]()
Therefore, the exact total cost is
![]()
📊 Marks: A1
(b) Find ![]()
Since
, use
![]()
Substitute
and
:
![]()
![]()
![]()
![]()
![]()
![]()
![]()
So
![]()
📊 Marks: M1 A1
📌 Worked Example 3 — Using a Budget Constraint
The company’s budget is
![]()
Using your value of
, find the greatest number of mugs the business can order.
Solution
Using
![]()
and for
,
![]()
Substitute
:
![]()
![]()
![]()
The budget condition is
![]()
![]()
![]()
So the greatest whole number of mugs is
![]()
Check:
![]()
which is within budget, while
![]()
which exceeds the budget.
Therefore, the greatest number of mugs is
![]()
📊 Marks: M1 M1 A1
⚠ Common Mistakes
- Assuming that all mugs cost
when
. - Forgetting that only the mugs after the first 20 are discounted.
- Using mean price as though it were total cost.
- Not rounding
correctly before using it in the final part. - Giving a non-integer answer for the number of mugs instead of the greatest whole number within budget.
📘 IB Exam Tips
- In piecewise cost questions, write the first part and the discounted part separately before simplifying.
- Always check whether the order size is above or below the threshold before choosing the formula.
- For budget questions, solve the inequality and then test the nearest integers.
- Keep the algebra clear when substituting the total cost into the function.
- Use the context to guide the final answer: number of mugs must be a whole number.
🧪 Challenge Problem
A company sells custom notebooks.
For an order of 30 notebooks or fewer, the price per notebook is
dollars.
For larger orders, each notebook after the first 30 costs 5 dollars less than
.
A business orders 150 notebooks, and the mean price per notebook is $22.40.
(a) Write down an expression for the total cost of 30 notebooks.
(b) Write down an expression for
when
.
(c) Find the exact total cost of 150 notebooks.
(d) Hence find the value of
, correct to 2 decimal places.
(e) If the budget is $3200, find the greatest number of notebooks that can be ordered.
✅ Self-Practice
A business sells custom T-shirts.
For an order of 25 T-shirts or fewer, the price per T-shirt is
dollars.
For larger orders, each T-shirt after the first 25 costs 3 dollars less than
.
A customer orders 100 T-shirts, and the mean price per T-shirt is $16.80.
(a) Write down an expression for the total cost of 25 T-shirts.
(b) Write down an expression for
when
.
(c) Find the exact total cost of 100 T-shirts.
(d) Hence find the value of
, correct to 2 decimal places.
(e) If the budget is $1900, find the greatest number of T-shirts that can be ordered.
Show Solutions
Challenge Problem
(a)
![]()
(b)
![]()
(c)
![]()
So the exact total cost is
![]()
(d)
![]()
![]()
![]()
![]()
![]()
So
![]()
(e)
For
,
![]()
![]()
![]()
Budget condition:
![]()
![]()
![]()
So the greatest number of notebooks is
![]()
Self-Practice
(a)
![]()
(b)
![]()
(c)
![]()
So the exact total cost is
![]()
(d)
![]()
![]()
![]()
![]()
![]()
(e)
For
,
![]()
![]()
![]()
Budget condition:
![]()
![]()
![]()
So the greatest number of T-shirts is
![]()


