Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

How to Evaluate and Graph a Piecewise Function

A piecewise function uses different formulas on different intervals. The input decides which formula applies; the graph is each formula drawn only on its own interval, with open or solid dots at the boundaries.

Recognize the task

The function is written with a brace and conditions: {x+3x<12x−1x≥1\begin{cases} x + 3 & x < 1 \\ 2x - 1 & x \geq 1 \end{cases}. Also absolute values such as ∣2x−4∣|2x - 4| and step functions such as tax brackets or postage rates. Typical tasks: values at given inputs, the graph, continuity at a boundary, the range. Test: does the rule change at a certain value of xx?
Piecewise functions are defined in the piecewise functions lesson.

Steps

StepOn f(x)=x+3f(x) = x + 3 for x<1x < 1, f(x)=2x−1f(x) = 2x - 1 for x≥1x \geq 1
1List each piece with its interval. Write the intervals in interval notation and check that they do not overlap.x+3x + 3 on (−∞,1)(-\infty, 1); 2x−12x - 1 on [1,∞)[1, \infty)
2Evaluate: let the input pick the piece. Find the condition the input satisfies, then use only that formula.Substitution ↗f(−2)=1f(-2) = 1, f(1)=1f(1) = 1, f(3)=5f(3) = 5
3Find both values at each boundary. Put the boundary into each neighboring formula. The piece whose condition includes it gets a solid dot; the other gets an open dot.left: 1+3=41 + 3 = 4 (open); right: 2(1)−1=12(1) - 1 = 1 (solid)
4Draw each piece only on its interval. Graph each formula as usual and erase everything outside its interval.slope 11 up to (1,4)(1, 4); slope 22 from (1,1)(1, 1)
5Read off continuity, domain and range. Equal boundary values mean the pieces join (continuity); the range is the union of the pieces' ranges.jump at x=1x = 1; domain R\mathbb{R}; range (−∞,4)∪[1,∞)=R(-\infty, 4) \cup [1, \infty) = \mathbb{R}

Worked examples

Example 1 · evaluating at three inputs

lookup first
f(x)=3x+2f(x) = 3x + 2 for x<1x < 1, x2−1x^2 - 1 for x≥1x \geq 1
f(−2)=3(−2)+2=−4f(-2) = 3(-2) + 2 = -4
−2<1-2 < 1: first piece
f(1)=1−1=0f(1) = 1 - 1 = 0, f(4)=16−1=15f(4) = 16 - 1 = 15
x≥1x \geq 1: second piece

Example 2 · an absolute value as two pieces

rewrite
∣2x−4∣|2x - 4|: 2x−4≥0  ⟺  x≥22x - 4 \geq 0 \iff x \geq 2
where the inside changes sign
2x−42x - 4 for x≥2x \geq 2, 4−2x4 - 2x for x<2x < 2
negate the inside when negative
check: x=0x = 0 gives 44, x=5x = 5 gives 66 ✓
matches ∣−4∣|{-4}| and ∣6∣|6|

Example 3 · choosing a constant for continuity

continuity
f(x)=x2f(x) = x^2 for x<2x < 2, kx−2kx - 2 for x≥2x \geq 2
22=2k−22^2 = 2k - 2
both pieces meet at x=2x = 2
k=3k = 3
solve the linear equation
Build pieces and move the boundaries in the piecewise function visualizer.

See it happen

A piecewise graph is a set of ordinary graphs cut with scissors along vertical lines at the boundaries. Each formula keeps only the strip of the plane that its condition allows. At a cut, exactly one piece owns the boundary point, which gets the solid dot, so every vertical line still meets the graph once. If the two cut edges land at the same height, the pieces join and the function is continuous there.

Common mistakes

Using the wrong piece at the boundary

✗ f(1)=3(1)+2=5f(1) = 3(1) + 2 = 5 for the pieces x<1x < 1 and x≥1x \geq 1
✓ 1≥11 \geq 1 picks the second piece: f(1)=12−1=0f(1) = 1^2 - 1 = 0

Forgetting the endpoint markers

✗ both lines drawn up to x=1x = 1 with no dots
✓ open dot at (1,4)(1, 4), solid dot at (1,1)(1, 1), so f(1)=1f(1) = 1

Overlapping conditions

✗ x+3x + 3 for x≤1x \leq 1, 2x−12x - 1 for x≥1x \geq 1
✓ use x<1x < 1 and x≥1x \geq 1; otherwise f(1)f(1) has two values

Dropping the sign on the negative piece

✗ ∣2x−4∣=2x+4|2x - 4| = 2x + 4 for x<2x < 2
✓ ∣2x−4∣=−(2x−4)=4−2x|2x - 4| = -(2x - 4) = 4 - 2x for x<2x < 2