Piecewise Function

Definitionnoun phrase

What is a piecewise function?

A piecewise function is a function defined by two or more formulas, each used on its own interval of the domain. To find an output, first check which interval the input belongs to, then use that piece’s formula. Absolute value, step functions and tiered prices are common examples.

In Spanish
función definida por partes
Also called
piecewise-defined function, split function, piecewise rule
Grade level
Algebra 1
Algebra 1Algebra 2PrecalculusCCSS HSF-IF.C.7.bSATACTACCUPLACER

Piecewise Function in a picture

Graph of a piecewise function with a jump at x = 1The function is 2x + 1 for x less than 1 and 5 minus x for x greater than or equal to 1. The blue piece rises to an open dot at (1, 3). The green piece starts at a closed dot at (1, 4) and falls to the right.−224−2246y = 2x + 1for x < 1y = 5 − xfor x ≥ 1open: (1, 3) left outclosed: f(1) = 4f(x) =2x + 1, if x < 15 − x, if x ≥ 1
Each piece lives on its own interval. At x = 1 the closed dot belongs to the second piece, so f(1) = 4, not 3.

Formal definition and notation

A piecewise function f is defined by a list of pairs (formula, condition), where the conditions describe disjoint subsets of the domain whose union is the whole domain. For each input x, f(x) is given by the one formula whose condition x satisfies. Because the conditions do not overlap, each input still has exactly one output.

Symbol Read it as Meaning
f(x) = { f of x equals, in cases a large left brace groups the pieces; each line is a formula, then its condition
2x + 1, if x < 1 2 x plus 1 if x is less than 1 one piece: the formula and where it applies
open dot open circle endpoint not included (condition uses < or >)
closed dot filled circle endpoint included (condition uses ≤ or ≥)

Key facts

  • The absolute value function is piecewise: |x| = x if x ≥ 0 and |x| = −x if x < 0.
  • A graph may jump at a boundary (as in the picture) or connect smoothly; both are allowed.
  • The conditions must not overlap. If an input fit two pieces with different outputs, the rule would not be a function.
  • Step functions, such as postage that rises at each ounce, are piecewise functions made of horizontal pieces.
  • Graph each piece only on its own interval, then mark endpoints with open or closed dots.

How to evaluate a piecewise function

How to evaluate a piecewise function
Find the piece whose condition the input satisfies, then use only that formula.
1. Locate
compare the input with each condition, paying attention to < versus ≤ at the boundary
2. Substitute
put the input into that piece’s formula
3. Ignore
the other pieces do not apply to this input

At a boundary such as x = 1, the piece with ≤ or ≥ owns the point. The other piece ends there with an open dot.

Piecewise Function examples, step by step

Example 1: Evaluate at three inputs

Warm-up

For f(x) = x2 if x < 0 and f(x) = 3x + 2 if x ≥ 0, find f(−4), f(0) and f(5).

  1. −4 < 0: use x2, so f(−4) = 16.
  2. 0 ≥ 0: use 3x + 2, so f(0) = 2.
  3. 5 ≥ 0: use 3x + 2, so f(5) = 17.

Answer: f(-4) = 16, f(0) = 2, f(5) = 17.

Example 2: Write absolute value in pieces

Core

Write g(x) = |x − 3| as a piecewise function and find g(1).

  1. The inside x − 3 is nonnegative when x ≥ 3; then g(x) = x − 3.
  2. When x < 3, the inside is negative, so take its opposite: g(x) = −(x − 3) = 3 − x.
  3. 1 < 3, so g(1) = 3 − 1 = 2.

Answer: g(x) = x – 3 if x ≥ 3, and 3 – x if x < 3; g(1) = 2.

Example 3: A tiered price

Test-style

A parking garage charges 6 dollars for up to 2 hours, then 4 dollars for each hour after that: C(h) = 6 if 0 < h ≤ 2, and C(h) = 6 + 4(h − 2) if h > 2. What do 2 hours and 5 hours cost?

  1. h = 2 satisfies 0 < h ≤ 2, so C(2) = 6.
  2. h = 5 satisfies h > 2, so C(5) = 6 + 4(3).
  3. 6 + 12 = 18.

Answer: 2 hours cost 6 dollars and 5 hours cost 18 dollars.

Common mistakes

✗ MistakeFor f(x) = 2x + 1 if x < 1, 5 − x if x ≥ 1: f(1) = 2(1) + 1 = 3.
✓ Instead1 ≥ 1, so use the second piece: f(1) = 5 − 1 = 4.

At a boundary, read the inequality signs. Only the piece with ≤ or ≥ includes the endpoint.

✗ MistakeGraph each formula as a full line across the whole grid.
✓ InsteadDraw 2x + 1 only to the left of x = 1 and 5 − x only from x = 1 to the right.

Each formula is in charge of its own interval only. Outside it, that piece does not exist.

✗ Mistakeh(x) = x if x ≤ 2, x + 4 if x ≥ 2 is a piecewise function.
✓ InsteadIt gives h(2) = 2 and h(2) = 6, so it is not a function. Change one condition to x > 2.

Overlapping conditions can give one input two outputs. Each boundary point belongs to exactly one piece.

Not to be confused with

Piecewise Functionvs.System of equations

A system lists equations that must all be true at once. A piecewise function lists formulas, and only one applies for each input.

Piecewise Functionvs.Step function

A step function is one kind of piecewise function whose pieces are all horizontal, like postage prices. A piecewise function can have slanted or curved pieces.

Quick check: 3 questions

Question 1 of 3

f(x) = 4 − x if x ≤ 3, and f(x) = 2x if x > 3. What is f(3)?

Show answer and explanation

Answer: B. 3 satisfies x ≤ 3, so f(3) = 4 − 3 = 1. 6 used the wrong piece, 7 added 4 and 3, and −1 subtracted in the wrong order.

Question 2 of 3

Using the same f, what is f(5)?

Show answer and explanation

Answer: D. 5 > 3, so use 2x: f(5) = 10. −1 used the first piece, 9 added 4 and 5, and 7 added 2 and 5 instead of multiplying.

Question 3 of 3

On the graph of a piecewise function, the first piece ends at (2, 5) with an open dot, and the second starts at (2, 1) with a closed dot. What is f(2)?

Show answer and explanation

Answer: A. Only the closed dot is part of the graph, so f(2) = 1. The open dot at 5 is excluded. A function cannot have two outputs, and the closed dot shows f(2) is defined.

Piecewise Function: frequently asked questions

How do you graph a piecewise function?

Graph each piece only on its own interval. Make a short table for each formula using inputs from its interval, including the boundary. Draw that part of the graph, then mark each boundary with a closed dot if the condition includes it (≤, ≥) or an open dot if it does not (<, >). Finally, check that no vertical line hits two points.

Is absolute value a piecewise function?

Yes. |x| equals x when x ≥ 0 and −x when x < 0. The two pieces meet at the origin to form a V. Writing absolute value in pieces is often the easiest way to solve or graph equations with absolute values, because each piece is an ordinary linear expression.

Can a piecewise function be continuous?

Yes. If the pieces meet at each boundary, the graph has no jump. For example, f(x) = x + 1 if x < 2 and f(x) = 5 − x if x ≥ 2 both give 3 at x = 2, so the graph connects. Pieces that give different values at a boundary make a jump.

Practice and tools

Sources

  1. Common Core State Standards, High School Functions: Interpreting Functions (HSF-IF.C.7.b)
  2. OpenStax, College Algebra 2e, 3.2 Domain and Range (piecewise-defined functions)

Updated November 2026·Reviewed by the Effortless Math team·Standards: CCSS HSF-IF.C.7.b

Cite this entry

Effortless Math Team. “Piecewise Function.” Effortless Math Dictionary. Updated November 2026. https://www.effortlessmath.com/math-dictionary/piecewise-function/

Flashcard

TermPiecewise Functiondifferent rules on different intervals
DefinitionA function built from several formulas, each on its own interval. Check where the input falls, then use that piece. |x| is one.
Study the full deck

Browse all terms in the Math Dictionary · More functions terms · Random term