Precalculus — Chapter 2

Piecewise Functions

Brace notation, evaluating at a point, graphing with open/closed circles, continuity at breakpoints, and writing piecewise rules from real-world scenarios.

Definition

A piecewise function is a function defined by different formulas on different subsets (pieces) of its domain. Instead of one rule that works everywhere, each piece has its own formula that applies only when x satisfies a specified condition.

General form:

f(x) = {

formula₁   if condition₁

formula₂   if condition₂

formula₃   if condition₃

}

The key idea: the function behaves differently depending on where x lives on the number line. Each piece is only active on its own restricted domain.

Reading Piecewise Notation

The large brace groups all the pieces together. Each line is a separate rule. Read each line as: "use [formula] when x satisfies [condition]."

Example function:

f(x) = {

x² + 1    if x < −1

3x        if −1 ≤ x < 2

7          if x ≥ 2

}

Piece 1: x² + 1

x < −1

Active only for x strictly less than −1

Piece 2: 3x

−1 ≤ x < 2

Active for x from −1 (included) to 2 (excluded)

Piece 3: 7 (constant)

x ≥ 2

Active for all x at or above 2

Important rule

A well-defined piecewise function has conditions that do not overlap and together cover every x in the domain. Each input x belongs to exactly one piece.

Evaluating Piecewise Functions

Two-step process:

  1. Determine which condition your x value satisfies.
  2. Substitute x into that piece's formula only.

Worked Example — find f(3), f(0), and f(−2)

f(x) = {

x² + 1    if x < −1

3x        if −1 ≤ x < 2

7          if x ≥ 2

}

f(3) — find which piece

x = 3. Is 3 < −1? No. Is −1 ≤ 3 < 2? No. Is 3 ≥ 2? Yes.

Use Piece 3: f(3) = 7

f(3) = 7

f(0) — find which piece

x = 0. Is 0 < −1? No. Is −1 ≤ 0 < 2? Yes.

Use Piece 2: f(0) = 3(0) = 0

f(0) = 0

f(−2) — find which piece

x = −2. Is −2 < −1? Yes.

Use Piece 1: f(−2) = (−2)² + 1 = 4 + 1 = 5

f(−2) = 5

Graphing Piecewise Functions

  1. Graph each piece as you normally would (line, parabola, constant, etc.) — but only draw it on the x-interval specified by its condition.
  2. At each endpoint, use an open circle (hollow) if the x value is excluded (< or >), or a closed circle (filled) if it is included (≤ or ≥).
  3. Check whether pieces connect at breakpoints.

Closed Circle (included endpoint)

Condition: x ≤ 2 or x ≥ 2

The endpoint x = 2 IS part of this piece. Draw a filled dot at that endpoint.

Open Circle (excluded endpoint)

Condition: x < 2 or x > 2

The endpoint x = 2 is NOT part of this piece. Draw an empty dot at that endpoint.

Graphing Walkthrough

g(x) = {

2x + 3    if x < 1

5          if x ≥ 1

}

Piece 1 (2x + 3, x < 1): Graph the line y = 2x + 3 for all x to the LEFT of 1. Stop at x = 1. Since x < 1 (strict), put an open circle at the point (1, 5).

Piece 2 (5, x ≥ 1): Graph the horizontal line y = 5 for all x at or to the RIGHT of 1. Since x ≥ 1 (inclusive), put a closed circle at (1, 5).

Observation: both pieces land on the same y-value (5) at x = 1 — so this function is continuous at x = 1.

Continuity at Breakpoints

A piecewise function is continuous at a breakpoint x = a if all three of the following are equal:

limx→a⁻ f(x)  =  limx→a⁺ f(x)  =  f(a)

(left-hand limit) = (right-hand limit) = (function value)

Continuous at Breakpoint

The graph has no gap or jump at x = a.

Left piece and right piece meet at the same point.

h(x) = { 2x if x < 3 ; 6 if x ≥ 3 }

Left limit at 3: 2(3) = 6

Right limit at 3: 6

h(3) = 6

All equal → continuous

Jump Discontinuity

Left and right limits both exist but are different.

The graph visibly "jumps" at the breakpoint.

p(x) = { x + 1 if x < 2 ; 5 if x ≥ 2 }

Left limit at 2: 2 + 1 = 3

Right limit at 2: 5

3 ≠ 5 → jump discontinuity at x = 2

How to test continuity at x = a

  1. Evaluate the left-hand piece as x approaches a from below.
  2. Evaluate the right-hand piece as x approaches a from above.
  3. Evaluate f(a) using whichever piece contains x = a (check which condition uses ≤ or ≥).
  4. If all three values match, the function is continuous at a. If any differ, it is discontinuous.

Domain of a Piecewise Function

The domain of a piecewise function is the union of all the pieces' domains. Every x that belongs to at least one condition is in the domain.

Example

f(x) = {

√x       if 0 ≤ x < 4

x − 2    if x ≥ 4

}

Domain: [0, 4) ∪ [4, ∞) = [0, ∞)

If there is a gap between the pieces (for example, piece 1 covers x < 0 and piece 2 covers x > 1), then x-values in that gap are not in the domain of the function.

Writing a Piecewise Function

From a word problem (tax brackets)

Scenario:

Income tax is 10% on the first $10,000, 22% on income from $10,001 to $41,775, and 24% on income above $41,775. Write T(x), the tax owed on income x.

T(x) = {

0.10x                                      if 0 ≤ x ≤ 10,000

1,000 + 0.22(x − 10,000)             if 10,000 < x ≤ 41,775

7,990 + 0.24(x − 41,775)             if x > 41,775

}

Each bracket uses the cumulative tax from lower brackets plus the marginal rate on the remaining income.

From a graph

  1. Identify each breakpoint (x-value where the graph changes behavior).
  2. For each segment, identify the shape (line, parabola, constant).
  3. For lines: find slope m and y-intercept b, then write y = mx + b.
  4. Set the domain condition based on open/closed circles at the segment ends.
  5. Assemble all pieces into brace notation.

Step Functions (Floor Function)

The floor function ⌊x⌋ (also called the greatest integer function) is a special piecewise function that rounds every real number DOWN to the nearest integer. It is a step function — its graph looks like a staircase.

⌊2.7⌋ = 2

Round down to 2

⌊3⌋ = 3

Integer stays the same

⌊−1.3⌋ = −2

Round down (more negative)

Each "step" of the staircase corresponds to one piece of the function. Every piece is a constant (horizontal segment) defined on a half-open interval [n, n+1). The left endpoint is included (closed circle) and the right endpoint is excluded (open circle).

Absolute Value as a Piecewise Function

Absolute value is a classic piecewise function — it is one of the first examples students encounter without realizing it.

|x| = {

x     if x ≥ 0

−x    if x < 0

}

For x ≥ 0:

|5| = 5   (use x itself)

For x < 0:

|−5| = −(−5) = 5   (negate x)

Understanding absolute value as piecewise explains why the graph of y = |x| is a V-shape: the left piece (slope −1) and right piece (slope +1) meet at the origin. See the full absolute value guide for equations, inequalities, and transformations.

3 Worked Examples

Example 1 — Evaluate at multiple points

f(x) = {

−x        if x < 0

4          if 0 ≤ x ≤ 3

x² − 5    if x > 3

}

f(−3)x = −3 < 0 → Piece 1: f(−3) = −(−3) = 3= 3
f(0)x = 0, and 0 ≤ 0 ≤ 3 → Piece 2: f(0) = 4= 4
f(3)x = 3, and 0 ≤ 3 ≤ 3 → Piece 2: f(3) = 4= 4
f(5)x = 5 > 3 → Piece 3: f(5) = 5² − 5 = 25 − 5 = 20= 20

Example 2 — Determine continuity at a breakpoint

q(x) = {

3x − 1    if x ≤ 2

x + 4      if x > 2

}

Test continuity at the breakpoint x = 2.

Left-hand limit (approach x = 2 from below, use Piece 1):

limx→2⁻ (3x − 1) = 3(2) − 1 = 5

Right-hand limit (approach x = 2 from above, use Piece 2):

limx→2⁺ (x + 4) = 2 + 4 = 6

Function value (x = 2 satisfies x ≤ 2, so use Piece 1):

q(2) = 3(2) − 1 = 5

Left limit (5) ≠ Right limit (6) → jump discontinuity at x = 2. The function is NOT continuous there.

Example 3 — Write piecewise from a real-world scenario (parking rates)

Scenario:

A parking garage charges $3 for the first hour (or any part of it), $2 for each additional full hour, with a maximum daily rate of $15. Write P(t), the cost for t hours (0 < t ≤ 12).

Piece 1: For 0 < t ≤ 1 — only the flat first-hour charge applies.

Piece 2: For 1 < t ≤ 7 — first-hour fee plus $2 per additional hour. At t = 7: 3 + 2(6) = $15 (cap reached).

Piece 3: For 7 < t ≤ 12 — maximum rate applies regardless of additional hours.

P(t) = {

3                   if 0 < t ≤ 1

3 + 2⌊t⌋          if 1 < t ≤ 7

15                  if 7 < t ≤ 12

}

Verification: P(2.5) = 3 + 2⌊2.5⌋ = 3 + 2(2) = $7. P(8) = $15 (daily max).

Frequently Asked Questions

What is a piecewise function?

A piecewise function is a function defined by different formulas on different parts of its domain. You write it using brace notation: each line shows a formula on the left and a domain condition on the right. To use the function, you first identify which condition your input x satisfies, then apply that piece's formula.

How do you evaluate a piecewise function at a given point?

Step 1: Look at your input value x and find which condition it satisfies. Step 2: Use only the formula associated with that condition — ignore all other pieces. Step 3: Substitute x into that formula and simplify. For example, if f(x) = {x² for x < 0; 2x + 1 for x ≥ 0}, then f(3): since 3 ≥ 0, use 2(3) + 1 = 7. And f(−2): since −2 < 0, use (−2)² = 4.

How do you graph a piecewise function?

Graph each piece only on its restricted domain. At each endpoint, use a closed circle (filled dot) if that x value is included in the piece (≤ or ≥), or an open circle (empty dot) if excluded (< or >). After sketching all pieces, check continuity at each breakpoint: if the left piece and right piece meet at the same point with the same y-value, the function is continuous there. If they land at different y-values, it is a jump discontinuity.

Related Topics

Practice Piecewise Functions

Interactive problems with step-by-step solutions and private tutoring — free to try.

Start Practicing Free