What Is a Piecewise Function?
A piecewise function uses different formulas on different intervals, one rule here, another there, stitched at boundary points. Far from being a curiosity, piecewise definitions are how mathematics describes anything with regimes: tax brackets, shipping tiers, a thermostat's on/off, |x| itself (which is −x for negatives and x for non-negatives, the third chip builds it live). The interesting mathematics happens at the seams: does the function jump there, or do the pieces meet? That single question, continuity at the boundary, is where piecewise functions earn their permanent spot in every calculus course.
How to Use This Grapher
Enter two pieces and the boundary a (add a third piece and second boundary b for three-part definitions). The tool graphs each piece in its own color strictly on its own interval, jumps stay jumps, never falsely bridged, and at every seam it computes the left limit, the right limit, and the actual function value, delivering a verdict: continuous, or a jump of a stated size. It's a continuity checker and a grapher in one, because for piecewise functions the two jobs are inseparable.
Worked Example
The default: f(x) = x² for x < 1, and 2x − 1 for x ≥ 1. At the seam x = 1: the left limit is 1² = 1; the right limit is 2(1) − 1 = 1; the value is f(1) = 1. All three agree, continuous. More is true: the derivatives also agree (2x → 2 and the line's slope is 2), so the seam is smooth this is exactly how tangent lines extend curves, and the graph shows the parabola flowing into its own tangent line with no visible joint.
The second chip breaks the seam deliberately: x + 2 meets x² at x = 0 with left limit 2 but right limit 0, a jump of size 2, visible as the curve teleporting down. Same construction, one constant changed: continuity at a seam is an equation to be satisfied, not an accident.
Designing Continuity: Solving for the Constant
The standard exam problem runs the check backward: find k so the pieces meet. Given f = kx + 1 for x < 2 and x² for x ≥ 2, set the one-sided limits equal at the seam: 2k + 1 = 4, so k = 3/2. One equation per seam, one unknown per equation. The same design principle with derivatives added (match values and slopes) produces the splines of computer graphics, piecewise cubics agreeing to two derivatives at every seam, and the smoothstep functions of animation. Try candidate constants in the grapher and watch the gap close as you approach the solving value; it's the equation made visual.
Common Mistakes to Avoid
- Using the wrong piece at the boundary. The value f(a) comes from whichever piece owns the "=", here the ≥ side. The left piece contributes only the limit, not the value; mixing this up flips continuity verdicts.
- Bridging jumps when sketching. A hand-drawn (or lazily software-drawn) vertical segment connecting the two branches asserts f takes every value in between, false. Open circle on the limit that isn't attained, filled dot on the value that is.
- Checking continuity but forgetting differentiability. Pieces can meet yet form a corner (|x| at 0: continuous, not differentiable). Matching values is one equation; matching slopes is a second. The derivative at a point tool probes the slopes from each side.
- Overlapping or gapping the intervals. Conditions must tile the line exactly, every x claimed once. "x < 1" with "x > 1" leaves f(1) undefined; "x ≤ 1" with "x ≥ 1" defines it twice (legal only if both formulas agree there).
Real-World Applications
Piecewise functions are the mathematics of policy and pricing: income tax is piecewise linear in income (each bracket a piece, each threshold a seam, continuous by design, though marginal rates jump), utility bills tier consumption, parking and shipping rates step with duration and weight, and overtime pay kicks a wage function into a steeper piece past 40 hours. Reading such schedules as piecewise functions, seams and all, is genuinely useful financial literacy.
Engineering and computing run on them: signal processing's step and ramp inputs, mechanical models where friction switches sign with direction, battery charging curves (constant-current piece, then constant-voltage piece), neural networks' ReLU activation (literally max(0, x), the second chip's cousin, whose corner at 0 is a feature), and the splines that render every font glyph and animation path on screen. In each case the seams carry the engineering content: where regimes change is where design attention goes.
Frequently Asked Questions
What kinds of discontinuity can a seam have?
Jump (both one-sided limits exist, unequal, the usual piecewise case), removable (limits agree but the value differs or is missing, fixable by redefining one point), and infinite (a piece blows up approaching the seam). The grapher reports jumps with their exact size.
How do I make a seam differentiable, not just continuous?
Two equations at the seam: equal values and equal derivatives. With two tunable constants both are satisfiable, that's why spline pieces carry multiple coefficients. Continuity without slope-matching leaves a corner; slope-matching without continuity is meaningless (differentiability requires continuity first).
Can piecewise functions be integrated and differentiated?
Integrate piece by piece and add, the definite integral splits at seams by additivity, jumps and all. Differentiate inside each piece freely; at seams the derivative exists only where the seam is smooth. Corners contribute kinks to f but jumps to f′.
Is the absolute value function really piecewise?
|x| is definable piecewise (−x then x, seam at 0) and that definition is the practical one for calculus: it's why |x|′ = −1 then +1 with no derivative at 0, and why every |expression| in an integrand gets split at its sign changes before integrating.
What are step functions?
Piecewise constants the floor function, tax-rate schedules, digital signals. Every seam is a jump by construction. They're the building blocks of integration theory (simple functions) and the inputs of choice in control engineering (step response).
Why does my graphing calculator draw a false vertical line at jumps?
Connected-mode plotting joins consecutive samples regardless of jumps. This grapher avoids the artifact by drawing each piece as its own curve, ending exactly at the seam. On other tools, dot mode (or plotting pieces separately, as here) is the fix.