Algebra 1 · Grades 9, 10

Piecewise, Absolute Value and Step Functions

Quick answer

A piecewise function uses different rules on different intervals of its domain, the way overtime pay switches rates after 40 hours. To evaluate one, find the interval the input falls in and use that rule. Each input may get only one output, so at a boundary exactly one rule applies, and the graph marks which with a filled dot and an open one. Absolute value and step functions are piecewise functions too.

What you'll learn

  • Evaluate a piecewise function by choosing the right rule
  • Graph piecewise, absolute value and step functions with correct endpoints
  • Write a piecewise function from a description

One function, several rules

A job pays 1818 dollars an hour. Hours past 4040 in a week are overtime, paid at time and a half, which is 2727 dollars an hour.

A single formula cannot describe that pay, because the rate changes at 4040 hours. Two rules can, each with the interval where it applies.

P(h)={18h,0≤h≤40720+27(h−40),h>40P(h) = \begin{cases} 18h, & 0 \le h \le 40 \\[4pt] 720 + 27(h - 40), & h > 40 \end{cases}

The second rule starts from 720720, the pay for the first 4040 hours, and adds 2727 for each hour beyond them. This is a piecewise function.

Weekly pay with overtime after 40 hours A line rising from the origin to (40, 720), then continuing from that point as a steeper line, reaching 1260 dollars at 60 hours. 10203040506025050075010001250xy (40, 720)
  • P(h), dollars
Weekly pay with overtime after 40 hours

The graph bends at h=40h = 40 and gets steeper there. The corner is where the rule changes.

Evaluating

To evaluate, find which interval holds the input, then use that rule and no other.

hhIntervalRuleP(h)P(h)
30300≤h≤400 \le h \le 4018h18h540540
40400≤h≤400 \le h \le 4018h18h720720
4545h>40h > 40720+27(h−40)720 + 27(h - 40)855855

Why the endpoints need open and closed dots

A function gives exactly one output for each input. So at a boundary, only one rule may apply, and the inequality signs decide which.

Take a function whose two pieces do not meet:

g(x)={x+1,x<2x−3,x≥2g(x) = \begin{cases} x + 1, & x < 2 \\[4pt] x - 3, & x \ge 2 \end{cases}

At x=2x = 2 the first rule does not apply, because 2<22 < 2 is false. The second rule does, so g(2)=2−3=−1g(2) = 2 - 3 = -1.

The first piece still runs up to x=2x = 2 — it gets as close as it likes — but it never includes it. Its line would end at (2,3)(2, 3), and that point is not on the graph.

A piecewise function with a jump at x = 2 A line rising toward the point (2, 3), which is drawn as an open circle, and a second line starting at the filled point (2, -1) and rising to the right. -2246-4-2246xy
  • g(x)
A piecewise function with a jump at x = 2
DotMeans
filledthe point is on the graph
openthe piece stops here without including it

If both pieces claimed x=2x = 2, the input 22 would have two outputs, 33 and −1-1. That would not be a function at all, which is why the dots are information and not decoration.

When the two pieces meet at the same point, as the overtime pay does at (40,720)(40, 720), one filled dot covers both and the graph has no gap.

Absolute value

Absolute value is a piecewise function in disguise.

∣x∣={x,x≥0−x,x<0|x| = \begin{cases} x, & x \ge 0 \\[4pt] -x, & x < 0 \end{cases}

Each rule is a straight line, and they meet at the origin, which gives the graph its V shape. The point of the V is the vertex.

Shifting works as it does for any function. The graph of y=∣x−h∣+ky = |x - h| + k is the V moved so its vertex sits at (h,k)(h, k).

The graph of y = |x − 2| − 3 A V-shaped graph with its lowest point at (2, -3), crossing the x-axis at -1 and at 5. -4-22468-4-2246xy vertex (2, −3) (−1, 0) (5, 0)
  • y = |x − 2| − 3
The graph of y = |x − 2| − 3

The vertex is the minimum, −3-3. The zeros sit 33 units either side of it, because each arm climbs 11 unit per unit across.

Step functions

A step function is a piecewise function whose pieces are all constant, so its graph looks like a staircase.

A parking garage charges 55 dollars for the first hour or any part of it, and 33 dollars for each additional hour or part of one.

C(t)={5,0<t≤18,1<t≤211,2<t≤314,3<t≤4C(t) = \begin{cases} 5, & 0 < t \le 1 \\[2pt] 8, & 1 < t \le 2 \\[2pt] 11, & 2 < t \le 3 \\[2pt] 14, & 3 < t \le 4 \end{cases}
Parking cost by hours parked Four horizontal steps at heights 5, 8, 11 and 14 dollars, each one hour wide. Each step has an open circle at its left end and a filled dot at its right end. 123451015xy
  • C(t), dollars
Parking cost by hours parked

Exactly one hour costs 55, the closed dot at (1,5)(1, 5). One minute more jumps to 88, which is why the next step starts with an open dot.

Worked examples

Common mistakes

Practice problems

  1. Using the overtime pay P(h)P(h), find P(30)P(30) and P(45)P(45).

    Answer

    P(30)=540P(30) = 540 and P(45)=855P(45) = 855

    Full solution

    30≤4030 \le 40, so P(30)=18(30)=540P(30) = 18(30) = 540.

    45>4045 > 40, so P(45)=720+27(5)=720+135=855P(45) = 720 + 27(5) = 720 + 135 = 855.

  2. For f(x)={x2,x<0x+3,x≥0f(x) = \begin{cases} x^2, & x < 0 \\ x + 3, & x \ge 0 \end{cases}, find f(−2)f(-2), f(0)f(0) and f(4)f(4).

    Answer

    44, 33 and 77

    Full solution

    −2<0-2 < 0, so f(−2)=(−2)2=4f(-2) = (-2)^2 = 4.

    0≥00 \ge 0, so f(0)=0+3=3f(0) = 0 + 3 = 3.

    4≥04 \ge 0, so f(4)=4+3=7f(4) = 4 + 3 = 7.

  3. For f(x)={2x,x<15,x≥1f(x) = \begin{cases} 2x, & x < 1 \\ 5, & x \ge 1 \end{cases}, where are the open and closed dots at x=1x = 1?

    Answer

    An open dot at (1,2)(1, 2) and a closed dot at (1,5)(1, 5).

    Full solution

    The first piece runs toward x=1x = 1 without including it, so it ends at (1,2)(1, 2) with an open dot.

    The second piece includes x=1x = 1, so (1,5)(1, 5) is on the graph with a closed dot.

  4. Find the vertex and the zeros of y=∣x+1∣−2y = |x + 1| - 2.

    Answer

    Vertex (−1,−2)(-1, -2); zeros x=−3x = -3 and x=1x = 1.

    Full solution

    ∣x+1∣|x + 1| is ∣x−(−1)∣|x - (-1)|, so the vertex sits at x=−1x = -1, and the −2-2 puts it at height −2-2.

    Each arm rises 11 per unit across, so it takes 22 units either side to climb to 00: x=−3x = -3 and x=1x = 1.

    Check: ∣−3+1∣−2=0|-3 + 1| - 2 = 0 ✓ and ∣1+1∣−2=0|1 + 1| - 2 = 0 ✓

  5. Using the parking cost C(t)C(t), find the cost of 2.52.5 hours and of exactly 22 hours.

    Answer

    1111 dollars and 88 dollars.

    Full solution

    2.52.5 is in 2<t≤32 < t \le 3, so it costs 1111.

    22 is in 1<t≤21 < t \le 2, so it costs 88. The closed dot at (2,8)(2, 8) shows that exactly two hours stays on the lower step.

  6. Write ∣x+3∣|x + 3| as a piecewise function.

    Answer

    x+3x + 3 when x≥−3x \ge -3, and −x−3-x - 3 when x<−3x < -3.

    Full solution

    The inside, x+3x + 3, is zero or positive when x≥−3x \ge -3, so it stays as it is.

    When x<−3x < -3 the inside is negative, and absolute value flips its sign: −(x+3)=−x−3-(x + 3) = -x - 3.

  7. Is h(x)={x2,x≤1x+1,x≥1h(x) = \begin{cases} x^2, & x \le 1 \\ x + 1, & x \ge 1 \end{cases} a function?

    Hint

    Which rules apply at x=1x = 1?

    Answer

    No. At x=1x = 1 both rules apply and give different outputs.

    Full solution

    Both intervals include 11. The first rule gives 12=11^2 = 1 and the second gives 1+1=21 + 1 = 2.

    One input with two outputs breaks the definition of a function. Changing either ≤\le or ≥\ge to a strict inequality would repair it.

  8. Using the phone plan C(g)C(g), find the cost of 33 GB and of 1212 GB.

    Answer

    3030 dollars and 100100 dollars.

    Full solution

    3≤53 \le 5, so C(3)=30C(3) = 30.

    12>512 > 5, so C(12)=30+10(7)=100C(12) = 30 + 10(7) = 100.

  9. Find ⌊6.9⌋\lfloor 6.9 \rfloor, ⌊−0.5⌋\lfloor -0.5 \rfloor and ⌊−3⌋\lfloor -3 \rfloor.

    Answer

    66, −1-1 and −3-3

    Full solution

    The floor is the greatest integer at or below the number.

    Below 6.96.9 that is 66. Below −0.5-0.5 it is −1-1, not 00, since 00 is above −0.5-0.5. And −3-3 is already an integer, so its floor is itself.

  10. Asked for the pay for a 4545-hour week, Carlos computes 45×27=1,21545 \times 27 = 1{,}215 dollars. Find his error.

    Hint

    Which hours are paid at the overtime rate?

    Answer

    He paid every hour at the overtime rate. The correct pay is 855855 dollars.

    Full solution

    Only the hours past 4040 earn 2727 dollars. The first 4040 earn 1818 each.

    P(45)=18(40)+27(5)=720+135=855P(45) = 18(40) + 27(5) = 720 + 135 = 855.

    Carlos’s answer treats the second rule as if it applied from hour zero. A piecewise rule applies only on its own interval, and the overtime interval starts at 4040.

Frequently asked questions

What is a piecewise function?

A function defined by different rules on different parts of its domain. Each rule comes with an interval that says where it applies.

How do I evaluate a piecewise function?

Find the interval that contains the input, then use only that interval's rule. The other rules do not apply to that input.

What do open and closed dots mean?

A closed dot is a point on the graph. An open dot marks where a piece stops without including its endpoint, so the function does not take that value there.

Is absolute value a piecewise function?

Yes. |x| is x when x is zero or positive, and −x when x is negative. The two rules meet at the vertex of the V.

What is a step function?

A piecewise function whose pieces are all constant, so the graph looks like stairs. Parking fees charged per started hour are a common example.

What to learn next

Standards alignment

This lesson covers the following Common Core State Standards for Mathematics.

  • CCSS.MATH.CONTENT.HSF.IF.C.7Interpreting FunctionsGraph functions expressed symbolically and show key features of the graph, by hand in simple cases and using technology for more complicated cases.
  • CCSS.MATH.CONTENT.HSF.IF.C.7bInterpreting FunctionsGraph square root, cube root, and piecewise-defined functions, including step functions and absolute value functions.