Knaph

Piecewise Functions and Moving Graphs38 of 1002 min read

Piecewise Functions

Priya's phone plan costs $10 a month for up to 5 gigabytes, then $4 for each extra gigabyte. One rule cannot describe both parts of the bill. How do you write a rule that changes partway?

A rule in pieces

A piecewise function uses a different rule on each interval of inputs. Here f(x)=x+2f(x) = x + 2 when x<1x \lt 1, and f(x)=5−xf(x) = 5 - x when x≥1x ≥ 1.

To find f(3)f(3), first ask which interval holds 3. It is x≥1x ≥ 1, so use the second rule: 5−3=25 - 3 = 2. For f(−2)f(-2), the input is below 1, so use the first rule: −2+2=0-2 + 2 = 0.

A graph of two line pieces. The left piece, y equals x plus 2, runs up to an open dot at (1, 3). The right piece, y equals 5 minus x, starts at a closed dot at (1, 4) and runs down to the right.

Graphing the pieces

Graph each rule only over its own interval. The input 1 is a boundary value: it belongs to exactly one piece. Here x≥1x ≥ 1 owns it, so the right piece has a closed dot at (1,4)(1, 4) and the left piece ends in an open dot at (1,3)(1, 3).

There is one output for each input, so f(1)=4f(1) = 4, never 3.

Writing one from a story

For Priya's plan, let xx be the gigabytes and C(x)C(x) the cost in dollars. Up to 5 gigabytes the cost is flat: C(x)=10C(x) = 10 when x≤5x ≤ 5. Beyond 5, add $4 for each extra one: C(x)=10+4(x−5)C(x) = 10 + 4(x - 5) when x>5x > 5.

Check 7 gigabytes: 10+4(2)=1810 + 4(2) = 18. Your turn: what is C(5)C(5)? Answer: 5 is in the first interval, so C(5)=10C(5) = 10.

A graph of cost against gigabytes. A flat line at 10 dollars from 0 to 5 gigabytes, then a line rising 4 dollars for each extra gigabyte, reaching 18 dollars at 7 gigabytes.

Careful

Do not use both rules at a boundary. Look at which piece has the equal sign, and use only that one.

Try it at home

  1. Invent a taxi fare: a flat fee, then a rate.
  2. Write it as a rule in two pieces, with an interval for each.
  3. Find the fare for 1 mile exactly and for 3 miles, naming the piece you used.

Words in this lesson

  • piecewise function - a function that uses a different rule on different intervals of input.
  • interval - all the numbers between two ends, such as every number from 1 up.
  • boundary value - an input where one piece ends and the next begins.

Big idea

A piecewise function is a rule in pieces. Find the piece the input belongs to, then use its rule, and give the boundary value to exactly one piece.

Test your understanding

Sign in to test your understanding of this lesson and track your progress.