Algebra 1FunctionsF-IF.C.7b

Piecewise Functions

Use the rule that matches the input's interval.

Not started Jump to practice

Some rules change partway along. A phone plan might charge one price up to a data limit and another after it. A piecewise function uses different formulas on different parts of its domain, and the parts are described with inequalities, like the ones in compound inequalities.

For example, $$f(x) = \begin{cases} x + 2 & \text{if } x < 1 \\ 3 - x & \text{if } x \ge 1 \end{cases}$$ uses $x + 2$ for inputs less than $1$ and $3 - x$ for inputs of $1$ or more.

Why it works

A function must give exactly one output for each input, so the conditions must not overlap and each input must land in exactly one piece. That is why boundaries matter: in the example, $x = 1$ belongs to the second piece ($x \ge 1$), not the first ($x < 1$). On the graph, a filled dot marks an endpoint that is included and an open dot marks one that is not.
Drag the input. At $x = 1$ the open dot shows that $x + 2$ is not used; the filled dot shows $f(1) = 3 - 1 = 2$.

Key idea

To evaluate a piecewise function, first find the condition the input satisfies, then use only that piece's formula.

Worked examples

Worked example: Evaluating, including a boundary

For $f$ above, find $f(-3)$, $f(1)$ and $f(4)$.
  1. $-3 < 1$, so use $x + 2$: $f(-3) = -1$.
  2. $1 \ge 1$, so use $3 - x$: $f(1) = 2$.
  3. $4 \ge 1$, so use $3 - x$: $f(4) = -1$.

Answer: $f(-3) = -1$, $f(1) = 2$, $f(4) = -1$.

Worked example: Three pieces

$$g(x) = \begin{cases} -2x & \text{if } x < 0 \\ x^2 & \text{if } 0 \le x \le 2 \\ 6 & \text{if } x > 2 \end{cases}$$ Find $g(-1) + g(2) + g(3)$.
  1. $-1 < 0$: $g(-1) = -2(-1) = 2$.
  2. $2$ satisfies $0 \le x \le 2$: $g(2) = 2^2 = 4$.
  3. $3 > 2$: $g(3) = 6$.
  4. Sum: $2 + 4 + 6 = 12$.

Answer: $12$

Common mistake

Using the wrong piece at a boundary because the endpoint symbols were skipped. At $x = 1$ above, $1 < 1$ is false, so the first piece does not apply at all. Check: the input must make its piece's condition true.

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 2 XP.

Loading practice…

Builds on

Leads to

Also used in other ladders:

Sources and further reading

  • OpenStax, College Algebra 2e, section 3.2 Domain and Range (piecewise-defined functions)
  • Common Core State Standards for Mathematics, F-IF.C.7b: graph piecewise-defined functions, including step and absolute value functions
@teddyrookbook GitHub