Piecewise & Step Functions
Not every function follows a single rule. Sometimes the formula changes depending on where you are on the x-axis. These are called piecewise functions, and they show up everywhere — from tax brackets to shipping rates to how your phone battery drains.
Let’s explore how they work by building them piece by piece.
1. A Simple Two-Piece Function
The idea is straightforward: use one formula when x is below a certain value, and a different formula when x is above it. The point where the rule changes is called the breakpoint.
Here we’ll graph a function that equals -x when x is negative and x squared when x is zero or positive. Watch how the graph has two distinct “personalities” joined at the breakpoint.
On the left side (x < 0) you see a straight line with slope -1. On the right side (x >= 0) you see the familiar parabola. They meet at the origin — that’s our breakpoint.
2. Moving the Breakpoint
What happens when you slide the breakpoint left or right? The function still uses the same two rules, but the handoff point changes. Drag the slider and watch the “seam” between the two pieces move along the x-axis.
Move the breakpoint around. Notice how at some positions the two pieces connect smoothly, and at others there’s a visible jump (discontinuity). Can you find a breakpoint value where the two pieces meet perfectly? Think about when -x equals x squared.
3. Absolute Value IS Piecewise
Here’s a connection that surprises a lot of students: the absolute value function |x| is actually a piecewise function in disguise!
It equals -x when x is negative (flip the sign to make it positive) and x when x is already positive. Let’s see them side by side.
The two curves lie exactly on top of each other. They’re the same function written two different ways.
Every absolute value function is piecewise. When you see |expression|, your brain should automatically think: “this equals the expression when it’s positive, and the negative of the expression when it’s negative.” That mental translation is key for solving absolute value equations and inequalities.
4. Adjustable Piecewise Slopes
Now let’s control the slopes of each piece. Use the sliders to change the slope of the left piece and the coefficient of the right piece. The breakpoint slider moves the junction.
The gray and blue dashed-looking curves show what each piece would look like if it continued past the breakpoint. The teal curve is the actual piecewise function — it picks up the left piece before the breakpoint and the right piece after. Try to find slider settings where the transition is perfectly smooth (no jump, no corner).
5. Step Functions
A step function is a special piecewise function that stays constant on each interval and then “jumps” to a new value. Think of postage rates: the price stays flat until your package hits the next weight bracket, then it jumps up.
The floor function (also called the greatest integer function) is the classic step function. It rounds every input down to the nearest integer. Dividing x by the step width before taking the floor controls how wide each “stair” is. Wider steps = wider stairs.
6. Continuity at the Breakpoint
A piecewise function is continuous at the breakpoint if both pieces give the same y-value there — no gap, no jump. Let’s investigate. Below, the left piece is a line mx + b and the right piece is x squared. Adjust b to eliminate the jump at x = 0.
Challenge: For the function to be continuous at x = 0, the left piece must equal the right piece at that point. The right piece gives 0 squared = 0. So the left piece needs m(0) + b = 0, which means b = 0. Slide b to 0 and confirm the gap disappears. Now, is the function also smooth (no corner)? What value of m would make it smooth too?