← Skill tree MathScape MATH161

Piecewise Functions

Reference: Stewart 1.1  •  Chapter: 1  •  Section: 1

Navigation: Wiki Home > Skills > Piecewise Functions

One Function, Many Rules

Real-world situations often behave differently in different conditions. Tax brackets charge different rates at different income levels. Shipping costs jump at weight thresholds. Cell phone plans charge nothing for data up to a limit, then charge per gigabyte.

Piecewise functions let us model these situations with one mathematical object that uses different formulas on different parts of its domain.

Prerequisite Map

This skillPiecewise Functions
Leads tono further branch yet

Quick Reference

Property Value
Chapter 1 - Functions and Limits
Section 1.1
Difficulty Intermediate
Time ~20 minutes

Key Concepts

Piecewise Function Notation

A piecewise function is written using a brace that groups different formulas with their conditions:

$$f(x) = \begin{cases} \text{formula}_1 & \text{if condition}_1 \\ \text{formula}_2 & \text{if condition}_2 \\ \vdots & \vdots \end{cases}$$

Example:

$$f(x) = \begin{cases} x + 3 & \text{if } x < 1 \\ 5 & \text{if } x = 1 \\ x^2 & \text{if } x > 1 \end{cases}$$

Evaluating Piecewise Functions

Process:

  1. Look at the input value $x$
  2. Find which condition it satisfies
  3. Use that formula to compute the output

Example: For the function above, find $f(-2)$, $f(1)$, and $f(3)$.

Graphing Piecewise Functions

Process:

  1. Graph each piece on its restricted domain
  2. Use solid dots (●) for included endpoints
  3. Use open circles (○) for excluded endpoints
        y
        |
    5   |     ●   (the point (1,5))
        |
    4   |
        |   ○     (excluded: x=1 gives y=4 from x^2, but we use 5 instead)
    3   |
        | ●
    2   |/        (line y = x + 3 for x < 1)
        |
    1 ○-+-○-------→ x
        |   parabola y = x² for x > 1

The Absolute Value Function

The absolute value is a classic piecewise function:

$$\vert x\vert = \begin{cases} x & \text{if } x \geq 0 \\ -x & \text{if } x < 0 \end{cases}$$

Why $-x$ for negatives? If $x$ is negative (like $x = -3$), then $-x$ is positive ($-(-3) = 3$), which gives the correct absolute value.

Graph shape: V-shaped, with vertex at the origin.

        y
        |
    3   |●     ●
        | \   /
    2   |  \ /
        |   \
    1   |  / \
        | /   \
        ●-------→ x
       -3 -2 -1  1  2  3

Practice Problems

Level 1 Basic Evaluation

For the function $$g(x) = \begin{cases} 2x + 1 & \text{if } x \leq 2 \\ 7 - x & \text{if } x > 2 \end{cases}$$

Evaluate: $g(0)$, $g(2)$, $g(5)$.

Thought Process

For each input, check which condition it satisfies:

  • Is the input $\leq 2$ or $> 2$?

Note that $x = 2$ satisfies the first condition (it includes equality).

Show Answer
  • $g(0)$: Since $0 \leq 2$, use $2x + 1$: $g(0) = 2(0) + 1 = 1$
  • $g(2)$: Since $2 \leq 2$, use $2x + 1$: $g(2) = 2(2) + 1 = 5$
  • $g(5)$: Since $5 > 2$, use $7 - x$: $g(5) = 7 - 5 = 2$
Level 2 Graphing a Two-Piece Function

Sketch the graph of: $$f(x) = \begin{cases} x + 2 & \text{if } x < 1 \\ 3 & \text{if } x \geq 1 \end{cases}$$

Be sure to indicate open and closed circles at the boundary.

Thought Process
  1. For $x < 1$: Graph the line $y = x + 2$, stopping just before $x = 1$
  2. At $x = 1$ from the line: $y = 1 + 2 = 3$ (but this is excluded: open circle)
  3. For $x \geq 1$: Graph the horizontal line $y = 3$
  4. At $x = 1$ for the constant: $y = 3$ (included: closed circle)

Notice both pieces give $y = 3$ at $x = 1$, but from different formulas!

Show Answer
        y
        |
    4   |
        |
    3   |  ○●─────────  (horizontal line y = 3 for x ≥ 1)
        | /
    2   |/
        |
    1   |
        |
    ----+----+----→ x
       -1    1   3

    (Line y = x + 2 for x < 1)

Key observations:

  • At $x = 1$: The line would give $y = 3$ (open circle) and the constant gives $y = 3$ (closed circle)
  • Since both values coincide at $y = 3$, the function is actually continuous at $x = 1$!
  • Open and closed circles overlap at the same point
Level 3 Finding Domain and Range

For the function: $$h(x) = \begin{cases} \sqrt{x} & \text{if } 0 \leq x \leq 4 \\ 6 - x & \text{if } x > 4 \end{cases}$$

  1. Find the domain.
  2. Find the range.
  3. Is the function continuous at $x = 4$?
Thought Process

(a) The domain comes from combining the conditions: the first piece covers $[0, 4]$ and the second covers $(4, \infty)$.

(b) For range, find what outputs each piece produces:

  • $\sqrt{x}$ on $[0, 4]$ gives $[0, 2]$
  • $6 - x$ on $(4, \infty)$ gives... what?

(c) For continuity at $x = 4$: check if both pieces give the same value there.

Show Answer

(a) Domain: The first piece covers $[0, 4]$, the second covers $(4, \infty)$. Together: Domain = $[0, \infty)$

(b) Range:

  • First piece: $\sqrt{x}$ on $[0, 4]$ produces outputs from $\sqrt{0} = 0$ to $\sqrt{4} = 2$, so $[0, 2]$
  • Second piece: $6 - x$ on $(4, \infty)$. As $x \to 4^+$, $y \to 2$. As $x \to \infty$, $y \to -\infty$.

Combined range: $(-\infty, 2]$ (the pieces overlap at $y = 2$)

(c) Continuity at $x = 4$:

  • From the first piece: $h(4) = \sqrt{4} = 2$ (this is the actual value since $x = 4$ satisfies $x \leq 4$)
  • Approaching from the right: $\lim_{x \to 4^+} (6 - x) = 6 - 4 = 2$

Both equal $2$, so the function is continuous at $x = 4$.

Level 4 Absolute Value Transformations

Write $f(x) = \vert 2x - 6\vert $ as a piecewise function (without absolute value signs) and sketch its graph.

Thought Process

The absolute value removes negatives. So:

  • When is $2x - 6 \geq 0$? When $x \geq 3$.
  • When is $2x - 6 < 0$? When $x < 3$.

For the negative case, $\vert 2x - 6\vert = -(2x - 6) = -2x + 6$.

Show Answer

Finding the breakpoint: $2x - 6 = 0$ when $x = 3$

Piecewise form: $$f(x) = \vert 2x - 6\vert = \begin{cases} 2x - 6 & \text{if } x \geq 3 \\ -(2x - 6) & \text{if } x < 3 \end{cases} = \begin{cases} 2x - 6 & \text{if } x \geq 3 \\ -2x + 6 & \text{if } x < 3 \end{cases}$$

Graph:

  • For $x < 3$: Line with slope $-2$, passes through $(0, 6)$ and $(3, 0)$
  • For $x \geq 3$: Line with slope $2$, passes through $(3, 0)$ and $(6, 6)$
        y
        |
    6   ●           ●
        |\         /
    4   | \       /
        |  \     /
    2   |   \   /
        |    \ /
        +-----●-----→ x
             3    6

V-shape with vertex at $(3, 0)$.

Level 5 Designing a Piecewise Function

A parking garage charges:

  • $3 for the first hour or any part of it
  • $2 for each additional hour or part of an hour
  • Maximum daily charge of $15
  1. Write a piecewise function $C(t)$ for the cost of parking for $t$ hours (where $t > 0$).
  2. What is $C(0.5)$? $C(1)$? $C(4.5)$? $C(10)$?
  3. Sketch the graph of $C(t)$ for $0 < t \leq 12$.
Thought Process

"Any part of an hour" means we round up. Use the ceiling function notation or think in terms of intervals.

The cost structure:

  • $0 < t \leq 1$: Pay $3
  • $1 < t \leq 2$: Pay $3 + $2 = $5
  • $2 < t \leq 3$: Pay $3 + 2($2) = $7
  • Continue until the total reaches $15

When does it hit the max? Solve $3 + 2(n-1) = 15$ to find $n = 7$ hours.

Show Answer

(a) Piecewise function:

First, find when the cap kicks in: $3 + 2(n-1) = 15$ gives $n = 7$.

$$C(t) = \begin{cases} 3 & \text{if } 0 < t \leq 1 \\ 5 & \text{if } 1 < t \leq 2 \\ 7 & \text{if } 2 < t \leq 3 \\ 9 & \text{if } 3 < t \leq 4 \\ 11 & \text{if } 4 < t \leq 5 \\ 13 & \text{if } 5 < t \leq 6 \\ 15 & \text{if } t > 6 \end{cases}$$

Or more compactly using ceiling function: For $t \leq 6$, $C(t) = 3 + 2(\lceil t \rceil - 1) = 1 + 2\lceil t \rceil$.

(b) Evaluations:

  • $C(0.5) = 3$ (first hour)
  • $C(1) = 3$ (exactly 1 hour, still first tier)
  • $C(4.5) = 11$ (rounds to 5 hours: $3 + 2(4) = 11$)
  • $C(10) = 15$ (cap applies)

(c) Graph:

    C($)
    15  |                    ●───────
        |               ●────○
    13  |          ●────○
        |     ●────○
    11  |
        |
     9  |
        |●────○
     7  |
        |
     5  |●────○
        |
     3  ●────○
        +--+--+--+--+--+--+--+--→ t (hours)
           1  2  3  4  5  6  7

Step function with jumps at each integer, capped at $15.

Common Errors to Avoid

Error Example Correction
Wrong boundary Using $x = 1$ with "$x < 1$" formula Check inequality: is the boundary included?
Forgetting endpoint markers Drawing continuous line through breakpoint Use ● for included, ○ for excluded
Mixing up $-x$ in $\|x\|$ Thinking $-x$ is always negative When $x < 0$, $-x$ is positive

Mastery Checklist

Mental Model

The Road with Multiple Speed Limits:

Think of a piecewise function like a road with different speed limits in different zones. At mile marker 10, the limit might change from 55 to 35. You follow whichever rule applies to your current location. The "breakpoints" are like zone boundaries; you need to know which zone you're in to follow the right rule.

Previous Up Next
Difference Quotient Ch1 §1 Skills Function Symmetry

Last updated: 2026-01-22