Piecewise and Step Functions
A piecewise function uses different rules on different parts of the domain. One formula might apply when and a different one when — the conditions written next to each piece tell you which rule is in charge for any given input.
Evaluating one is a two-step routine: first decide which condition your input satisfies, then use only that piece and ignore the rest. Students who miss piecewise questions almost always skip the first step and grab the wrong rule.
How to evaluate a piecewise function
Take and find . Check the condition first: , so the top rule applies, and . For : since , the bottom rule applies, and .
Pay close attention at the boundary. If the input lands exactly where the rules change, the inequality signs decide: a piece with includes , while a piece with does not. Exactly one piece should claim each input.
Step functions
A step function is a piecewise function that is constant on each piece, so its graph looks like stair steps — flat segments at different heights. The graph below shows one: every input from up to (but not including) gives an output of , and every input from up to gives an output of .
The dots on the graph carry real information. A closed dot means that endpoint is included in the piece; an open dot means it is not. Reading on the graph below, the point jumps to the higher step: the open dot at the end of the lower segment says belongs to the upper one, so .
Where you meet these in real life
Step functions model anything priced in chunks: parking that charges per hour or any part of an hour, shipping tiers by weight, movie tickets by age bracket. The input can vary smoothly, but the output jumps between fixed values — which is exactly what the stair-step graph shows.
Worked examples
Example 1: pick the right piece
Find for
Answer:
Example 2: an input at the boundary
Find for
Answer:
Example 3: read a step function's graph
Using the step function graphed above, find and .
Answer: and
Try one yourself
Common questions
How do I know which piece to use?
Test your input against each condition. Exactly one should be true — use that piece and ignore the others. Never plug the input into more than one rule.
What happens right at the boundary between two pieces?
The inequality signs decide. A condition like claims the boundary point; does not. On a graph, the same information shows up as closed dots (included) and open dots (excluded).
Is a piecewise function still a function?
Yes, as long as each input gets exactly one output. The conditions are written so the pieces never overlap — every belongs to one and only one rule.
What makes a step function different from other piecewise functions?
Each of its pieces is a constant, so the graph is a set of flat segments at different heights instead of slanted lines. The output jumps between values rather than changing gradually.
Want the video version?
Allday Everyday Math has video lessons, practice, and an AI tutor for every topic, Pre-Algebra through Algebra 2.