Evaluating Piecewise Functions
Problem
f(x) = {x² if x<0, 2x+1 if 0≤x<3, 7 if x≥3}. Evaluate at x=−2, 1, 5.
Explanation
What is a piecewise function?
A piecewise function uses different formulas on different intervals of . To evaluate it at a specific , you must first determine which piece applies (which interval contains your ), then use that piece's formula.
The function
Step-by-step evaluation
Evaluate
Step 1 — Which piece? . Is ? Yes → use the first piece: .
Step 2 — Compute: .
Evaluate
Step 1 — Which piece? . Is ? No. Is ? Yes → use the second piece: .
Step 2 — Compute: .
Evaluate
Step 1 — Which piece? . Is ? No. Is ? No. Is ? Yes → use the third piece: .
Step 2 — Compute: .
Graphing a piecewise function
Draw each piece only on its interval. Use an open circle (∘) where a piece does NOT include the endpoint, and a closed circle (●) where it does. At the boundaries ( and ), check which piece "owns" the endpoint using the vs signs.
Checking continuity at boundaries
At : Left limit (from piece 1) = . Right value (piece 2) = . Since , there's a jump discontinuity at .
At : Left limit (piece 2) = . Right value (piece 3) = . Since , the function is continuous at .
Try it in the visualization
Drag the -slider across the domain. The graph highlights which piece is active, and the value updates. Open and closed dots at boundaries show the transition points.
Interactive Visualization
Parameters
Got your own math or physics problem?
Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.