Piecewise Functions- Practice Problems and Solutions
What Are Piecewise Functions?
A piecewise function is just what it sounds like—a function made of different pieces. Each piece applies to a specific part of the domain. Outside that part? That piece doesn't exist.
Think of it like pricing at a parking garage:
- First hour costs $3
- Hours 2-4 cost $2 per hour
- Anything over 4 hours is a flat $15
That's a piecewise function. The rule changes depending on which interval you're in.
Mathematically, you write it like this:
f(x) = { x² if x < 0, 2x + 1 if x ≥ 0 }
The curly brace tells you "here come different rules." You pick the rule that matches your input value.
How to Evaluate Piecewise Functions
Evaluating these functions is straightforward:
- Find which interval your input belongs to
- Plug into that piece's formula only
- Ignore every other piece
That's it. Don't try to combine pieces. Don't average them. Just find your interval and calculate.
Practice Problems with Solutions
Problem 1: Basic Evaluation
Given:
f(x) = { 3x - 2 if x < 4, x² if x ≥ 4 }
Find f(2) and f(6)
For f(2): 2 is less than 4, so use 3x - 2
f(2) = 3(2) - 2 = 6 - 2 = 4
For f(6): 6 is greater than or equal to 4, so use x²
f(6) = 6² = 36
Problem 2: Working with Negative Numbers
Given:
g(x) = { |x| if x < 0, x + 5 if x ≥ 0 }
Find g(-3) and g(0)
For g(-3): -3 is less than 0, so use |x|
g(-3) = |-3| = 3
For g(0): 0 is greater than or equal to 0, so use x + 5
g(0) = 0 + 5 = 5
⚠️ Watch out for boundary points. "≥" includes the endpoint. "x < 0" does not.
Problem 3: Multi-Piece Function
Given:
h(x) = { -x if x < -2, 4 if -2 ≤ x < 3, 2x - 1 if x ≥ 3 }
Find h(-5), h(-2), and h(7)
h(-5): -5 < -2, so -(-5) = 5
h(-2): -2 fits -2 ≤ x < 3, so 4
h(7): 7 ≥ 3, so 2(7) - 1 = 13
Problem 4: Finding Domain and Range
Given f(x) = { x + 1 if x ≤ 2, 8 - x if x > 2 }
Domain: All real numbers. Both pieces cover every possible x-value. ✅
Range: Let's check each piece:
- For x + 1 (when x ≤ 2): outputs go from -∞ up to 3
- For 8 - x (when x > 2): outputs go from just below 6 down to -∞
The minimum is -∞, the maximum is 6 (but 6 is never actually reached, since the first piece stops at 3 and the second piece approaches 6 but never hits it when x > 2).
Range: (-∞, 6)
Problem 5: Writing a Piecewise Function from a Graph
You might see a graph with horizontal and slanted line segments. Here's how to extract the function:
- Find where each segment starts and ends on the x-axis
- Find the equation of each line segment
- Write the pieces with correct inequality signs
Example: A V-shaped graph with vertex at (2, -1)
Left side: line through (0, 1) and (2, -1) → slope = -1, so y = -x + 1 for x < 2
Right side: line through (2, -1) and (4, 1) → slope = 1, so y = x - 3 for x ≥ 2
f(x) = { -x + 1 if x < 2, x - 3 if x ≥ 2 }
Graphing Piecewise Functions
Graphing these requires drawing one piece at a time:
- Use a dashed vertical line at each boundary point
- Graph each piece on its interval only
- Check if endpoints are included (closed circle) or excluded (open circle)
Common mistake: students draw the entire line for each piece. Wrong. You only draw the portion that applies to that interval.
Common Mistakes to Avoid
| Mistake | What You Think | Reality |
|---|---|---|
| Using two pieces | Average them together | Pick ONE piece based on x-value |
| Boundary confusion | "x < 3" and "x ≥ 3" are the same | They're different intervals |
| Drawing full lines | Graph the whole equation | Only graph on the specified interval |
| Forgetting parentheses | Write just the formula | Include the domain condition every time |
Comparing Piecewise Functions to Standard Functions
| Feature | Standard Function | Piecewise Function |
|---|---|---|
| Number of rules | One rule for all x | Multiple rules for different x intervals |
| Evaluation | Plug in, done | Find interval first, then plug in |
| Graphing | One continuous curve | Multiple separate pieces |
| Domain | Usually all real numbers | Can have gaps or restrictions |
Getting Started: Step-by-Step Process
When you face any piecewise function problem:
Step 1: Identify all pieces and their intervals. Write them down.
Step 2: For evaluation: find which interval your x-value falls into. For graphing: mark each boundary on the x-axis.
Step 3: Use ONLY the formula from that interval. Discard the rest.
Step 4: Calculate. Don't second-guess yourself.
Step 5: For graphs: check endpoints. Open circle means excluded. Closed circle means included.
Quick Reference Formula
When you need to check if a boundary point is included:
- x < a → x is always less than a (excluded)
- x ≤ a → x can equal a (included)
- x > a → x is always greater than a (excluded)
- x ≥ a → x can equal a (included)
That covers the essentials. Practice with the problems above, check your answers, and you'll get the hang of it. No magic—just identify the interval and apply the right formula.