MISSION · Algebra

Piecewise Functions

One function, different rules in different places

Explorer level
Grades 10-12
Quest time
6 minutes
Mission skill
Reading and evaluating a function defined in sections

LEVEL 1 · EXPLORE

Make the idea move

Change the controls and watch what happens. Follow your curiosity and see what you notice.

Loading the activity…

LEVEL 2 · LEARN

Unlock the explanation

Open the chapters in any order. Try the examples as you go.

The idea in one sentence

A piecewise function uses different formulas on different parts of its domain — and real life is full of them.

The notation

\[f(x) = \begin{cases} 2x + 1 & x < 0 \\ x^2 & 0 \le x \le 3 \\ 9 & x > 3 \end{cases}\]

To evaluate, first decide which condition the input satisfies, then use that line and only that line.

\(f(-2)\): negative, so the first rule. \(2(-2) + 1 = -3\). \(f(2)\): between 0 and 3, so the second. \(4\). \(f(10)\): above 3, so the third. \(9\).

The conditions must not overlap — otherwise one input gets two outputs and it isn’t a function — and between them they should cover everything you intend the function to accept.

Where they come from

Piecewise definitions are the normal way to describe rules that change at a threshold.

  • Tax bands. Nothing on the first slice, one rate on the next, a higher rate above that.
  • Postage. One price up to 100 g, another beyond it.
  • Parking. £2 for the first hour, £1.50 for each hour after.
  • Overtime. Standard pay up to 40 hours, one and a half times beyond.

Each of these is a single function of one variable that simply switches formula partway.

Continuity at the joins

At each boundary the pieces either meet or they don’t.

In the example above, at \(x = 0\) the left piece approaches \(2(0) + 1 = 1\) while the right piece gives \(0^2 = 0\). Different values, so the graph jumps — a discontinuity.

At \(x = 3\), the second piece gives \(9\) and the third gives \(9\). They agree, so the graph joins smoothly there.

That’s how a piecewise function is checked: evaluate both pieces at each boundary and see whether they match. A step function is the extreme case, jumping at every boundary and flat in between — postage costs behave exactly like this, which is why a parcel one gram over a limit costs a whole band more.

The familiar one in disguise

$$ x $$ is piecewise:
\[|x| = \begin{cases} -x & x < 0 \\ x & x \ge 0 \end{cases}\]

Negative inputs get their sign flipped; the rest pass through. The V shape comes from two straight pieces meeting at the origin, and its sharp corner is why absolute value is continuous everywhere but has no single slope at zero.

Common mix-ups

  • Using the wrong piece. Check the condition before touching the formula.
  • Overlapping conditions, which break the definition of a function.
  • Assuming the pieces join. Test both sides of every boundary.
  • Plotting the whole of each formula. Each piece is drawn only on its own interval.

Check yourself

For the function above, find \(f(0)\) and \(f(3)\), and say where the graph jumps.

\(f(0) = 0\), since \(0 \le x \le 3\) takes the second rule. \(f(3) = 9\). The jump is at \(x = 0\), where the left piece heads for 1 but the value is 0.

LEVEL 3 · REFLECT

Add this quest to your trail

When you feel ready, mark this idea as explored. You can always come back and try it again.

EXPLORER STRATEGIES

More ways to see it

Loading shared methods…
Share how you learned it