🎯 In this section you will learn

πŸ“Œ Definition

A piecewise function is defined by different formulas over different parts of its domain.

$$ f(x) = \begin{cases} \text{formula}_1, & \text{if } x \text{ satisfies condition}_1 \\ \text{formula}_2, & \text{if } x \text{ satisfies condition}_2 \\ \vdots & \vdots \end{cases} $$
Example 1Simple Piecewise Function
$$ 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:

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

FunctionDefinitionName
$|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:

Example 4Tax Bracket Example

A tax system charges 10% on income up to \$10,000, and 20% on income above \$10,000.

$$ T(x) = \begin{cases} 0.10x, & 0 \le x \le 10000 \\ 1000 + 0.20(x - 10000), & x > 10000 \end{cases} $$

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} $$

Find $f(-3)$, $f(-2)$, $f(0)$, $f(1)$, $f(3)$.

Show solution

$f(-3) = 4$ (since $-3 < -2$)
$f(-2) = (-2)^2 = 4$ (since $-2$ is in $[-2, 1]$)
$f(0) = 0^2 = 0$
$f(1) = 1^2 = 1$
$f(3) = 3 + 2 = 5$ (since $3 > 1$)

Problem 2Absolute Value

Rewrite $|x - 3|$ as a piecewise function.

Show solution

$|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)$.

← Back to Module Page