Lesson 1.5 · Unit 1 · F-IF.7b

One function, different rules on different intervals

A piecewise function uses one rule on part of its domain and a different rule elsewhere. Absolute value is the most common example, and rewriting it piecewise is what turns absolute value equations and inequalities into ordinary ones.

The method
  1. A piecewise rule lists a formula and the interval it applies on, and the intervals must not overlap.
  2. To evaluate, find which interval the input is in first, then use only that formula.
  3. To graph, draw each piece only on its interval, with a closed circle at an included endpoint and an open circle at an excluded one.
  4. Absolute value is piecewise: \( \left| x \right| = x \) when \( x \ge 0 \) and \( -x \) when \( x \lt 0 \).
  5. To solve \( \left| A \right| = b \) with \( b \gt 0 \), write \( A = b \) or \( A = -b \) and solve both.
  6. If \( b \lt 0 \) there is no solution, since an absolute value is never negative.
  7. \( \left| A \right| \lt b \) becomes \( -b \lt A \lt b \), a single compound inequality with an "and".
  8. \( \left| A \right| \gt b \) becomes \( A \gt b \) or \( A \lt -b \), two separate intervals joined by "or".

Where students lose marks: writing a "greater than" absolute value inequality as a single compound statement. \( \left| x \right| \gt 3 \) is not \( -3 \gt x \gt 3 \), which asserts something impossible. It is two rays, \( x \gt 3 \) or \( x \lt -3 \), and they cannot be written as one chain.

Worked example

The problem. Let \( f(x) = \begin{cases} 2x + 1 & x \lt 1 \\ x^2 & x \ge 1 \end{cases} \) (a) Find \( f(0) \), \( f(1) \) and \( f(3) \). (b) Describe the graph at \( x = 1 \). (c) Solve \( \left| 2x - 5 \right| = 9 \). (d) Solve \( \left| 3x + 2 \right| \lt 8 \) and \( \left| x - 4 \right| \ge 3 \).

Step one: evaluate (a) by choosing the interval. \( 0 \lt 1 \), so use the first rule: \( f(0) = 2(0) + 1 = 1 \). \( 3 \ge 1 \), so use the second: \( f(3) = 9 \).

Step two: handle the boundary. At \( x = 1 \) the condition \( x \ge 1 \) is satisfied, so the second rule applies: \( f(1) = 1^2 = 1 \). The first rule would have given \( 2(1) + 1 = 3 \), but it does not apply, since its condition is \( x \lt 1 \) strictly. Reading the inequality signs carefully is the whole of this step.

Step three: describe the graph for (b). Approaching \( x = 1 \) from the left, the first piece climbs toward \( 2(1) + 1 = 3 \), but never reaches it, so the line ends at \( (1, 3) \) with an open circle. At \( x = 1 \) itself the parabola takes over with value 1, so there is a closed circle at \( (1, 1) \).

Step four: name what that is. The graph jumps from a height of 3 down to a height of 1 at \( x = 1 \). This is a jump discontinuity, and it is perfectly allowed: a piecewise function need not connect. Had the pieces been \( 2x - 1 \) and \( x^2 \), both would give 1 at \( x = 1 \) and the graph would join smoothly. Whether a piecewise function is continuous is decided by comparing the two formulas at the boundary.

Step five: solve (c). Since 9 is positive, split into two cases: \( 2x - 5 = 9 \) gives \( 2x = 14 \) and \( x = 7 \). \( 2x - 5 = -9 \) gives \( 2x = -4 \) and \( x = -2 \).

Step six: check (c). \( \left| 2(7) - 5 \right| = \left| 9 \right| = 9 \). Correct. \( \left| 2(-2) - 5 \right| = \left| -9 \right| = 9 \). Correct. Both are genuine; absolute value equations of this form usually have exactly two solutions.

Step seven: solve the "less than" in (d). \( \left| 3x + 2 \right| \lt 8 \) means the inside is within 8 of zero: \( -8 \lt 3x + 2 \lt 8 \). Subtract 2 throughout: \( -10 \lt 3x \lt 6 \). Divide by 3: \( -\dfrac{10}{3} \lt x \lt 2 \). Check an interior point: at \( x = 0 \), \( \left| 2 \right| = 2 \lt 8 \). Correct. Check an exterior point: at \( x = 3 \), \( \left| 11 \right| = 11 \), not less than 8. Correct.

Step eight: solve the "greater than or equal" in (d). \( \left| x - 4 \right| \ge 3 \) means the inside is at least 3 away from zero in either direction, which is two separate conditions: \( x - 4 \ge 3 \), giving \( x \ge 7 \), or \( x - 4 \le -3 \), giving \( x \le 1 \). Solution: \( x \le 1 \) or \( x \ge 7 \), written \( (-\infty, 1] \cup [7, \infty) \). Check: at \( x = 8 \), \( \left| 4 \right| = 4 \ge 3 \). Correct. At \( x = 4 \), \( \left| 0 \right| = 0 \), which fails, and 4 is correctly outside the solution set. The interpretation is worth keeping: \( \left| x - 4 \right| \) is the distance from \( x \) to 4, so the question asks which points are at least 3 away from 4. Reading it that way makes the two-ray answer obvious rather than a rule to recall.

Practice · 10 problems

Problems 1 to 5 are routine. Problems 6 to 10 are multi-step or ask for reasoning.

  1. Solve \( \left| x \right| = 6 \).
    Show the full solution

    \( x = 6 \) or \( x = -6 \)

  2. Solve \( \left| x \right| = -2 \).
    Show the full solution

    An absolute value is never negative. No solution

  3. Solve \( \left| x \right| \lt 5 \).
    Show the full solution

    \( -5 \lt x \lt 5 \)

  4. Solve \( \left| x \right| \gt 2 \).
    Show the full solution

    Two rays. \( x \lt -2 \) or \( x \gt 2 \)

  5. For \( f(x) = \begin{cases} x + 3 & x \le 0 \\ 5 & x \gt 0 \end{cases} \), find \( f(-2) \).
    Show the full solution

    \( -2 \le 0 \), so use the first rule. 1

  6. Solve \( \left| 4x - 1 \right| = 11 \).
    Show the full solution

    \( 4x - 1 = 11 \) gives \( x = 3 \). \( 4x - 1 = -11 \) gives \( 4x = -10 \) and \( x = -\dfrac{5}{2} \). Check: \( \left| 12 - 1 \right| = 11 \). Correct. \( \left| -10 - 1 \right| = 11 \). Correct. \( x = 3 \) or \( x = -\frac{5}{2} \)

  7. Solve \( \left| 2x + 7 \right| \le 3 \).
    Show the full solution

    \( -3 \le 2x + 7 \le 3 \). Subtract 7: \( -10 \le 2x \le -4 \). Divide by 2: \( -5 \le x \le -2 \). Check an endpoint: at \( x = -5 \), \( \left| -3 \right| = 3 \le 3 \). Included, correctly. Check the middle: at \( x = -3.5 \), \( \left| 0 \right| = 0 \le 3 \). Correct. \( [-5, -2] \)

  8. Write \( f(x) = \left| x - 3 \right| \) as a piecewise function, and give its vertex.
    Show the full solution

    The absolute value returns its input when the input is nonnegative and the opposite otherwise, so split at the point where \( x - 3 = 0 \), that is \( x = 3 \). \[ f(x) = \begin{cases} x - 3 & x \ge 3 \\ 3 - x & x \lt 3 \end{cases} \] Note the second piece: \( -(x - 3) = 3 - x \), not \( -x - 3 \). Distributing the negative across both terms is where this is usually lost. Vertex. The corner is where the two pieces meet, at \( x = 3 \), with \( f(3) = 0 \). Vertex \( (3, 0) \). Check: \( f(5) = 2 \) from the first piece, and \( \left| 5 - 3 \right| = 2 \). Correct. \( f(1) = 3 - 1 = 2 \) from the second, and \( \left| 1 - 3 \right| = 2 \). Correct. Piecewise as above, vertex \( (3, 0) \)

  9. Explain why \( \left| A \right| \lt b \) gives one interval but \( \left| A \right| \gt b \) gives two.
    Show the full solution

    Read \( \left| A \right| \) as the distance from \( A \) to zero on the number line. The "less than" case. Asking for points within \( b \) of zero describes a single stretch centered on zero, from \( -b \) to \( b \). That is one interval, and it can be written as the chain \( -b \lt A \lt b \) because every point in it satisfies both halves at once. The "greater than" case. Asking for points more than \( b \) from zero describes everything outside that stretch, and the outside of an interval on a line is two pieces: one running left from \( -b \) and one running right from \( b \). Nothing lies in both, so they are joined by "or" rather than "and". Why the chain notation fails there. Writing \( -b \gt A \gt b \) reads as \( A \) being simultaneously less than \( -b \) and greater than \( b \), which no number is when \( b \) is positive. The notation asserts an impossibility, so it can never be right. The check that catches it. Test a value. For \( \left| x \right| \gt 3 \), the number 5 should work: \( \left| 5 \right| = 5 \gt 3 \). Substituting into \( -3 \gt x \gt 3 \) gives \( -3 \gt 5 \), which is false, so the notation has excluded a genuine solution. Less than means inside a single centered interval; greater than means outside it, and the outside of an interval is two pieces

  10. A machine part must be 12.0 cm long with a tolerance of 0.4 cm. Write this as an absolute value inequality, solve it, and then write the acceptable range as a piecewise description of a "reject" function.
    Show the full solution

    Write the inequality. "Within 0.4 of 12.0" is a statement about distance, so it is an absolute value: \( \left| L - 12.0 \right| \le 0.4 \), where \( L \) is the measured length in centimeters. Solve it. \( -0.4 \le L - 12.0 \le 0.4 \). Add 12.0 throughout: \( 11.6 \le L \le 12.0 + 0.4 = 12.4 \). Acceptable range: \( [11.6,\; 12.4] \). Check the endpoints. At \( L = 11.6 \), \( \left| -0.4 \right| = 0.4 \le 0.4 \). Accepted, correctly, since the tolerance is inclusive. At \( L = 12.5 \), \( \left| 0.5 \right| = 0.5 \), which exceeds 0.4. Rejected. Correct. The reject function. Define \( R(L) \) as 1 for a rejected part and 0 for an accepted one: \[ R(L) = \begin{cases} 1 & L \lt 11.6 \\ 0 & 11.6 \le L \le 12.4 \\ 1 & L \gt 12.4 \end{cases} \] This is a genuine piecewise function with three pieces and two jump discontinuities, at 11.6 and at 12.4. Why the boundary convention matters here. The inequalities on the middle piece are inclusive, which is a real decision with a cost: a part measuring exactly 12.4 is accepted. Writing the middle piece with strict inequalities would reject it. In manufacturing that convention is written into the specification precisely because measurement noise makes borderline parts common. A note on the model. The function treats measurement as exact. A real inspection has its own uncertainty, so a part measured at 12.41 might truly be 12.39. That is why tolerances in practice are set tighter than the true requirement, and it is the kind of assumption a modeling answer should state rather than hide. \( \left| L - 12.0 \right| \le 0.4 \), giving \( 11.6 \le L \le 12.4 \), with the three-piece reject function above

← 1.4 Even and odd functions1.6 Composition of functions →

Keep going in the full Algebra 2 course

All of U1 (Unit 1: Functions, Transformations and Inverses) is free to everyone, with no account. The course has 75 lessons, each with worked examples and practice problems that come with full solutions. A free account can also start a free month of the whole course, with no card.

Open this lesson in the courseSee the whole course