$$ f(x) = \begin{cases}
x^2, & x < 0 \\
2x + 1, & x \ge 0
\end{cases} $$
For $x = -2$: use $x^2$ β $f(-2) = 4$
For $x = 3$: use $2x+1$ β $f(3) = 7$
For $x = 0$: use $2x+1$ β $f(0) = 1$
π’ Evaluating Piecewise Functions
β
Identify the input value
Look at the given $x$ value.
β‘
Find the matching condition
Determine which interval contains $x$.
β’
Use the corresponding formula
Plug $x$ into that formula and compute.
Example 2Evaluating at Multiple Points
$$ g(x) = \begin{cases}
3, & x < -1 \\
x^2, & -1 \le x \le 2 \\
5 - x, & x > 2
\end{cases} $$
Find $g(-2)$, $g(-1)$, $g(0)$, $g(2)$, and $g(4)$.
β
$g(-2)$
$-2 < -1$, use $3$ β $g(-2) = 3$
β‘
$g(-1)$
$-1$ is in $[-1, 2]$, use $x^2$ β $g(-1) = 1$
β’
$g(0)$
$0$ is in $[-1, 2]$, use $x^2$ β $g(0) = 0$
β£
$g(2)$
$2$ is in $[-1, 2]$, use $x^2$ β $g(2) = 4$
β€
$g(4)$
$4 > 2$, use $5 - x$ β $g(4) = 1$
π Graphing Piecewise Functions
To graph a piecewise function:
Graph each piece on its specified interval
Use an open circle (β) for endpoints not included
Use a closed circle (β) for endpoints that are included
The graph may have jumps or breaks
Example 3Graphing a Piecewise Function
$$ h(x) = \begin{cases}
-x, & x < 0 \\
x, & x \ge 0
\end{cases} $$
This is actually the absolute value function: $h(x) = |x|$. The graph is V-shaped with vertex at $(0,0)$.
πΌοΈ Visual Demonstration
Interactive graph below. Click buttons to see different piecewise functions:
π§ Common Piecewise Functions
Function
Definition
Name
$|x|$
$\begin{cases} x, & x \ge 0 \\ -x, & x < 0 \end{cases}$
Absolute Value
$\lfloor x \rfloor$
Greatest integer less than or equal to $x$
Floor Function
$\lceil x \rceil$
Least integer greater than or equal to $x$
Ceiling Function
$\text{sgn}(x)$
$\begin{cases} 1, & x > 0 \\ 0, & x = 0 \\ -1, & x < 0 \end{cases}$
Sign Function
π‘ Absolute Value as Piecewise
The absolute value function $|x|$ is the most common piecewise function. It appears frequently in calculus, especially when dealing with derivatives and integrals.
π― Applications in Calculus
Piecewise functions are essential for:
Modeling real-world situations with different rules (tax brackets, shipping costs, etc.)
Defining functions with jumps or discontinuities
Working with absolute values and greatest integer functions
Finding limits and continuity at break points
Example 4Tax Bracket Example
A tax system charges 10% on income up to \$10,000, and 20% on income above \$10,000.
For $x = 8000$: $T(8000) = 0.10(8000) = \$800$
For $x = 15000$: $T(15000) = 1000 + 0.20(5000) = \$2000$
π Key Takeaway
Piecewise functions are defined by different rules on different intervals. In calculus, pay special attention to the behavior at the break points (jump discontinuities).
π Practice Problems
Problem 1Evaluate
$$ f(x) = \begin{cases}
4, & x < -2 \\
x^2, & -2 \le x \le 1 \\
x + 2, & x > 1
\end{cases} $$
$|x - 3| = \begin{cases} x-3, & x \ge 3 \\ -(x-3), & x < 3 \end{cases} = \begin{cases} x-3, & x \ge 3 \\ -x+3, & x < 3 \end{cases}$
Problem 3Shipping Cost
A shipping company charges \$5 for packages up to 5 lbs, \$8 for packages 5-10 lbs, and \$12 for packages over 10 lbs. Write a piecewise function for the cost $C(w)$ where $w$ is weight in pounds.
Show solution
$C(w) = \begin{cases} 5, & 0 < w \le 5 \\ 8, & 5 < w \le 10 \\ 12, & w > 10 \end{cases}$
Problem 4Evaluate
$$ g(x) = \begin{cases}
\sqrt{x}, & x \ge 0 \\
-x, & x < 0
\end{cases} $$
Find $g(4)$ and $g(-9)$.
Show solution
$g(4) = \sqrt{4} = 2$ $g(-9) = -(-9) = 9$
Problem 5Domain
What is the domain of the piecewise function in Problem 4?
Show solution
The function is defined for all real numbers. Domain: $(-\infty, \infty)$.