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:

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:

  1. Find which interval your input belongs to
  2. Plug into that piece's formula only
  3. 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

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:

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:

  1. Find where each segment starts and ends on the x-axis
  2. Find the equation of each line segment
  3. 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:

  1. Use a dashed vertical line at each boundary point
  2. Graph each piece on its interval only
  3. 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

MistakeWhat You ThinkReality
Using two piecesAverage them togetherPick ONE piece based on x-value
Boundary confusion"x < 3" and "x ≥ 3" are the sameThey're different intervals
Drawing full linesGraph the whole equationOnly graph on the specified interval
Forgetting parenthesesWrite just the formulaInclude the domain condition every time

Comparing Piecewise Functions to Standard Functions

FeatureStandard FunctionPiecewise Function
Number of rulesOne rule for all xMultiple rules for different x intervals
EvaluationPlug in, doneFind interval first, then plug in
GraphingOne continuous curveMultiple separate pieces
DomainUsually all real numbersCan 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:

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.