Piecewise function

A piecewise function is a function defined by different formulas on different intervals of its domain. On the AP Calculus exam, the action happens at the boundary points where pieces meet, since that's where you check whether the function is continuous or differentiable.

Verified for the 2027 AP Calculus AB/BC examLast updated June 2026

What is Piecewise function?

A piecewise function is a single function built from multiple formulas, where each formula applies only on its own piece of the domain. For example, f(x) might equal x² when x < 1 and 3x − 2 when x ≥ 1. Inside each piece, the function behaves like whatever family it comes from (polynomial, rational, trig, etc.), and per EK LIM-2.B.2, those standard function types are continuous everywhere on their domains. So the interesting math never happens inside a piece.

The interesting math happens at the seams, the boundary x-values where one rule hands off to the next. At those points you can't assume anything. The pieces might line up perfectly (continuous), line up but meet at a sharp corner (continuous but not differentiable), or miss each other entirely (a jump discontinuity). Almost every AP question about piecewise functions is really a question about what happens at a seam.

Why Piecewise function matters in AP Calculus

Piecewise functions are the testing ground for two of the biggest ideas in the first half of the course. In Topic 1.12 (Unit 1), learning objective 1.12.A asks you to determine the intervals where a function is continuous. For a piecewise function, that means confirming continuity inside each piece (usually automatic, thanks to EK LIM-2.B.1 and LIM-2.B.2) and then checking the boundary points by hand with the three-part continuity definition. In Topic 2.4 (Unit 2), learning objective 2.4.A asks you to explain the relationship between differentiability and continuity, and the classic counterexample is a piecewise-style function like f(x) = |x|, which is continuous at x = 0 but not differentiable there because the left and right limits of the difference quotient disagree. If the exam wants to test whether you actually understand limits, continuity, or derivatives at a point, a piecewise function is the natural delivery vehicle.

Keep studying AP Calculus Unit 2

How Piecewise function connects across the course

Continuous function (Unit 1)

Continuity at a seam requires the left-hand limit, right-hand limit, and the function value to all agree. A classic exam move is to put a parameter like k in one piece and ask which value of k forces the pieces to match up. You solve it by setting the one-sided limits equal.

Differentiability vs. continuity (Unit 2)

Matching the pieces' values makes a function continuous, but it can still have a corner where the slopes from each side disagree. f(x) = |x| at x = 0 is the textbook case. Differentiability is a stricter club than continuity, and piecewise functions are how the exam shows you the difference.

Step function (Unit 1)

A step function is a piecewise function where every piece is a constant, so it jumps at each boundary instead of connecting. It's the cleanest example of jump discontinuities, the failure mode piecewise functions make possible.

Closed Interval (Unit 1)

Each piece of a piecewise definition lives on an interval, and whether endpoints are included (≤ vs. <) decides which formula owns the boundary point. Reading those inequality signs carefully is half the battle on these problems.

Is Piecewise function on the AP Calculus exam?

Piecewise functions show up constantly in multiple-choice questions on continuity and differentiability. The most common stem gives you a piecewise function with an unknown constant and asks for the value that makes f continuous everywhere. For example, one piece might be (x² − 4)/(x − 2) for x ≠ 2 and kx + 3 at x = 2, and you find k by simplifying, taking the limit as x → 2, and setting it equal to the value of the other piece. Other stems ask you to classify what's happening at a boundary point (continuous? differentiable? neither?), sometimes with trickier functions like x²sin(1/x) that test whether you really use the limit definition instead of pattern-matching. The skill being tested is always the same. Check the three-part continuity condition at the seam, and if asked about differentiability, compare the one-sided limits of the difference quotient. Showing that limit work, not just plugging in, is what earns credit on free-response justifications too.

Piecewise function vs Discontinuous function

Piecewise does not mean discontinuous. A piecewise function can be perfectly continuous (even differentiable) everywhere if the pieces meet cleanly at every boundary. "Piecewise" describes how the function is written, while "discontinuous" describes how it behaves. You have to actually check the seams with limits before you can say which one you're dealing with.

Key things to remember about Piecewise function

  • A piecewise function uses a different formula on each interval of its domain, and the only points that need special attention are the boundaries where the pieces meet.

  • Inside each piece, standard functions like polynomials, rationals, and trig functions are automatically continuous on their domains (EK LIM-2.B.2), so save your limit work for the seams.

  • To confirm continuity at a boundary point, check that the left-hand limit, the right-hand limit, and the actual function value are all equal.

  • When a piece contains an unknown constant like k, set the one-sided limits at the seam equal to each other and solve for the constant.

  • A piecewise function can be continuous at a point but not differentiable there, like |x| at x = 0, where the pieces connect but the slopes from each side don't match.

  • Differentiability at a point guarantees continuity at that point, but continuity never guarantees differentiability.

Frequently asked questions about Piecewise function

What is a piecewise function in AP Calculus?

It's a function defined by different formulas on different intervals of the domain, like f(x) = x² for x < 1 and f(x) = 3x − 2 for x ≥ 1. AP Calc uses them mainly to test continuity (Topic 1.12) and differentiability (Topic 2.4) at the points where the pieces connect.

Are piecewise functions always discontinuous?

No. If the one-sided limits and the function value all match at every boundary point, the piecewise function is continuous everywhere. Discontinuity only happens when the pieces fail to line up, like in a step function.

How do I find the value of k that makes a piecewise function continuous?

Take the limit of each piece as x approaches the boundary point and set them equal to each other (and to the function's value there). For f(x) = (x² − 4)/(x − 2) when x ≠ 2, the limit as x → 2 is 4, so the other piece kx + 3 must also equal 4 at x = 2, giving k = 1/2.

What's the difference between a piecewise function being continuous and being differentiable?

Continuity means the pieces meet at the same value; differentiability means they also meet with the same slope. f(x) = |x| is continuous at x = 0 but not differentiable there because the difference quotient gives −1 from the left and +1 from the right.

Can a piecewise function be differentiable at the point where the pieces meet?

Yes, if the function is continuous there and the left and right limits of the difference quotient agree. The function f(x) = x²sin(1/x) for x ≠ 0 with f(0) = 0 is a famous example where the limit definition shows the derivative at 0 exists and equals 0.