Practice Maths

Piecewise Linear Graphs

Key Terms

A piecewise linear function is defined by different linear rules over different intervals (domains). The function “switches” rule at a breakpoint.
Each “piece” is a straight line with its own gradient, valid only within its specified domain.
Continuous
: the pieces connect (no gap at the breakpoint). Discontinuous: there is a jump at the breakpoint.
To evaluate a piecewise function: first identify which interval your x-value falls in, then apply only that rule.
To construct a piecewise graph: plot each segment within its domain; use a closed dot (•) at an included endpoint and an open dot (ˆ) at an excluded endpoint.
Real-world contexts
phone plans (free allowance then per-unit rate), tiered electricity pricing, taxi fares with different zone rates, production costs with economies of scale.
Piecewise Notation

A piecewise function is written as:

f(x) = { rule&sub1;   if a ≤ x ≤ b
        { rule&sub2;   if b < x ≤ c

• The domain restrictions tell you where each rule applies.
• At the breakpoint x = b, exactly one rule applies (check ≤ vs <).
• Gradient in each section = (rise) ÷ (run) calculated within that section only.

Phone plan: free for first 60 min, then $0.15/min after. C = $10 flagfall throughout.

min C ($) 0 60 120 180 0 10 20 30 run=60 min rise=$9 C = $10 (flat) C = 10 + 0.15(x−60) Breakpoint x=60 m=0 m=0.15
Hot Tip Always check which interval your x-value belongs to before you calculate. If x is at a breakpoint, look at the inequality signs: ≤ includes the endpoint, < does not. Only one rule can apply at any given x-value.

Worked Example 1 — Writing a piecewise rule from a real-world context

Question: A mobile phone plan costs $25/month and includes 100 free text messages. After the first 100 texts, each message costs 8 cents. Write a piecewise rule for the monthly cost C in terms of the number of texts t. Find the cost for: (a) 85 texts; (b) 150 texts.

Identify the pieces:
• If t ≤ 100: only the flat $25 monthly fee applies. C = 25.
• If t > 100: the flat $25 fee plus 8 cents for each text above 100. C = 25 + 0.08(t − 100).

C = { 25                 if 0 ≤ t ≤ 100
   { 25 + 0.08(t − 100)   if t > 100

(a) t = 85: since 85 ≤ 100, use rule 1: C = $25

(b) t = 150: since 150 > 100, use rule 2: C = 25 + 0.08(150 − 100) = 25 + 0.08(50) = 25 + 4 = $29

Worked Example 2 — Reading and interpreting a piecewise graph

Question: A piecewise graph shows two sections. Section 1 passes through (0, 5) and (4, 5) — horizontal. Section 2 passes through (4, 5) and (10, 17). Find: (a) the gradient in each section; (b) the rule for each section; (c) the value of the function at x = 7.

(a) Gradients:
Section 1 (0 ≤ x ≤ 4): horizontal line, gradient m = 0.
Section 2 (x > 4): m = (17 − 5) ÷ (10 − 4) = 12 ÷ 6 = 2.

(b) Rules:
Section 1: f(x) = 5   (for 0 ≤ x ≤ 4)
Section 2: f(x) = 5 + 2(x − 4)   (for x > 4)   [using point (4, 5) and gradient 2]

(c) At x = 7: since 7 > 4, use rule 2: f(7) = 5 + 2(7 − 4) = 5 + 6 = 11

A piecewise linear function behaves like several different straight lines glued together, each valid over its own interval. This is how many real pricing systems actually work: a base rate for small usage, a different rate for higher usage.

How to write a piecewise rule

  1. Identify the breakpoints — the x-values where the rate changes. These come from the problem context (e.g. “first 100 km”, “after 10 visits”).
  2. Write the domain for each piece — be precise with ≤ and <. The breakpoint belongs to exactly one piece.
  3. Write the rule for each piece — identify gradient and a known point, then write the rule. For a continuation from a breakpoint (x = b, y = k) with new rate m, write: y = k + m(x − b).
  4. Check continuity — evaluate both rules at the breakpoint. If they give the same value, the function is continuous (no jump). If different, it is discontinuous.

How to read a piecewise graph

Locate your x-value on the x-axis. Move vertically up until you hit the graph in the correct segment. Read the y-value. If x falls exactly on a breakpoint, check which piece uses a closed dot (•) vs open dot (ˆ) to determine which rule applies.

Example: Taxi fare: $3.50 flagfall + $2.20/km for first 5 km, then $1.60/km after 5 km.
Breakpoint at d = 5 km: cost = 3.50 + 2.20(5) = $14.50
Rule 1 (0 ≤ d ≤ 5): C = 2.20d + 3.50
Rule 2 (d > 5): C = 14.50 + 1.60(d − 5)
At d = 8: C = 14.50 + 1.60(3) = 14.50 + 4.80 = $19.30
Tip: When writing rule 2, use the “starting value at the breakpoint + new rate × extra distance” form: C = [value at breakpoint] + m&sub2;(x − breakpoint). This avoids recalculating from scratch.

Gradient in each section

Each section of a piecewise graph has its own gradient. You calculate it only using points within that section. The gradient represents the rate of change for that interval (e.g. cost per additional km in zone 2 only).

Tip: If the gradient of a section is zero, the function is flat (constant) in that interval. This is common in piecewise pricing (e.g. free allowance — cost doesn’t increase until you exceed the limit).

Mastery Practice

  1. Fluency

    An electricity tariff charges $0.18 per kWh for the first 500 kWh used, and $0.25 per kWh for any usage above 500 kWh. Find the electricity cost for each of the following monthly usages.

    1. (a) 300 kWh
    2. (b) 500 kWh
    3. (c) 750 kWh
  2. Fluency

    Write a piecewise rule for the electricity cost C (in $) in terms of usage u (in kWh) described in Question 1 above.

    The tariff is: $0.18 per kWh for 0 ≤ u ≤ 500, then $0.25 per kWh for u > 500.

  3. Fluency

    A gym charges for visits as follows: the first 10 visits per month cost $8 each; any visits after the first 10 cost $4 each (reduced rate for frequent members).

    1. (a) Write a piecewise rule for the monthly cost C in terms of the number of visits v.
    2. (b) Find the monthly cost for 7 visits.
    3. (c) Find the monthly cost for 15 visits.
  4. Understanding

    A taxi charges $3.50 flagfall, then $2.20 per km for the first 10 km, and $1.80 per km for any distance beyond 10 km.

    1. (a) Write a piecewise rule for the total fare C in terms of distance d (km).
    2. (b) Find the fare for: (i) 6 km; (ii) 10 km; (iii) 18 km.
    3. (c) A passenger pays $29.30. What distance did they travel?
  5. Understanding

    Consider the piecewise function below, where C is a cost in dollars and t is time in hours:

    C = { 20             if 0 ≤ t ≤ 2
       { 20 + 8(t − 2)   if 2 < t ≤ 6
       { 52 + 12(t − 6) if t > 6
    1. (a) Find C at t = 0, t = 2, t = 5, and t = 8.
    2. (b) Describe a real-world context that this piecewise model could represent.
    3. (c) Identify the gradient in each of the three sections and explain what each gradient means in the context you described.
  6. Understanding

    An internet plan includes 50 GB of data for a flat fee of $60 per month. Any data above 50 GB is charged at $10 per extra 10 GB (or part thereof — but for this question, treat it as a continuous rate of $1 per GB).

    1. (a) Write a piecewise rule for the monthly bill B in terms of data used d (GB).
    2. (b) Find the monthly bill for 42 GB.
    3. (c) Find the monthly bill for 75 GB.
    4. (d) Find the monthly bill for 120 GB.
  7. Understanding

    The temperature during a summer day rises at a rate of 3°C per hour from 8 am, starting at 12°C, until reaching its maximum at 2 pm. After 2 pm, the temperature drops at 2°C per hour.

    1. (a) Let h be the number of hours after 8 am. Write a piecewise linear model for temperature T (°C) in terms of h.
    2. (b) What is the maximum temperature, and at what time does it occur?
    3. (c) Find the temperature at 5 pm.
    4. (d) At what time does the temperature return to 12°C in the evening?
  8. Understanding

    Two companies offer delivery pricing as follows. Company A: flat fee of $50 plus $0.30 per km. Company B: $0.40 per km for the first 100 km, then $0.20 per km for any distance beyond 100 km.

    1. (a) Write the cost rule for Company A (note: it is a single linear rule, not piecewise).
    2. (b) Write the piecewise cost rule for Company B.
    3. (c) Find the cost with each company for an 80 km delivery.
    4. (d) Find the cost with each company for a 200 km delivery.
    5. (e) For distances greater than 100 km, find the distance at which the two companies charge exactly the same amount.
  9. Problem Solving

    An employee’s weekly pay follows this overtime structure: the standard week is 38 hours at $22 per hour. Overtime in the first 4 extra hours (hours 39–42) is paid at 1.5 times the normal rate. Any additional hours beyond 42 are paid at double the normal rate.

    1. (a) Calculate the overtime rates per hour (1.5× and 2×).
    2. (b) Write a piecewise rule for weekly pay P in terms of total hours worked h.
    3. (c) Calculate the weekly pay for: (i) 38 hours; (ii) 42 hours; (iii) 50 hours.
    4. (d) If an employee’s target is to earn at least $1 200 per week, what is the minimum number of hours they need to work?
  10. Problem Solving

    A sales commission structure works as follows: 0% commission on sales up to $1 000; 5% commission on sales from $1 001 to $5 000 (applied only to the amount above $1 000); 8% commission on the full amount if total sales exceed $5 000.

    1. (a) Write a piecewise rule for commission earnings E in terms of sales amount S.
    2. (b) Calculate earnings for: (i) $800 in sales; (ii) $3 500 in sales; (iii) $7 200 in sales.
    3. (c) At what sales amount does the 8% (applied to the full amount) first produce higher earnings than the 5% rule (applied only to the amount above $1 000)?
    4. (d) Explain why a salesperson might be motivated to either stay below $5 000 or push well above $5 000 in sales in a given month.