Piecewise Calculator
Piecewise functions use different rules on different parts of the number line — tax brackets, shipping rates and absolute value are everyday examples. Enter each piece and its interval to evaluate the function, draw an accurate graph with open and closed dots, and check whether it is continuous where the pieces meet.
- Free to use
- No sign-up
- Runs in your browser
Piecewise function calculator
Piecewise Functions Practice Pack
Printable piecewise function worksheets with answer keys (evaluating, continuity and graphing), blank coordinate grids and a reference card on notation and continuity.
- Evaluation worksheet (PDF/DOCX)
- Continuity worksheet (PDF/DOCX)
- Graph grids (PDF)
- Reference card (PDF)
Formats: PDF, DOCX. Instant download after payment (link valid 72 hours, up to 5 downloads). AI-assisted: the templates were drafted with AI help and reviewed and laid out before publishing.
$5.00 USD, one-time 4 files · about $1.25 each
- Instant download
- 7-day refund
- Secure checkout by Stripe
✓ Classroom use included
7-day money-back guarantee. Full refund within 7 days of purchase, even after you download.
Free sample: Coordinate Grids (PDF, 98 KB)
Full refund within 7 days — see the refund policy and license.
License: personal and classroom use. Teachers may print and photocopy these files for the students in their own classes, and share them in a password-protected class space (e.g. Google Classroom). Please do not resell, redistribute, or post the files on public websites. One purchase covers one teacher.
Free printables
Single sheets you can print right now, no sign-up. The full pack adds every sheet in one download plus the editable files.
What is a piecewise function?
A piecewise function is defined by different formulas on different intervals of x. Written out, it looks like: f(x) = x² if x < 1; 2x − 1 if 1 ≤ x ≤ 3; 8 − x if x > 3. To evaluate it, find the piece whose interval contains x and use that formula. Each x must belong to at most one piece, or the function would have two values at once.
Worked example
With the three pieces above (the calculator’s default), f(0) = 0 from the first piece, f(2) = 3 from the second and f(5) = 3 from the third. At x = 1 the left piece approaches 1² = 1 and the middle piece gives 2(1) − 1 = 1, so the function is continuous there. At x = 3 the middle piece gives 5 but the right piece approaches 8 − 3 = 5 too — continuous again. Changing the third piece to 10 − x would create a jump of 2 at x = 3, and the calculator would report a jump discontinuity.
Open and closed dots
| Endpoint | Symbol | On the graph |
|---|---|---|
| Included | ≤ or ≥, square bracket [ ] | Closed (filled) dot |
| Excluded | < or >, round bracket ( ) | Open (hollow) dot |
| Unbounded | −∞ or ∞ | No dot; the piece continues to the edge |
Where two pieces meet at the same point and one includes it, you will see one filled dot and one open dot at the same place — or a single filled dot on top of an open one if the values match.
Checking continuity
- Find each breakpoint where pieces meet.
- Compute the limit from the left using the left piece.
- Compute the limit from the right using the right piece.
- Evaluate the function at the breakpoint itself.
- If all three agree, the function is continuous there; if the one-sided limits differ, it has a jump; if the limits agree but the value differs or is missing, the discontinuity is removable.
Everyday piecewise functions
| Example | Pieces |
|---|---|
| Absolute value | |x| = −x if x < 0; x if x ≥ 0 |
| Shipping cost | $5 if weight ≤ 1 kg; $5 + $2 per extra kg above |
| Tax brackets | Different marginal rates on each income band |
| Mobile data plan | Flat fee up to the allowance, then a per-GB charge |
| Step function | Floor(x) — a constant on each interval [n, n + 1) |
Integrating a piecewise function
To integrate across several pieces, split the integral at each breakpoint and add the parts. For the example from 0 to 5: ∫₀¹ x² dx + ∫₁³ (2x − 1) dx + ∫₃⁵ (8 − x) dx = 1/3 + 6 + 8 = 14.3333. The calculator integrates numerically with 4,000 midpoints, which matches this to four decimal places.
Writing piecewise functions from a graph
- Find where the graph changes rule — these are the breakpoints.
- For each section, decide the formula: find the slope and intercept of a line, or recognise a parabola or constant.
- Look at the dots at each breakpoint: closed dots mean ≤ or ≥, open dots mean < or >.
- Write each piece with its interval, making sure every x is covered exactly once over the domain.
- Check by entering your answer into the calculator and comparing graphs.
Domain and range of piecewise functions
The domain is the union of all the pieces’ intervals. If the intervals leave a gap — for example, one piece for x < 1 and the next for x > 1 with neither including 1 — the function is undefined there, and the calculator reports “not defined here” at that breakpoint. The range is the set of all outputs across every piece; read it from the graph by looking at the lowest and highest points each piece reaches, taking care with open endpoints, which are not actually reached.
Limits at a breakpoint in words
The left-hand limit asks what value the function approaches as x comes towards the breakpoint from smaller numbers; the right-hand limit asks the same from larger numbers. For a piecewise function each side is controlled by a different formula, so you simply substitute the breakpoint into the neighbouring formulas — even if that piece doesn’t include the point itself. The two-sided limit exists only when both one-sided limits are equal.
Absolute value as a piecewise function
Any absolute value expression can be rewritten piecewise by finding where the inside changes sign. For example, |2x − 4| equals −(2x − 4) = 4 − 2x when x < 2, and 2x − 4 when x ≥ 2. Entering those two pieces and comparing with abs(2x - 4) in a single piece shows identical graphs — a good way to check your algebra.
Typing tips
- Use ^ for powers: x^2.
- Leave the left bound empty for −∞ and the right bound empty for ∞.
- Constants are fine: a piece can simply be 4.
- Functions: sqrt, abs, sin, cos, tan, exp, ln.
- Check the overlap warning if two intervals share points.
Privacy
All calculations run in your browser.
Frequently asked questions
How do I evaluate a piecewise function?
Find the piece whose interval contains x and use its formula.
What does an open circle mean?
The endpoint is not included in that piece.
How do I know if a piecewise function is continuous?
At each breakpoint, the left limit, right limit and function value must all agree.
Can pieces overlap?
No — each x must have one value; the calculator warns about overlaps.
Can I use infinity?
Leave the bound empty for −∞ or ∞.
Does it integrate?
Yes, numerically over any interval where the function is defined.
What is a step function?
A piecewise function that is constant on each interval, like the floor function.
How many pieces can I add?
Up to five.
Why does the graph show both an open and a closed dot at one point?
One piece excludes the endpoint and the other includes it, so the function takes the closed dot’s value.
Can pieces use trigonometric functions?
Yes — sin, cos and tan use radians.
What if no piece covers an x-value?
The function is undefined there and the calculator shows “undefined”.
May I print and share these worksheets with my class?
License: personal and classroom use. Teachers may print and photocopy these files for the students in their own classes, and share them in a password-protected class space (e.g. Google Classroom). Please do not resell, redistribute, or post the files on public websites. One purchase covers one teacher.




Printable Piecewise Function Reference Card