Skip to content
Family Table Math
Auto

Piecewise Models

Real situations often change their rules partway through. A phone plan charges nothing extra until you pass your data limit; income tax uses a higher rate once you earn more than a threshold; a train speeds up, cruises, then brakes. A single formula can’t describe these, but a piecewise function, with a different formula on each interval, can. This page shows you how to read, evaluate and graph piecewise models, how to choose a parameter so the pieces join up, and how to work backwards from an output to an input.

A piecewise function lists each formula with the interval where it applies:

f(x)={2x,0≤x<36,3≤x≤8f(x) = \begin{cases} 2x, & 0 \le x \lt 3 \\ 6, & 3 \le x \le 8 \end{cases}

To evaluate ff at a given input, first decide which interval the input belongs to, then use only that formula. Here f(1)=2(1)=2f(1) = 2(1) = 2 and f(5)=6f(5) = 6. Watch the inequality signs at the boundaries: x=3x = 3 belongs to the second piece (because of 3≤x3 \le x), so f(3)=6f(3) = 6.

Graph each formula only over its own interval.

  • A closed dot marks an endpoint that is included (≤\le or ≥\ge).
  • An open dot marks an endpoint that is excluded (<\lt or >\gt).
  • Your GDC can graph each piece separately if you restrict the domain of each one.

At a boundary x=kx = k, the pieces meet (the graph has no jump) when both formulas give the same value at x=kx = k. A function whose graph can be drawn without lifting your pencil is called continuous. (You don’t need the formal definition; see continuity if you’re curious.)

To find a parameter that makes a piecewise model continuous at x=kx = k:

  1. Substitute x=kx = k into the formula on the left of the boundary.
  2. Substitute x=kx = k into the formula on the right.
  3. Set the two results equal and solve for the parameter.

Many models should be continuous: a speed can’t jump instantly, and a pool’s floor has no cliffs. Others are naturally not continuous, like shipping costs that jump from one price to the next.

A step function is a piecewise function where every piece is constant, like postage rates or parking fees “per hour or part of an hour”. Its graph looks like a staircase, with an open dot at one end of each step and a closed dot at the other.

To solve f(x)=cf(x) = c for a piecewise function:

  1. Find the range of outputs on each piece (often just by evaluating at the boundaries).
  2. Only solve on the pieces whose range contains cc.
  3. Check that each solution lies in that piece’s interval. Reject any that don’t.

There may be more than one answer (a speed of 1212 m/s while speeding up and again while slowing down), or none (no parcel costs exactly $15 if prices jump from $12 to $18).

A tram leaves a stop. Its speed vv m/s after tt seconds is

v(t)={1.5t,0≤t<1015,10≤t<4015−0.75(t−40),40≤t≤60v(t) = \begin{cases} 1.5t, & 0 \le t \lt 10 \\ 15, & 10 \le t \lt 40 \\ 15 - 0.75(t - 40), & 40 \le t \le 60 \end{cases}
  • (a) Find v(6)v(6), v(25)v(25) and v(50)v(50).
  • (b) Show that the speed is continuous at t=10t = 10 and t=40t = 40.
  • (c) Find all times when the speed is 1212 m/s.

Solution.

(a) t=6t = 6 is in the first piece: v(6)=1.5(6)=9v(6) = 1.5(6) = 9 m/s. t=25t = 25 is in the second: v(25)=15v(25) = 15 m/s. t=50t = 50 is in the third: v(50)=15−0.75(10)=7.5v(50) = 15 - 0.75(10) = 7.5 m/s.

(b) At t=10t = 10: the first formula gives 1.5(10)=151.5(10) = 15, and the second gives 1515. They agree. At t=40t = 40: the second gives 1515 and the third gives 15−0.75(0)=1515 - 0.75(0) = 15. They agree. So the speed has no jumps, which makes sense for a real tram.

(c) The first piece takes values from 00 up to (not including) 1515, and the third takes values from 1515 down to 00, so both can give 1212. The middle piece is always 1515, so it can’t.

1.5t=12⇒t=8(in 0≤t<10 ✓)15−0.75(t−40)=12⇒t−40=4 ⇒ t=44(in 40≤t≤60 ✓)\begin{aligned} 1.5t &= 12 &&\Rightarrow\quad t = 8 &&\text{(in } 0 \le t \lt 10 \text{ }\checkmark\text{)} \\ 15 - 0.75(t - 40) &= 12 &&\Rightarrow\quad t - 40 = 4 \ \Rightarrow\ t = 44 &&\text{(in } 40 \le t \le 60 \text{ }\checkmark\text{)} \end{aligned}

The tram is moving at 1212 m/s at t=8t = 8 s (speeding up) and at t=44t = 44 s (slowing down).

Speed of a tram: rising in a straight line from 0 to 15 m/s over the first 10 s, constant at 15 m/s until 40 s, then falling to 0 at 60 s. The line v = 12 meets the graph at t = 8 and t = 44. 10 20 30 40 50 60 3 6 9 12 15 18 (8, 12) (44, 12) (10, 15) (40, 15) v = 12 time t (s) speed v (m/s)
The pieces meet at t=10t = 10 and t=40t = 40, and the line v=12v = 12 crosses the graph twice.

The height hh metres of a playground slide, xx metres horizontally from the top of the ladder, is

h(x)={4−0.5x,0≤x<4a(x−6)2,4≤x≤6h(x) = \begin{cases} 4 - 0.5x, & 0 \le x \lt 4 \\ a(x - 6)^2, & 4 \le x \le 6 \end{cases}
  • (a) Find the value of aa that makes the slide continuous.
  • (b) Find h(5)h(5).
  • (c) Find where the slide is 11 m high.

Solution.

(a) At x=4x = 4, the left piece gives 4−0.5(4)=24 - 0.5(4) = 2 and the right piece gives a(4−6)2=4aa(4 - 6)^2 = 4a. Set them equal:

4a=2⇒a=0.54a = 2 \quad\Rightarrow\quad a = 0.5

(b) x=5x = 5 is in the second piece: h(5)=0.5(5−6)2=0.5h(5) = 0.5(5 - 6)^2 = 0.5 m.

(c) First piece: 4−0.5x=14 - 0.5x = 1 gives x=6x = 6, but the first piece only applies for 0≤x<40 \le x \lt 4, so reject it. (This piece only takes heights between 22 and 44.)

Second piece: 0.5(x−6)2=10.5(x - 6)^2 = 1 gives (x−6)2=2(x - 6)^2 = 2, so x=6±2x = 6 \pm \sqrt{2}. Only x=6−2≈4.59x = 6 - \sqrt{2} \approx 4.59 lies in 4≤x≤64 \le x \le 6.

The slide is 11 m high at x=6−2≈4.59x = 6 - \sqrt{2} \approx 4.59 m (3 s.f.).

In a (fictional) country, income tax is charged as follows:

Taxable incomeRate on income in this band
first $15 0000%0\%
over $15 000 up to $50 00020%20\%
over $50 00035%35\%
  • (a) Write the tax T(x)T(x) on an income of xx dollars as a piecewise function.
  • (b) Find the tax on incomes of $40 000 and $80 000.
  • (c) Mei pays $12 000 in tax. Find her income, and the percentage of her income she pays in tax.

Solution.

(a) Each rate applies only to the part of the income inside its band. On the first $15 000 there’s no tax. On an income in the second band, 20%20\% is paid on the amount above $15 000. The tax on a full second band is 0.20×35 000=70000.20 \times 35\,000 = 7000 dollars, and income above $50 000 is taxed at 35%35\%:

T(x)={0,0≤x≤15 0000.2(x−15 000),15 000<x≤50 0007000+0.35(x−50 000),x>50 000T(x) = \begin{cases} 0, & 0 \le x \le 15\,000 \\ 0.2(x - 15\,000), & 15\,000 \lt x \le 50\,000 \\ 7000 + 0.35(x - 50\,000), & x \gt 50\,000 \end{cases}

Check the joins: at 15 00015\,000 both formulas give 00; at 50 00050\,000 both give 70007000. So TT is continuous, which is how real tax systems work (earning one more dollar never makes your tax jump).

(b) T(40 000)=0.2(25 000)=5000T(40\,000) = 0.2(25\,000) = 5000, so $5000.

T(80 000)=7000+0.35(30 000)=7000+10 500=17 500T(80\,000) = 7000 + 0.35(30\,000) = 7000 + 10\,500 = 17\,500, so $17 500.

(c) The second band produces at most $7000 of tax, so Mei’s income is in the third band:

7000+0.35(x−50 000)=12 000⇒x−50 000=50000.35≈14 285.717000 + 0.35(x - 50\,000) = 12\,000 \quad\Rightarrow\quad x - 50\,000 = \frac{5000}{0.35} \approx 14\,285.71

Her income is about $64 285.71, roughly $64 300 (3 s.f.). Her tax is 12 00064 285.71≈18.7%\dfrac{12\,000}{64\,285.71} \approx 18.7\% of her income, much less than her top rate of 35%35\%.

Example 4: Shipping costs as a step function

Section titled “Example 4: Shipping costs as a step function”

A courier charges by mass mm (kg) for parcels up to 1010 kg:

C(m)={8,0<m≤112,1<m≤318,3<m≤525,5<m≤10C(m) = \begin{cases} 8, & 0 \lt m \le 1 \\ 12, & 1 \lt m \le 3 \\ 18, & 3 \lt m \le 5 \\ 25, & 5 \lt m \le 10 \end{cases}

where CC is in dollars.

  • (a) Find the cost of parcels of 33 kg and 3.23.2 kg.
  • (b) Sketch the graph.
  • (c) Is there a parcel that costs exactly $15?

Solution.

(a) m=3m = 3 is in 1<m≤31 \lt m \le 3, so it costs $12. m=3.2m = 3.2 is in 3<m≤53 \lt m \le 5, so it costs $18. An extra 0.20.2 kg costs $6 more!

(b)

Step graph of shipping cost: 8 dollars for masses up to 1 kg, 12 dollars over 1 kg up to 3 kg, 18 dollars over 3 kg up to 5 kg, and 25 dollars over 5 kg up to 10 kg. Each step has an open dot at its left end and a closed dot at its right end. 1 2 3 4 5 6 7 8 9 10 5 10 15 20 25 mass m (kg) cost ($)
Each step includes its right endpoint (closed dot) but not its left endpoint (open dot).

(c) No. The only possible costs are $8, $12, $18 and $25, so the equation C(m)=15C(m) = 15 has no solution. This model is not continuous: it jumps at m=1m = 1, 33 and 55.

Using the wrong piece at a boundary. At x=3x = 3 in {2x,x<36,x≥3\begin{cases} 2x, & x \lt 3 \\ 6, & x \ge 3 \end{cases}, only the second piece applies. Read the inequality signs carefully before substituting.

Applying a tax rate to the whole income. A 35%35\% top rate means 35%35\% of the part above the threshold, not of everything. Add the full tax from each lower band, then the top rate on the remainder only.

Keeping solutions outside their piece. When you solve f(x)=cf(x) = c on each piece, every answer must be checked against that piece’s interval. In Example 2, x=6x = 6 solved the first formula but wasn’t in 0≤x<40 \le x \lt 4.

Missing a second solution. A piecewise function can take the same value on two pieces. Check the range of every piece, not just the first one that works.

Setting the wrong things equal for continuity. To make the pieces meet at x=kx = k, substitute the same boundary value x=kx = k into both formulas. Don’t set the formulas equal to each other as equations in xx.

Joining the dots across a jump. Step functions and other discontinuous models must be drawn with open and closed dots and gaps, not as one connected line.

1. (Warm-up) Let f(x)={x2,x<13x−2,x≥1f(x) = \begin{cases} x^2, & x \lt 1 \\ 3x - 2, & x \ge 1 \end{cases}.

  • (a) Find f(−2)f(-2), f(1)f(1) and f(4)f(4).
  • (b) Is ff continuous at x=1x = 1? Explain.
Solution

(a) f(−2)=(−2)2=4f(-2) = (-2)^2 = 4; f(1)=3(1)−2=1f(1) = 3(1) - 2 = 1; f(4)=3(4)−2=10f(4) = 3(4) - 2 = 10.

(b) Yes. At x=1x = 1 the first formula gives 12=11^2 = 1 and the second gives 3(1)−2=13(1) - 2 = 1. The pieces meet.

2. (Warm-up) A car park charges $3 for the first hour or part of an hour, then $2 for each additional hour or part of an hour, up to a maximum of $15 per day. Find the cost of parking for 4545 minutes, 2.52.5 hours and 1010 hours.

Solution

4545 minutes: part of the first hour, so $3.

2.52.5 hours: charged as 33 hours (the half hour counts as a full hour), so 3+2+2=73 + 2 + 2 = 7, which is $7.

1010 hours: 3+2(9)=213 + 2(9) = 21 dollars, but the daily maximum is $15, so $15.

3. (Warm-up) A phone plan costs $30 per month, which includes 55 GB of data. Extra data costs $6 per GB (charged for the exact amount used). Write the monthly cost CC as a piecewise function of the data used, gg GB, and find the cost when 88 GB are used.

SolutionC(g)={30,0≤g≤530+6(g−5),g>5C(g) = \begin{cases} 30, & 0 \le g \le 5 \\ 30 + 6(g - 5), & g \gt 5 \end{cases}

C(8)=30+6(3)=48C(8) = 30 + 6(3) = 48, so $48.

4. (Core) Let f(x)={kx+1,0≤x<3x2−k,x≥3f(x) = \begin{cases} kx + 1, & 0 \le x \lt 3 \\ x^2 - k, & x \ge 3 \end{cases}.

  • (a) Find the value of kk that makes ff continuous.
  • (b) For this value of kk, find f(2)f(2) and f(5)f(5).
Solution

(a) At x=3x = 3: 3k+1=9−k3k + 1 = 9 - k, so 4k=84k = 8 and k=2k = 2.

(b) f(2)=2(2)+1=5f(2) = 2(2) + 1 = 5 and f(5)=25−2=23f(5) = 25 - 2 = 23.

5. (Core) Another country’s income tax is 10%10\% on the first $20 000, 25%25\% on income over $20 000 up to $60 000, and 40%40\% on income over $60 000.

  • (a) Find the tax on an income of $45 000.
  • (b) Write the tax T(x)T(x) as a piecewise function of the income xx dollars.
  • (c) Find the income of someone who pays $22 000 in tax.
Solution

(a) 0.10(20 000)+0.25(25 000)=2000+6250=82500.10(20\,000) + 0.25(25\,000) = 2000 + 6250 = 8250, so $8250.

(b) A full first band gives $2000 of tax, and a full second band gives a further 0.25(40 000)=10 0000.25(40\,000) = 10\,000, so $12 000 in total at $60 000.

T(x)={0.1x,0≤x≤20 0002000+0.25(x−20 000),20 000<x≤60 00012 000+0.4(x−60 000),x>60 000T(x) = \begin{cases} 0.1x, & 0 \le x \le 20\,000 \\ 2000 + 0.25(x - 20\,000), & 20\,000 \lt x \le 60\,000 \\ 12\,000 + 0.4(x - 60\,000), & x \gt 60\,000 \end{cases}

(c) $22 000 is more than $12 000, so the income is in the top band:

12 000+0.4(x−60 000)=22 000⇒x−60 000=25 000⇒x=85 00012\,000 + 0.4(x - 60\,000) = 22\,000 \quad\Rightarrow\quad x - 60\,000 = 25\,000 \quad\Rightarrow\quad x = 85\,000

The income is $85 000.

6. (Core) A swimming pool is 2525 m long. Its depth is 1.21.2 m for the first 1010 m from the shallow end, then the floor slopes down in a straight line to a depth of 3.23.2 m at 1818 m from the shallow end, and the depth stays at 3.23.2 m for the rest of the pool.

  • (a) Write the depth dd metres as a piecewise function of the distance xx metres from the shallow end.
  • (b) Find where the depth is 22 m.
Solution

(a) On the sloping part, the depth increases by 3.2−1.2=23.2 - 1.2 = 2 m over 18−10=818 - 10 = 8 m, a slope of 0.250.25.

d(x)={1.2,0≤x<101.2+0.25(x−10),10≤x<183.2,18≤x≤25d(x) = \begin{cases} 1.2, & 0 \le x \lt 10 \\ 1.2 + 0.25(x - 10), & 10 \le x \lt 18 \\ 3.2, & 18 \le x \le 25 \end{cases}

(b) Only the middle piece takes the value 22: 1.2+0.25(x−10)=21.2 + 0.25(x - 10) = 2 gives x−10=3.2x - 10 = 3.2, so x=13.2x = 13.2 m from the shallow end.

7. (Core) A taxi charges a fixed fee of $4.50, plus $2.10 per kilometre for the first 1010 km and $1.60 per kilometre for every kilometre after that.

  • (a) Write the fare FF dollars as a piecewise function of the distance dd km.
  • (b) Find the fare for 66 km and for 1515 km.
  • (c) A trip costs $45.30. How far was it?
Solution

(a) After 1010 km the fare is 4.50+2.10(10)=25.504.50 + 2.10(10) = 25.50 dollars.

F(d)={4.5+2.1d,0≤d≤1025.5+1.6(d−10),d>10F(d) = \begin{cases} 4.5 + 2.1d, & 0 \le d \le 10 \\ 25.5 + 1.6(d - 10), & d \gt 10 \end{cases}

(b) F(6)=4.5+12.6=17.1F(6) = 4.5 + 12.6 = 17.1, so $17.10. F(15)=25.5+1.6(5)=33.5F(15) = 25.5 + 1.6(5) = 33.5, so $33.50.

(c) $45.30 is more than $25.50, so the trip was longer than 1010 km:

25.5+1.6(d−10)=45.3⇒d−10=19.81.6=12.375⇒d=22.37525.5 + 1.6(d - 10) = 45.3 \quad\Rightarrow\quad d - 10 = \frac{19.8}{1.6} = 12.375 \quad\Rightarrow\quad d = 22.375

The trip was about 22.422.4 km (3 s.f.).

8. (Challenge) A skydiver jumps from a plane. A simple model for her height hh metres after tt seconds is

h(t)={1200−4.9t2,0≤t≤10a−6t,t>10h(t) = \begin{cases} 1200 - 4.9t^2, & 0 \le t \le 10 \\ a - 6t, & t \gt 10 \end{cases}

where the parachute opens at t=10t = 10.

  • (a) Find the value of aa that makes hh continuous.
  • (b) Find when she lands.
  • (c) In the first piece her speed at t=10t = 10 is 9.8×10=989.8 \times 10 = 98 m/s, and in the second it is 66 m/s. Comment on the model.
Solution

(a) At t=10t = 10: 1200−4.9(100)=7101200 - 4.9(100) = 710, and a−6(10)=a−60a - 6(10) = a - 60. So a−60=710a - 60 = 710 and a=770a = 770.

(b) She lands when 770−6t=0770 - 6t = 0, so t=7706≈128t = \dfrac{770}{6} \approx 128 s (3 s.f.). (Check: this is after t=10t = 10, so it’s in the second piece. ✓)

(c) The height is continuous, but the speed jumps from 9898 m/s to 66 m/s instantly, which is impossible: a real parachute takes a few seconds to slow her down. The free-fall piece also ignores air resistance, which would keep her speed well below 9898 m/s. The model is reasonable for rough timings, but not for describing the motion near t=10t = 10.

9. (Challenge) Let

f(x)={ax+1,0≤x<2x2+b,2≤x<430−2x,4≤x≤8f(x) = \begin{cases} ax + 1, & 0 \le x \lt 2 \\ x^2 + b, & 2 \le x \lt 4 \\ 30 - 2x, & 4 \le x \le 8 \end{cases}
  • (a) Find aa and bb so that ff is continuous.
  • (b) Solve f(x)=12f(x) = 12.
Solution

(a) At x=4x = 4: 16+b=30−8=2216 + b = 30 - 8 = 22, so b=6b = 6. At x=2x = 2: 2a+1=4+6=102a + 1 = 4 + 6 = 10, so a=4.5a = 4.5.

(b) Find the outputs on each piece. First piece: 4.5x+14.5x + 1 goes from 11 up to (not including) 1010, so it never equals 1212. Second piece: x2+6x^2 + 6 goes from 1010 up to (not including) 2222. Third piece: 30−2x30 - 2x goes from 2222 down to 1414, so it never equals 1212.

Only the second piece works: x2+6=12x^2 + 6 = 12 gives x2=6x^2 = 6, so x=±6x = \pm\sqrt{6}. Only x=6≈2.45x = \sqrt{6} \approx 2.45 is in 2≤x<42 \le x \lt 4.

The solution is x=6≈2.45x = \sqrt{6} \approx 2.45 (3 s.f.).