Functions in pieces
Tonight's idea
A function does not need one rule for every input. A piecewise function uses different rules on different intervals, as postage, phone plans and income tax do. One bracket lists the rules:
\[f(x) = \begin{cases} -x & \text{if } x \lt 0 \\ x & \text{if } 0 \le x \lt 2 \\ 1 & \text{if } x \ge 2 \end{cases}\]
To evaluate it, first find the interval the input lies in, then use that rule only. So \(f(-3) = 3\), \(f(1.5) = 1.5\) and \(f(2) = 1\). Every input still gets exactly one output, so this is one function, not three.
The first two pieces together are \(|x|\), the absolute value from grade 10. At each boundary, ask whether the pieces join. Put the boundary value into both neighbouring rules. At \(x = 0\) both give 0, so the graph joins there, with a corner. At \(x = 2\) one rule gives 2 and the other gives 1, so the graph jumps.
Pieces join at a boundary exactly when both rules give the same value there.
Watch one: a tax schedule
Income is \(x\) thousand dollars. The tax is nothing on the first 10, 20% of the part between 10 and 40, and 40% of the part above 40. So the tax \(T(x)\), in thousands, is
\[T(x) = \begin{cases} 0 & \text{if } 0 \le x \le 10 \\ 0.2(x - 10) & \text{if } 10 \lt x \le 40 \\ 6 + 0.4(x - 40) & \text{if } x \gt 40 \end{cases}\]
The 6 is the tax already owed at 40, namely \(0.2 \times 30\). It makes the pieces join: at \(x = 40\) both rules give 6. So \(T(50) = 6 + 4 = 10\), and a raise never lowers take-home pay: only the extra dollars meet the higher rate.
Choose \(|x|\) from the menu, then shift and stretch it and watch its corner move: mathdetours.com/demos/transform.html.
Your turn
- Let \(g(x) = x + 3\) if \(x \lt 1\), \(g(x) = x^2\) if \(1 \le x \le 2\), and \(g(x) = 6 - x\) if \(x \gt 2\). Find \(g(-2)\), \(g(1)\), \(g(2)\) and \(g(5)\). Does the graph join or jump at \(x = 1\)? At \(x = 2\)?
- Write \(|2x - 6|\) as a piecewise function with two pieces. Use the pieces to solve \(|2x - 6| = x\). Check that each answer lies in the interval of its piece.
- Let \(h(x) = kx + 1\) if \(x \lt 2\) and \(h(x) = x^2 + 1\) if \(x \ge 2\). Find the value of \(k\) that makes the pieces join. With that \(k\), find \(h(h(1))\).
- Plan A costs $20 a month for up to 5 GB of data, then $4 for each extra GB. Plan B costs $35 a month for up to 10 GB, then $2 for each extra GB. Write each monthly cost as a piecewise function of the data used, \(x\) GB. For which values of \(x\) is plan A cheaper?
Stretch: fold it twice
On \(0 \le x \le 1\), let \(T(x) = 2x\) if \(x \le \tfrac12\) and \(T(x) = 2 - 2x\) if \(x \gt \tfrac12\). Write \(T(T(x))\) as a piecewise function with four pieces. Then find every \(x\) with \(T(T(x)) = x\).
Answers
- \(g(-2) = 1\), \(g(1) = 1\), \(g(2) = 4\), \(g(5) = 1\). At \(x = 1\) the rules give \(1 + 3 = 4\) and \(1^2 = 1\): a jump. At \(x = 2\) they give \(2^2 = 4\) and \(6 - 2 = 4\): a join.
- \(|2x - 6| = 2x - 6\) if \(x \ge 3\), and \(6 - 2x\) if \(x \lt 3\). First piece: \(2x - 6 = x\) gives \(x = 6\), and \(6 \ge 3\), so it counts. Second piece: \(6 - 2x = x\) gives \(x = 2\), and \(2 \lt 3\), so it counts. Solutions: \(x = 2\) and \(x = 6\).
- At \(x = 2\) the rules give \(2k + 1\) and \(5\), so \(k = 2\). Then \(h(1) = 2 + 1 = 3\), and \(3 \ge 2\), so \(h(3) = 9 + 1 = 10\). The inner output decides which rule the outer function uses.
- \(A(x) = 20\) if \(x \le 5\), and \(20 + 4(x - 5)\) if \(x \gt 5\). \(B(x) = 35\) if \(x \le 10\), and \(35 + 2(x - 10)\) if \(x \gt 10\). A starts cheaper. They are equal when \(20 + 4(x - 5) = 35\), so \(x = 8.75\). Beyond 10 GB, \(A = 4x\) and \(B = 2x + 15\), so B stays cheaper. Plan A is cheaper for \(x \lt 8.75\).
Stretch. The inner \(T\) switches rule at \(x = \tfrac12\), and the outer one switches when \(T(x) = \tfrac12\), at \(x = \tfrac14\) and \(\tfrac34\). So \(T(T(x))\) is \(4x\) on \([0, \tfrac14]\), \(2 - 4x\) on \((\tfrac14, \tfrac12]\), \(4x - 2\) on \((\tfrac12, \tfrac34]\) and \(4 - 4x\) on \((\tfrac34, 1]\). Setting each equal to \(x\) gives \(x = 0, \tfrac25, \tfrac23, \tfrac45\), and each lies in its own interval. Four solutions.