Graphing Piecewise Functions: Basic Techniques
From the Piecewise functions curriculum
TL;DR
You'll learn to graph piecewise functions by treating each piece as its own mini-function, restricted to its own domain slice. You'll master open vs. closed circles at boundary points, and how to check continuity by comparing left and right limits. By the end, you'll graph any piecewise function confidently, piece by piece.
1. The Mental Model
A piecewise function is really several ordinary functions stitched together, each one only "turned on" for a specific x-range. Graphing it means drawing each piece separately, then trimming it to fit its domain window. The boundary points are where you need the most care — that's where circles (open or closed) tell the real story. Think of it as graphing three different functions on three different sheets of tracing paper, then overlapping only the visible windows.
2. The Core Material
2.1 Reading the Definition Correctly

Photo by Pixabay on Pexels
A piecewise function looks like this:
$$f(x) = \begin{cases} x+3 & \text{if } x < -1 \\ x^2 & \text{if } -1 \le x \le 2 \\ -x+6 & \text{if } x > 2 \end{cases}$$
The first thing to do — before drawing anything — is translate this into plain instructions:
- For any x strictly less than -1, use the rule $x+3$.
- For any x between -1 and 2, inclusive on both ends, use $x^2$.
- For any x strictly greater than 2, use $-x+6$.
Notice that the inequality symbols tell you exactly which endpoints belong to which piece. This matters enormously because $x=-1$ only belongs to the second piece (since it's $\le$), not the first. Get into the habit of underlining or circling the inequality signs before you graph anything — it's the single most common place students lose points.
2.2 The Three-Step Graphing Method

Photo by RDNE Stock project on Pexels
Here's the process, step by step, every single time:
Step 1 — Isolate each piece and its domain. Write out each rule next to its restricted interval, separately, as if they were three unrelated problems.
Step 2 — Graph each piece as if it extended forever, then erase/trim outside its domain. It helps to lightly sketch the full line or curve first (dashed), then darken only the part inside the allowed x-range. This avoids the mistake of drawing a "sad little stub" that doesn't reflect the true shape of the function (e.g., a parabola piece should still look like part of a parabola, not a random curve).
Step 3 — Handle the boundary points with circles. At every x-value where a domain restriction starts or stops, you must decide: is that exact point included (closed circle, filled-in dot) or excluded (open circle, hollow dot)? This is determined purely by whether the inequality is $\le/\ge$ (closed) or $</>$ (open).
Let's apply this to our function at the boundary $x = -1$:
- Piece 1 ($x+3$, for $x<-1$): plug in $x=-1$ even though it's not included: $f(-1) = -1+3 = 2$. Since the inequality is strict ($<$), you draw an open circle at $(-1, 2)$.
- Piece 2 ($x^2$, for $-1\le x\le 2$): plug in $x=-1$: $f(-1) = (-1)^2 = 1$. Since this piece does include $-1$, you draw a closed circle at $(-1, 1)$.
So at $x=-1$ you actually get two dots stacked at different heights — one open at $y=2$, one closed at $y=1$. This is completely normal and tells you the function "jumps" at that x-value.
2.3 Checking for Jumps vs. Continuity

Photo by Jose Ricardo Barraza Morachis on Pexels
Once your graph is drawn, you can read off whether the function is continuous (no breaks) or has a jump, just by looking at the boundary dots.
- If the closed dot from one piece lands at the exact same point as where the next piece would start, the graph connects smoothly — no visible break.
- If the two dots land at different heights (like above: open circle at $y=2$, closed circle at $y=1$), there's a vertical gap — a jump discontinuity.
You can verify this algebraically using one-sided limits:
$$\lim_{x \to -1^-} f(x) = \lim_{x \to -1^-} (x+3) = 2$$
$$\lim_{x \to -1^+} f(x) = \lim_{x \to -1^+} (x^2) = 1$$
Since $2 \neq 1$, the limits disagree, confirming the jump you saw visually. This cross-check (graph vs. limit) is a great habit — if your algebra and your drawing disagree, one of them has an error.
flowchart TD
A["Read the piecewise definition"] --> B["Split into separate rule + domain pairs"]
B --> C["Lightly sketch each full rule (dashed)"]
C --> D["Trim each sketch to its domain interval"]
D --> E["At each boundary x-value, plug into both adjacent pieces"]
E --> F{"Do the two y-values match?"}
F -- "Yes" --> G["Closed circle only — graph connects smoothly"]
F -- "No" --> H["Open circle on excluded piece, closed circle on included piece — jump"]
2.4 Python Check (Optional but Useful)

Photo by Stanislav Kondratiev on Pexels
If you want to verify your hand-drawn graph, this snippet plots a piecewise function exactly like the one above using numpy and matplotlib:
import numpy as np
import matplotlib.pyplot as plt
x1 = np.linspace(-5, -1, 100, endpoint=False) # x < -1
x2 = np.linspace(-1, 2, 100) # -1 <= x <= 2
x3 = np.linspace(2, 5, 100)[1:] # x > 2 (skip x=2 itself)
y1 = x1 + 3
y2 = x2**2
y3 = -x3 + 6
plt.plot(x1, y1, 'b', label='x+3, x<-1')
plt.plot(x2, y2, 'g', label='x^2, -1<=x<=2')
plt.plot(x3, y3, 'r', label='-x+6, x>2')
plt.plot(-1, 2, 'o', mfc='white', mec='b') # open circle
plt.plot(-1, 1, 'o', color='g') # closed circle
plt.plot(2, 4, 'o', color='g') # closed circle (end of piece 2)
plt.plot(2, 4, 'o', mfc='white', mec='r') # open circle (start of piece 3, same point here!)
plt.legend(); plt.grid(True); plt.show()
Running this shows you visually whether your pieces line up (continuous) or jump apart.
3. Worked Example
Let's graph this function completely, from scratch:
$$g(x) = \begin{cases} -2x - 1 & \text{if } x \le 0 \\ \sqrt{x} + 1 & \text{if } 0 < x < 4 \\ 3 & \text{if } x \ge 4 \end{cases}$$
Step 1: Identify the pieces.
- Piece A: line $-2x-1$, valid for $x \le 0$.
- Piece B: square root curve $\sqrt{x}+1$, valid for $0 < x < 4$.
- Piece C: constant line $y=3$, valid for $x \ge 4$.
Step 2: Graph Piece A. This is a line with slope $-2$ and y-intercept $-1$. Pick two points: at $x=0$, $y=-2(0)-1=-1$. At $x=-2$, $y=-2(-2)-1=3$. Draw the line through $(-2,3)$ and $(0,-1)$, extending it leftward forever (arrow), but stopping at $x=0$ on the right since that's the domain edge.
Check the boundary at $x=0$: since the inequality is $\le$, this piece includes $x=0$. So $(0,-1)$ gets a closed circle.
Step 3: Graph Piece B. This is $\sqrt{x}+1$, shifted up by 1 from the basic square root shape. At $x=0$: $y = \sqrt{0}+1 = 1$. At $x=1$: $y=\sqrt{1}+1=2$. At $x=4$: $y=\sqrt{4}+1=3$. Sketch the curve rising gently from $(0,1)$ through $(1,2)$ toward $(4,3)$.
Check both boundaries: at $x=0$, the inequality is strict ($0 < x$), so this piece does not include $x=0$ — open circle at $(0,1)$. At $x=4$, the inequality is also strict ($x<4$), so this piece doesn't include $x=4$ either — open circle at $(4,3)$.
Step 4: Graph Piece C. This is the horizontal line $y=3$, valid for $x \ge 4$. Since it's $\ge$, $x=4$ is included — closed circle at $(4,3)$. Draw a flat ray starting at $(4,3)$ extending rightward forever.
Frequently asked about Graphing Piecewise Functions: Basic Techniques
Study this next
Get the full Piecewise functions curriculum
Clone the complete plan to your dashboard for unlimited AI-generated notes, practice quizzes, and a personalised revision schedule.
Save this course free