MathBored

Essential Math Primer
← Back to Primer Overview
A06 • Lesson 76 of 105

Piecewise and Absolute Value Functions

Defining and graphing functions with different rules over different intervals. Covers piecewise function notation, evaluating and graphing piecewise-defined functions, continuity at boundary points, and absolute value functions as a special case of piecewise. Includes transformations of absolute value functions and solving absolute value equations and inequalities.

High School Advanced • 9-12

Prerequisites: H28, H36, R64

Key Concepts

  • piecewise function definition and evaluation
  • graphing piecewise functions and checking continuity at boundaries
  • absolute value as a piecewise function
  • transformations of absolute value functions

Piecewise and Absolute Value Functions

Not every real-world relationship follows a single smooth formula. Tax brackets, shipping costs, speed limits -- many quantities are defined by different rules on different intervals. Piecewise functions capture this reality by stitching together multiple formulas, each governing a specific domain. The absolute value function, one of the most important functions in mathematics, turns out to be a piecewise function in disguise.

Piecewise Function Notation

A piecewise function is defined using a brace that groups several formulas, each with a domain restriction:

f(x) = { 2x + 1,   if x < 0
          x^2,      if x ≥ 0

To evaluate a piecewise function at a specific input, first determine which piece the input belongs to, then use that formula:

  1. Identify the value of x you are evaluating.
  2. Check which domain condition x satisfies.
  3. Substitute x into the corresponding formula.
  4. Compute the result.

Graphing Piecewise Functions

Graph each piece on its specified interval. Pay close attention to the endpoints:

At a boundary between pieces, there may be a jump (the two pieces do not meet), a corner (they meet but at different slopes), or a smooth connection (they meet with the same slope).

Continuity at Boundary Points

A function is continuous at a boundary point x = c if the left-hand piece and the right-hand piece give the same output at x = c. Formally:

The limit from the left = the limit from the right = the function value at c

If these are not all equal, the function has a discontinuity (a jump or hole) at that point.

Absolute Value as a Piecewise Function

The absolute value function |x| can be written as:

|x| = { x,    if x ≥ 0
        -x,   if x < 0

This means: if x is nonnegative, leave it alone; if x is negative, negate it (making it positive). The graph is a V-shape with vertex at the origin, symmetric about the y-axis.

Transformations of Absolute Value Functions

The general absolute value function is:

f(x) = a|x - h| + k

The vertex of f(x) = a|x - h| + k is at the point (h, k).

Solving Absolute Value Equations

The equation |expression| = c (where c ≥ 0) splits into two cases:

expression = c    OR    expression = -c

If c < 0, the equation has no solution (absolute value is never negative).

Solving Absolute Value Inequalities

These require careful treatment:

Worked Example 1: Evaluating a Piecewise Function

Problem: Given f(x) = { 3x - 1 if x < 2; x^2 + 1 if x ≥ 2 }, find f(-1), f(2), and f(5).

Solution:

f(-1): Since -1 < 2, use the first piece: f(-1) = 3(-1) - 1 = -4.

f(2): Since 2 ≥ 2, use the second piece: f(2) = 2^2 + 1 = 5.

f(5): Since 5 ≥ 2, use the second piece: f(5) = 5^2 + 1 = 26.

Continuity check at x = 2: Left piece gives 3(2) - 1 = 5. Right piece gives 2^2 + 1 = 5. Both give 5, so f is continuous at x = 2.

Worked Example 2: Solving an Absolute Value Equation

Problem: Solve |2x - 5| = 9.

Solution: Split into two cases:

Case 1: 2x - 5 = 9 → 2x = 14 → x = 7

Case 2: 2x - 5 = -9 → 2x = -4 → x = -2

Check: |2(7) - 5| = |9| = 9. |2(-2) - 5| = |-9| = 9. Both check out.

Solutions: x = 7 and x = -2.

Worked Example 3: Absolute Value Inequality

Problem: Solve |3x + 1| ≤ 8.

Solution: Since this is a "less than or equal to" inequality:

-8 ≤ 3x + 1 ≤ 8

Subtract 1 from all parts: -9 ≤ 3x ≤ 7

Divide by 3: -3 ≤ x ≤ 7/3

Solution: x is in the interval [-3, 7/3].

Common Mistakes

  • Using the wrong piece: Always check which condition x satisfies before substituting. At boundary points, use the piece whose domain includes that boundary (check ≤ vs. <).
  • Forgetting that |expression| = negative has no solution: If you get |x - 3| = -2, stop. There is no solution.
  • Flipping the inequality incorrectly: For |expression| > c, the solution is a disjunction (OR), not a single compound inequality. Do not write -c > expression > c -- that is nonsensical.
  • Continuity confusion: A piecewise function can be defined at a boundary point yet still be discontinuous if the left and right limits disagree.

Real-World Piecewise Functions

Tax brackets are a perfect example. If you earn $0-$10,000, you pay 10%. If you earn $10,001-$40,000, you pay 12% on the amount over $10,000 (plus the fixed tax on the first bracket). Each bracket is a different "piece" of the tax function. Shipping costs, phone plans, and overtime pay all work similarly.

Practice Problems

Problem 1: Given g(x) = { -2x + 3 if x ≤ 1; x^2 - 2 if x > 1 }, find g(-2), g(1), and g(3). Is g continuous at x = 1?

Show Solution

g(-2): -2 ≤ 1, so g(-2) = -2(-2) + 3 = 7.

g(1): 1 ≤ 1, so g(1) = -2(1) + 3 = 1.

g(3): 3 > 1, so g(3) = 3^2 - 2 = 7.

Continuity at x = 1: Left piece gives -2(1) + 3 = 1. Right piece as x approaches 1 from the right gives 1^2 - 2 = -1. Since 1 ≠ -1, g is not continuous at x = 1 (there is a jump).

Problem 2: Solve |4x - 3| = 11.

Show Solution

Case 1: 4x - 3 = 11 → 4x = 14 → x = 7/2

Case 2: 4x - 3 = -11 → 4x = -8 → x = -2

Solutions: x = 7/2 and x = -2.

Problem 3: Solve |2x + 5| > 3.

Show Solution

This is a "greater than" inequality, so it splits into a disjunction:

2x + 5 > 3 → 2x > -2 → x > -1

OR

2x + 5 < -3 → 2x < -8 → x < -4

Solution: x < -4 or x > -1, which is (-∞, -4) ∪ (-1, ∞).

Problem 4: Describe the transformations and vertex of f(x) = -3|x + 2| + 5.

Show Solution

Rewrite in standard form: f(x) = -3|x - (-2)| + 5.

h = -2 (shift left 2), k = 5 (shift up 5). Vertex: (-2, 5).

a = -3: The V opens downward (a is negative) and is steeper than the basic |x| (stretched by factor 3).

The maximum value of f is 5, occurring at x = -2.

Problem 5: Write a piecewise function for the following: a parking garage charges $5 for the first hour, $3 for each additional hour up to 5 hours total, and $20 flat for anything beyond 5 hours. Let C(t) represent cost as a function of time t (in hours, t > 0).

Show Solution

C(t) = { 5 if 0 < t ≤ 1; 5 + 3(t - 1) if 1 < t ≤ 5; 20 if t > 5 }

Simplifying the middle piece: C(t) = 3t + 2 for 1 < t ≤ 5.

Check continuity: At t = 1: both give $5. At t = 5: middle piece gives 3(5) + 2 = 17, third piece gives 20. There is a jump at t = 5 -- the price jumps from $17 to $20. (This is realistic: the garage would likely charge $20 as soon as you exceed 5 hours.)

Summary

Piecewise functions define different rules on different intervals, modeling real-world situations where behavior changes at boundary points. The absolute value function is a fundamental piecewise function, expressed as |x| = x when x ≥ 0 and -x when x < 0. Transformations of absolute value follow the same shift-stretch-reflect rules as other function families. Absolute value equations split into two cases, while inequalities split into conjunctions (less than) or disjunctions (greater than). Checking continuity at boundary points is essential: the pieces must agree at shared endpoints for the function to be continuous.

Overview