What is a Piecewise Function?
A piecewise function uses different rules for different parts of its domain.
This says:
- For negative inputs → square them
- For zero or positive inputs → use
Evaluating Piecewise Functions
Step 1: Check which condition the input satisfies
Step 2: Use that rule
Example: Using the function above, find
- Is ? Yes
- Use the first rule:
Example: Find
- Is ? No
- Is ? Yes
- Use the second rule:
Example: Find
- Is ? No
- Is ? Yes
- Use the second rule:
Note: At boundaries, check carefully which condition includes the equals sign.
Do the Pieces Connect?
At the boundary point, do the two rules give the same output?
For our function at :
- Left piece:
- Right piece:
They don’t match. There’s a jump at .
Continuous vs. Discontinuous
Continuous: The pieces connect smoothly (no jumps or gaps)
Discontinuous: There’s a break at one or more points
Example of a continuous piecewise function:
At :
- Left piece:
- Right piece:
They match! This function is continuous.
The Absolute Value Function
The most common piecewise function:
- Positive numbers: stay the same
- Negative numbers: sign gets flipped
Examples:
Key idea: Absolute value gives the distance from zero, which is always non-negative.
Writing Piecewise Functions
Sometimes you need to write your own.
Example: Write a function that outputs 0 for negative inputs and equals the input for non-negative inputs.
Common Patterns
Step function:
This is the sign function (also written ).
Tax brackets, shipping costs, and grading scales are all real-world piecewise functions.
Different rules apply depending on which “bracket” you fall into.