Learn Index · Functions and Relations Grade 11–12

Piecewise-defined functions

A function with different rules on different parts of its domain.

Read

Different rules for different inputs

A piecewise function uses different formulas on different intervals of x.

f(x) = { x + 2, if x < 1; 3, if 1 ≤ x ≤ 4; −x + 7, if x > 4 }

Evaluating

Find which interval the input belongs to, then use that rule.

x Interval Rule f(x)
−2 x < 1 x + 2 0
1 1 ≤ x ≤ 4 3 3
4 1 ≤ x ≤ 4 3 3
6 x > 4 −x + 7 1

Pay close attention to the boundary points (here 1 and 4), where < vs ≤ decides the rule.

Graphing

  1. Graph each rule only over its interval.
  2. At each boundary, use a closed circle if the point is included (≤, ≥) and an open circle if not (<, >).

For the example:

  • A line y = x + 2 for x < 1, ending with an open circle at (1, 3).
  • A horizontal segment y = 3 from (1, 3) to (4, 3), closed at both ends.
  • A line y = −x + 7 for x > 4, starting with an open circle at (4, 3).

Since the open circle at (1, 3) is filled by the middle piece, the graph is connected there.

Continuous or not?

A piecewise function is continuous if the pieces join without gaps or jumps. The example is continuous; many real-world piecewise functions are not.

Absolute value is piecewise

The absolute value function is piecewise: |x| = { x, if x ≥ 0; −x, if x < 0 }

Step functions

A step function has constant pieces, like a staircase.

Example: Parking costs $5 for up to 1 hour, $8 for up to 2 hours, $10 for up to 3 hours.

Time t (h) Cost
0 < t ≤ 1 $5
1 < t ≤ 2 $8
2 < t ≤ 3 $10

The graph jumps at each boundary.

Real-world piecewise functions

  • Tax brackets: different rates on different income ranges.
  • Phone plans: flat fee up to a data limit, then a charge per GB.
  • Shipping: price tiers by weight.
  • Overtime pay: regular rate up to 44 h, then time and a half.

Example: Pay at $20/h with time and a half after 40 h:

P(h) = { 20h, 0 ≤ h ≤ 40; 800 + 30(h − 40), h > 40 }

P(45) = 800 + 150 = $950

Worked examples

Example 1: g(x) = { x², x ≤ 2; 10 − x, x > 2 }. g(2)? Uses x²: 4. g(5)? 5.

Example 2: Is g continuous at x = 2? Left value 4; right approaches 8. No, it jumps.

Example 3: Write |x − 3| as a piecewise function. { x − 3, x ≥ 3; 3 − x, x < 3 }

Common mistakes

  • Using the wrong rule at a boundary point.
  • Extending a piece beyond its interval.
  • Wrong circle type (open vs closed).

Try it yourself

h(x) = { −2x, x < 0; x + 1, x ≥ 0 }

  1. h(−3)
  2. h(0)
  3. h(5)
  4. Is h continuous at x = 0?
  5. Shipping costs $6 for up to 1 kg and $9 for over 1 kg up to 3 kg. Cost for 2.4 kg?

Answers: 1) 6 2) 1 3) 6 4) No: approaching from the left gives 0, but h(0) = 1. 5) $9

Quick recap

  • A piecewise function uses different rules on different intervals.
  • Check boundary points; use open circles and closed circles correctly.
  • Step functions model tiered pricing.