Some functions use different formulas for different parts of their domain. These are called piecewise-defined functions. The absolute value, signum, and floor functions are classic examples that appear throughout mathematics, engineering, and computer science.
Quick Reference
| Function | Formula | Key property |
|---|---|---|
| Absolute value | \lvert x \rvert=\left\{\begin{aligned} &x &&\text{if }x \geq 0\\ &-x &&\text{if }x < 0 \end{aligned}\right. | Always nonnegative; V-shaped graph |
| Signum | \operatorname{sgn}(x) =\left\{\begin{aligned} &1 &&\text{if }x > 0\\ &0 &&\text{if } x=0 \\&-1 &&\text{if }x < 0 \end{aligned}\right. | Extracts the sign of |
| Floor / Greatest integer | = largest integer | Rounds down to nearest integer |
Piecewise-Defined Functions
A piecewise-defined function is one that uses different formulas for different subsets of its domain.
For example, the function g: ℝ → ℝ defined by
g(x)=\left\{ \begin{aligned} 3x+1 &&\text{if }x< -2\\ x^2-4 &&\text{if }x\geq -2 \end{aligned} \right.is a piecewise-defined function.
The Absolute Value Function
The absolute value function is defined by
f(x) = \begin{cases} x & \text{if } x \geq 0 \\ -x & \text{if } x < 0. \end{cases}The absolute value gives the distance of from zero on the number line. Its graph is V-shaped with vertex at the origin.

The Signum (Sign) Function
The signum function (or sign function), denoted , is defined by
\operatorname{sgn}(x) = \begin{cases} 1 & \text{if } x > 0 \\ 0 & \text{if } x = 0 \\ -1 & \text{if } x < 0. \end{cases}The signum function extracts the sign of a real number: positive inputs give , negative inputs give , and zero gives $0$.

The Greatest Integer (Floor) Function
The greatest integer function (or floor function), denoted , is the largest integer less than or equal to . In other words, it rounds down to the nearest integer:
Examples:
Note that for negative numbers, rounding down means rounding away from zero.
- The floor function maps (all integers).
- Other notations: and .

Evaluating and Graphing Piecewise Functions
A function is defined by
f(x) = \begin{cases} 2x - 3 & \text{if } x > 2 \\ x - 1 & \text{if } -1 < x \leq 2 \\ -2x + 1 & \text{if } x \leq -1. \end{cases}Evaluate , , , and plot the graph.
Solution
Since , use the middle formula: Since , use the middle formula: Since , use the bottom formula: