COLLEGE ALGEBRA • FUNCTIONS & GRAPHS

Piecewise Functions: Evaluate and Graph

Master the art of defining, evaluating, and graphing functions that change their rule across different intervals of the domain.

Historical Context & Motivation

Mathematics has long grappled with modeling phenomena that do not behave uniformly across all conditions. A single algebraic expression may elegantly describe a ball in flight, but it fails to capture the moment the ball strikes the ground and stops—or the tax rate that jumps once income crosses a threshold. The concept of a piecewise-defined function arose precisely because real-world systems frequently obey different rules in different regimes. Rather than forcing a single formula to do all the work, mathematicians learned to stitch together multiple expressions, each governing its own interval of the domain.

1748
Euler's Introductio
Leonhard Euler published Introductio in analysin infinitorum, defining a function as any analytic expression of a variable. This narrow view initially excluded piecewise rules, sparking debate about what a 'function' truly was.
1822
Fourier's Heat Equation
Joseph Fourier demonstrated that arbitrary functions—including those defined piecewise—could be represented by trigonometric series, legitimizing piecewise definitions in analysis and physics.
1837
Dirichlet's Modern Definition
Peter Gustav Lejeune Dirichlet proposed the modern notion of a function as a correspondence from each input to exactly one output, removing the requirement of a single analytic formula and fully sanctioning piecewise definitions.
1960s–Today
Computational & Applied Era
With the rise of computer science, piecewise functions became fundamental to algorithms (e.g., the ReLU activation function in neural networks), tax-bracket models, shipping cost tables, and spline interpolation in engineering.

The central question piecewise functions answer is deceptively simple: how do we rigorously define, evaluate, and visualize a function whose behavior changes at specific breakpoints in its domain? Mastering this question equips you to handle everything from absolute-value functions to step functions, from spline curves in computer graphics to real-world cost models. The remainder of this lesson develops the formal machinery and graphical techniques you need.

Core Principles & Definitions

A piecewise function is a function defined by two or more expressions, each applying to a specific subset of the domain. Formally, we write it using a brace notation that lists each sub-function alongside the interval on which it is active. The domain subsets must be mutually exclusive (no input belongs to two pieces simultaneously) and collectively exhaustive (every input in the stated domain is covered by exactly one piece). This ensures the relation passes the vertical line test and qualifies as a genuine function.

1

Sub-Functions (Pieces)

Each piece is an ordinary function—linear, quadratic, constant, etc.—valid only on its designated interval. The number of pieces is finite, and each may have its own algebraic form.
2

Domain Restrictions

Intervals are specified using inequalities (e.g., x < 2, x ≥ 2). Boundary points must be assigned to exactly one piece—open vs. closed endpoints matter and affect continuity.
3

Boundary (Breakpoint)

A breakpoint is the x-value where one rule ends and another begins. At a breakpoint, the function may be continuous (the pieces connect) or discontinuous (a jump or hole occurs).
4

Evaluation Protocol

To evaluate f(a), first determine which interval a belongs to by checking the domain restrictions. Then substitute a into the corresponding sub-function. There is never ambiguity if the intervals are properly defined.
5

Graphing Strategy

Graph each piece on its own interval, using open circles (○) for excluded endpoints and filled circles (●) for included endpoints. The complete graph is the union of these partial graphs.
KEY TAKEAWAY
Think of a piecewise function like a highway with different speed limits in different zones. A single sign cannot describe the whole road, so authorities post separate limits for the school zone, the residential stretch, and the interstate on-ramp. Similarly, a piecewise function posts separate formulas for different stretches of the x-axis. When you want to know how fast you may drive—or what f(x) equals—you first check which zone you are in, then read the rule that applies there.

Visual Explanation — Anatomy of a Piecewise Graph

The following diagram illustrates a three-piece function that combines a quadratic, a constant, and a linear segment. Pay close attention to the open and closed circles at the breakpoints: they encode which piece 'owns' the boundary value. This visual convention is essential for reading and constructing piecewise graphs.

The violet curve shows a quadratic piece for x < 0. The cyan horizontal segment represents the constant piece for 0 ≤ x < 3. The pink line depicts the linear piece for x ≥ 3. Note the jump discontinuity at x = 0 (the function jumps from 0 on the quadratic to 2 on the constant) and at x = 3 (from 2 on the constant to 1 on the linear).

When interpreting this graph, start by identifying the breakpoints at x = 0 and x = 3, where the governing rule switches. At each breakpoint, exactly one circle is filled (included) and the other is open (excluded), ensuring every x-value maps to a single y-value. The jump from the violet quadratic to the cyan constant at x = 0 shows a jump discontinuity: the left-hand limit as x → 0⁻ is 0, but f(0) = 2. Similarly, at x = 3 the constant piece approaches y = 2 from the left while the linear piece begins at y = 1, creating another jump. Recognizing these features on a graph is critical for discussing continuity, limits, and differentiability in later courses.

Mathematical Framework — Notation & Evaluation

The standard notation for a piecewise function uses a large brace that groups several lines, each consisting of an expression and its associated domain condition. This notation is not merely cosmetic—it encodes a decision procedure for evaluation. Let us formalize the structure and then derive evaluation and graphing techniques.

GENERAL PIECEWISE DEFINITION
f(x) = { f₁(x), if x ∈ D₁ ; f₂(x), if x ∈ D₂ ; … ; fₙ(x), if x ∈ Dₙ }
where f₁, f₂, …, fₙ are the sub-functions (pieces); D₁, D₂, …, Dₙ are disjoint subsets of the domain with D₁ ∪ D₂ ∪ … ∪ Dₙ = Dom(f); and n ≥ 2.
EVALUATION ALGORITHM
f(a) = fₖ(a) where k is the unique index such that a ∈ Dₖ
To evaluate f at a specific input a, scan the conditions D₁, D₂, …, Dₙ until you find the one that contains a. Substitute a into the corresponding sub-function fₖ. Since the Dₖ are disjoint, at most one condition can be true—and since they are exhaustive, exactly one is true for every a in the domain.
CONTINUITY AT A BREAKPOINT c
f is continuous at c ⟺ lim(x→c⁻) f(x) = f(c) = lim(x→c⁺) f(x)
At each breakpoint c, check whether the left-hand limit (from the left piece) and right-hand limit (from the right piece) both exist and equal f(c). If all three agree, the function is continuous at c; otherwise, a discontinuity (jump, removable, or otherwise) occurs.
⚠️ Common Pitfall
Students often confuse the strict inequality x < c with the non-strict inequality x ≤ c when writing domain conditions. This matters: if piece 1 uses x < 2 and piece 2 uses x ≥ 2, then f(2) is determined by piece 2. If you accidentally write x ≤ 2 for both pieces, the function is not well-defined at x = 2 because two rules compete. Always ensure that every boundary value appears in exactly one condition.

Detailed Graphing Procedure

Graphing a piecewise function is a systematic, step-by-step process. The key insight is that you are not graphing one function—you are graphing several familiar functions, each restricted to its own interval, and then combining the partial graphs onto a single coordinate plane. The following procedure formalizes this approach and the accompanying diagram walks through a concrete example.

  1. Step 1 — Identify pieces and breakpoints. Write out each sub-function and its interval. List all boundary x-values (breakpoints) where rules transition.
  2. Step 2 — Graph each piece in isolation. Temporarily ignore the other pieces and sketch the full parent graph (line, parabola, etc.) lightly. Then erase everything outside the designated interval.
  3. Step 3 — Mark endpoints. At each breakpoint, place a filled dot (●) if the piece includes that boundary (≤ or ≥) and an open dot (○) if it does not (< or >).
  4. Step 4 — Check continuity. Evaluate both pieces at each breakpoint. If they yield the same y-value and the endpoint is included, the graph connects smoothly. Otherwise, annotate the jump or hole.
  5. Step 5 — Combine and label. Overlay all restricted graphs onto one set of axes. Confirm that the result passes the vertical line test.
Top-left: the line y = 2x + 1 is drawn only for x < 1 (dashed beyond). Top-right: the line y = −x + 4 is drawn only for x ≥ 1. Bottom: the combined graph shows the two pieces meeting at (1, 3), where the filled dot indicates the right piece includes the boundary. Because both pieces yield y = 3 at x = 1, the function is continuous at the breakpoint.

Notice in the combined graph that both pieces approach the point (1, 3). The left piece gives 2(1) + 1 = 3 and the right piece gives −1 + 4 = 3, so the left-hand and right-hand limits agree and the function is continuous at the breakpoint. When the limits disagree—or when the function value at the boundary does not match the limits—you see a visible gap or jump in the graph, which you should annotate with appropriately placed open and closed circles.

Worked Example — Evaluate and Graph a Three-Piece Function

Consider the piecewise function defined by f(x) = { x² − 1, if x < −1 ; 3, if −1 ≤ x ≤ 2 ; 2x − 1, if x > 2 }. We will evaluate f at several inputs and then sketch the complete graph.

Evaluating f(−3), f(−1), f(0), f(2), and f(5)
1
Step 1 — Evaluate f(−3)Since −3 < −1, we use the first piece: f(−3) = (−3)² − 1 = 9 − 1.
f(−3) = 8
2
Step 2 — Evaluate f(−1)Since −1 satisfies −1 ≤ x ≤ 2, we use the second piece: f(−1) = 3. Note that if we mistakenly used piece 1, we would get (−1)² − 1 = 0, which is a different value. The domain condition −1 ≤ x assigns x = −1 to piece 2.
f(−1) = 3
3
Step 3 — Evaluate f(0)Since 0 lies in the interval [−1, 2], we use the second piece: f(0) = 3.
f(0) = 3
4
Step 4 — Evaluate f(2)Since 2 satisfies −1 ≤ x ≤ 2 (the inequality is non-strict on both sides), piece 2 governs: f(2) = 3. Piece 3 requires x > 2, which excludes x = 2.
f(2) = 3
5
Step 5 — Evaluate f(5)Since 5 > 2, we use piece 3: f(5) = 2(5) − 1 = 10 − 1.
f(5) = 9
6
Step 6 — Check Continuity at BreakpointsAt x = −1: the left-hand limit from piece 1 is (−1)² − 1 = 0, but f(−1) = 3 from piece 2. Since 0 ≠ 3, there is a jump discontinuity at x = −1. At x = 2: the right-hand limit from piece 3 as x → 2⁺ is 2(2) − 1 = 3, and f(2) = 3. Since both equal 3, the function is continuous at x = 2.
Jump at x = −1; continuous at x = 2
7
Step 7 — Sketch the GraphDraw the parabola y = x² − 1 for x < −1, ending with an open circle at (−1, 0). Draw the horizontal line y = 3 from x = −1 to x = 2 with filled circles at both endpoints. Draw the line y = 2x − 1 for x > 2 starting just after x = 2 with an open circle at (2, 3)—but since f(2) = 3 from piece 2 already fills that point, the two dots overlap. In practice the filled dot from piece 2 takes precedence, and piece 3's open circle is hidden behind it.
Graph complete with three distinct segments

Common Piecewise Functions & Their Properties

Several important functions in mathematics are inherently piecewise. Recognizing them as such deepens your understanding of their behavior and prepares you for more advanced work in real analysis, optimization, and applied mathematics.

Well-known functions that are naturally piecewise-defined
FunctionPiecewise DefinitionKey Properties
Absolute Value |x|f(x) = { x, if x ≥ 0 ; −x, if x < 0 }V-shaped graph; continuous everywhere; not differentiable at x = 0 (corner)
Step / Floor ⌊x⌋f(x) = n for n ≤ x < n + 1, n ∈ ℤStaircase graph; jump discontinuity at every integer; right-continuous
Signum sgn(x)f(x) = { 1, if x > 0 ; 0, if x = 0 ; −1, if x < 0 }Outputs only −1, 0, or 1; jump discontinuities at x = 0; used in optimization and control theory
ReLU (Rectified Linear Unit)f(x) = { x, if x ≥ 0 ; 0, if x < 0 }Continuous everywhere; not differentiable at x = 0; the default activation function in modern neural networks
KEY TAKEAWAY
Piecewise functions are not a niche curiosity—they are everywhere. The absolute value function you first encountered in middle school is piecewise. The floor function that your computer uses to truncate decimals is piecewise. The ReLU activation powering modern AI is piecewise. Mastering piecewise evaluation and graphing is not just an algebraic exercise; it is building the vocabulary for applied mathematics, computer science, and engineering.

Connections to Advanced Theory

The piecewise functions you encounter in College Algebra lay the foundation for more sophisticated constructions in calculus, numerical analysis, and applied mathematics. Understanding how these ideas extend gives you a glimpse of why the evaluation and graphing skills you are developing now are so central to the discipline.

How piecewise-function skills extend into advanced mathematics
College Algebra ConceptAdvanced ExtensionWhere You'll See It
Evaluating f(a) by checking which interval a belongs toDefining left-hand and right-hand limits, then testing continuity (ε–δ definition)Calculus I — Limits and Continuity
Graphing each piece on its intervalPiecewise integration: splitting ∫ₐᵇ f(x) dx into subintegrals at each breakpointCalculus II — Definite Integrals
Linear pieces connected at breakpointsCubic spline interpolation: constructing smooth piecewise polynomials through data pointsNumerical Analysis / Computer Graphics
Checking differentiability at cornersWeak derivatives and distributions; functions differentiable almost everywhere (Rademacher's theorem)Real Analysis / PDEs

In particular, the question of whether a piecewise function is differentiable at a breakpoint becomes central in Calculus I, where you will learn that continuity is necessary but not sufficient for differentiability. A piecewise function can be continuous at a breakpoint (the pieces connect) but still fail to be differentiable there if the slopes of the adjacent pieces disagree—this produces a 'corner' or 'cusp.' The absolute value function at x = 0 is the canonical example. By practicing continuity checks now, you are rehearsing the logical pattern that will reappear in derivative analysis.

Practice Problems

PROBLEM 1CONCEPTUAL
Explain why it is essential that the domain intervals in a piecewise function be mutually exclusive. What would go wrong if two pieces both claimed jurisdiction over the same x-value?
PROBLEM 2BASIC CALCULATION
Let g(x) = { 4x − 5, if x < 1 ; x² + 1, if x ≥ 1 }. Evaluate g(−2), g(1), and g(3).
PROBLEM 3INTERMEDIATE
Determine the value of the constant k so that the function h(x) = { kx + 2, if x < 3 ; x² − 1, if x ≥ 3 } is continuous at x = 3.
PROBLEM 4APPLIED
A rideshare company charges a flat fee of $3.00 plus $1.50 per mile for the first 10 miles. Beyond 10 miles, the rate drops to $1.00 per mile (in addition to what was already accumulated). Write a piecewise function C(m) for the total cost as a function of miles m (m ≥ 0), and compute the cost of a 15-mile ride.
PROBLEM 5CRITICAL THINKING
Consider f(x) = { ax² + bx, if x ≤ 1 ; cx + d, if x > 1 }. Find relationships among a, b, c, and d that guarantee f is (i) continuous at x = 1 and (ii) differentiable at x = 1. (Hint: differentiability requires the derivatives from the left and right to agree at the breakpoint.)

Summary & Review

A piecewise function is defined by multiple sub-functions, each governing a distinct interval of the domain. To evaluate such a function at an input a, identify which domain interval contains a and substitute into the corresponding sub-function. The intervals must be mutually exclusive and collectively exhaustive to ensure a unique output for every input. Pay careful attention to whether boundary values (breakpoints) are included (≤, ≥) or excluded (<, >) in each piece.

To graph a piecewise function, sketch each sub-function only on its designated interval, mark open circles (○) for excluded endpoints and filled circles (●) for included endpoints, and then check continuity at each breakpoint by comparing the left-hand limit, the right-hand limit, and the actual function value. If all three agree, the function is continuous there; if not, a jump discontinuity appears. These skills form the bedrock for calculus topics such as limits, derivatives of piecewise functions, and spline interpolation in numerical analysis.

Varsity Tutors • College Algebra • Piecewise Functions: Evaluate and Graph