Prerequisites

Piecewise Defined Functions

AP PRECALCULUS — PREREQUISITE REVIEW

Piecewise-Defined Functions

Notes — Prerequisite Topic 5

💡 Learning Objectives

By the end of this lesson you will be able to:

  • Read the rule of a piecewise function and identify which rule applies to a given input
  • Evaluate a piecewise function at specified inputs
  • Sketch the graph of a piecewise function, using open and closed dots correctly at boundary points
  • Rewrite an absolute value expression as a piecewise function
  • Model real-world situations (tax brackets, shipping rates, parking fees) with piecewise rules

1. What is a Piecewise Function?

Most functions you have seen use a single rule for every input in their domain. A piecewise-defined function uses different rules on different parts of its domain. The rule that applies depends on which piece of the domain the input falls into.

A piecewise function is typically written with a brace that groups several rules, each paired with the portion of the domain where it applies. For example:

f(x) = x + 3 if x < −1

f(x) = x² if −1 ≤ x ≤ 2

f(x) = 6 − x if x > 2

The graph of the three-rule piecewise function above. Note the open circle at x = −1 on the first piece and the closed circles at x = −1 and x = 2 on the middle piece. At x = 2, the middle piece ends closed and the next piece starts open so that every input has exactly one output.

2. Evaluating a Piecewise Function

To evaluate f(a):

  • Step 1: check which inequality the number a satisfies.
  • Step 2: apply the rule attached to that inequality.

📘 Example — Evaluating

Using the function above, find f(−4), f(−1), f(0), and f(2).

x = −4 satisfies x < −1, so f(−4) = −4 + 3 = −1.

x = −1 satisfies −1 ≤ x ≤ 2, so f(−1) = (−1)² = 1.

x = 0 satisfies −1 ≤ x ≤ 2, so f(0) = 0² = 0.

x = 2 satisfies −1 ≤ x ≤ 2, so f(2) = 2² = 4.

3. Graphing a Piecewise Function

Sketching is a piece-by-piece operation.

  • Step 1: graph each rule as if it applied everywhere.
  • Step 2: erase everything outside the domain restriction for that rule.
  • Step 3: place a closed dot at a boundary value that is included, and an open dot at one that is not.

⚠️ Closed vs. open dots at the boundary

At any boundary value, one of the pieces will include that value (use a filled dot) and the other, if any, will exclude it (use an open dot).

A graph cannot have two filled dots stacked vertically at the same x-value. If that happens, the rule isn’t a function there.

4. The Absolute Value as a Piecewise Function

The absolute value is the canonical piecewise function. By definition:

|x| = x if x ≥ 0

|x| = −x if x < 0

The graph of y = |x|. To the right of 0 the rule is y = x; to the left of 0 the rule is y = −x. The two rays meet at the origin to form a V-shape.

📘 Example — Rewriting an absolute value

Express f(x) = |2x − 6| as a piecewise function.

The expression inside changes sign at 2x − 6 = 0, i.e. x = 3.

For x ≥ 3, 2x − 6 ≥ 0, so |2x − 6| = 2x − 6.

For x < 3, 2x − 6 < 0, so |2x − 6| = −(2x − 6) = 6 − 2x.

Thus f(x) = { 2x − 6 if x ≥ 3; 6 − 2x if x < 3 }.

5. Modeling with Piecewise Functions

Piecewise functions appear naturally whenever the underlying rule changes at specific thresholds.

Situation

Why it's piecewise

Income tax brackets

A different marginal rate applies in each income band

Shipping or postage rates

Costs jump at each new weight tier

Mobile phone plans

A flat rate up to a usage cap, then a per-unit rate

Parking garage fees

First hour free, different rate per hour after that

Step function (ceiling/floor)

The output jumps whenever the input crosses an integer

📘 Example — Modeling a shipping rate

A shipper charges $5 for packages of up to 1 kg, $8 for more than 1 kg and up to 5 kg, and $12 for packages above 5 kg. Let C(w) be the cost in dollars for a package of weight w kg.

C(w) = 5 if 0 < w ≤ 1

C(w) = 8 if 1 < w ≤ 5

C(w) = 12 if w > 5

The graph of C is a step function: flat segments with jumps at w = 1 and w = 5.

6. Domain, Range, and Continuity

💡 Reading the domain and range

  • Domain: the union of the intervals on which the rules are defined. Make sure every real number in your stated domain is covered by exactly one piece.
  • Range: the set of all outputs produced by at least one piece. Examine each piece's range, then take the union.
  • Continuity at a boundary x = c: both neighboring pieces must approach the same value at c, and f(c) must equal that value.

📘 Example — Is it continuous at the seam?

For f(x) = { 2x + 1 if x < 1; 3x if x ≥ 1 }, the left piece approaches 2(1) + 1 = 3 as x → 1⁻, and the right piece gives f(1) = 3. The two values agree, so f is continuous at x = 1.

By contrast, g(x) = { x + 2 if x < 0; x² if x ≥ 0 } has left limit 2 and g(0) = 0 at the seam — not continuous at x = 0.

7. Summary

  • A piecewise function uses different rules on different parts of its domain
  • To evaluate, first locate the input in the correct piece, then apply that piece's rule
  • When graphing, include or exclude endpoints with filled/open dots so each x-value has exactly one output
  • Absolute value is a piecewise function; recognizing it makes many problems cleaner
  • Check continuity at boundary points by comparing the values from the two adjacent pieces

Need personalised help?

Our expert tutors can walk you through any topic in a 1-on-1 session.

Book a Free Trial Session