Piecewise Function Calculator &
evaluator.
Build a function from pieces, find its value at any x, and test each break.
- Breakpoints
- 1
- Joins up at
- 0 of 1
- Pieces
- 2
At x = 0 the left side heads to 0 and the right side to 1, a jump of 1.
The graph, piece by piece
- x² if x < 0
- 2x + 1 if 0 ≤ x
From x = −4 to 4. Filled dots are ends a piece includes and hollow dots are ends it leaves out. The marked point is (1, 3). At x = 0 the left side heads to 0 and the right side to 1, a jump of 1.
Each breakpoint
| At x | Left | Right | f at x | Kind |
|---|---|---|---|---|
| 0f = 1 | 0 | 1Jump | 1 | Jump |
Table of values
| x | f(x) | Piece |
|---|---|---|
| −4 | 16 | 1 |
| −3 | 9 | 1 |
| −2 | 4 | 1 |
| −1 | 1 | 1 |
| 0 | 1 | 2 |
| 1 | 3 | 2 |
| 2 | 5 | 2 |
| 3 | 7 | 2 |
| 4 | 9 | 2 |
Working
- 1Test each condition in order until one holdsPiece 1: is x < 0 at x = 1? NoPiece 2: is 0 ≤ x at x = 1? Yes
- 2Put x = 1 into piece 2f(1) = 2x + 1 with x = 1, which gives 3
- 3Compare both sides at x = 0Left 0, right 1, f(0) = 1: jump
- 4Check: the piece used is the first that holds, and its formula gives the answer1 lies in 0 ≤ x, no earlier piece holds, and 2x + 1 gives 3 there
How it's worked out
A piecewise function uses more than one formula, each on its own interval of x. To find f(x), test the conditions in order and use the first one that holds. Only that piece is used.
An end written with ≤ or ≥ is included and gets a filled dot on the graph. An end written with < or > is left out and gets a hollow dot. A point where one piece hands over to the next is a breakpoint.
At each breakpoint b the tool finds the left-hand limit, the value the left piece heads to, and the right-hand limit. It finds them numerically, by trying x closer and closer to b. Then it compares them with f(b). Three things must hold for the function to be continuous at b.
- f(b) is defined, so some piece includes b.
- The left and right limits exist and are equal.
- That shared limit equals f(b).
When the two limits differ, the break is a jump. When they agree but f(b) is missing or different, it is a removable hole that one point could fill. When a side runs off to infinity, the break is infinite.
Worked examples
Sam checks a phone bill with a data tier
Sam's plan costs a flat $25 for under 2 GB. From 2 GB on, it adds $10 for each GB above 2. With x as the gigabytes used, the cost is two pieces.
Sam used 4 GB, so the second piece applies and the bill is $45. A month at 1.5 GB costs $25. At 2 GB both sides head to $25, so the price is continuous there: no sudden jump in the bill.
A jump where the pieces meet
With x² for x < 0 and 2x + 1 for x ≥ 0, the value at x = 1 comes from the second piece: f(1) = 3. At x = −0.5 the first piece gives 0.25.
At 0 the left side heads to 0 and the right side to 1. The limits differ, so this is a jump of 1. The graph shows a hollow dot at (0, 0) and a filled one at (0, 1), because 0 belongs to the second piece.
A hole filled with the wrong value
Here the same formula sits on both sides of 1, and a third piece sets f(1) = 3 on its own.
For any x other than 1 the fraction equals x + 1, so both sides head to 2. At x = 1.001 the value is 2.001. But f(1) is 3, so the break is removable: setting f(1) to 2 would close it.
Reading your result
Which piece was used. The answer names the piece and its condition. If two pieces overlap, the first one listed wins, and a note says so. If no piece covers x, the value is not defined there.
Continuous but not smooth. The pieces −x and x meet at 0, where both sides head to 0, so |x| is continuous. Yet the graph has a sharp corner there, so it has no slope at 0. Continuity does not mean you can take a derivative.
Infinite breaks. With 1/x for x < 0, the left side runs off to −∞ at 0, so the break is infinite: a vertical asymptote. No single point can fix that.
Limits found by trying values. The left and right limits come from x values a tiny step from the breakpoint. That is reliable for the formulas met in class, but a function that swings wildly near a point may be reported as having no limit.
Common mistakes
- Using both pieces at a shared end. At x = 0 with x < 0 and x ≥ 0, only the second piece applies. Including the end in both makes the rule give two values, so it is not a function.
- Judging dots by height. Whether a dot is filled depends on the condition, not on which end sits higher on the graph.
- Setting values equal at the wrong place. To join x² and kx at 2, match their values at x = 2, which gives k = 2. With k = 3 the right side heads to 6 instead of 4, a jump. With k = 2 the function is continuous at 2.
- Forgetting the domain. A plan priced only for x above 0 is not defined at 0. The tool lists any gap that no piece covers.