Resources For Teachers For Tutors For Students & Parents Pricing
Algebra Other functions

Piecewise functions

20 practice questions 2 video lessons Theory + worked examples
Practice 20 questions
Practice questions

Every question with a fully worked solution.

Start practising
Watch 2 video(s)
  • Graphing Piecewise Functions - Precalculus Watch
  • Piecewise Functions Watch
Create a free accountTrack your progress and save your work as you go.
Create free account

Theory

A piecewise function uses different rules on different parts of its domain:

\[f(x)=\begin{cases}\text{rule 1},&\text{condition 1}\\\text{rule 2},&\text{condition 2}\end{cases}\]
  • Evaluate using the piece whose condition holds.
  • Closed dot includes an endpoint; open dot excludes it.
Each input uses exactly one piece.
A piecewise function Each rule of a piecewise function applies on its own interval, with open or closed endpoints. x y x+3 xΒ²
Two rules meet at \(x=0\) with open/closed dots.
Piecewise function Piecewise function Piecewise function different rule on each interval closed dot: included, open dot: excluded evaluate: pick the matching piece
Reading a piecewise function.

The structure:

\[f(x)=\begin{cases}g(x),&x<c\\h(x),&x\ge c\end{cases}\]
a piecewise function uses one rule below c and another at or above c
Match the input to its condition before evaluating.

How to use a piecewise function

  1. Read each rule and its condition.
  2. Find which condition the input meets.
  3. Apply only that rule.
  4. Watch open vs closed endpoints.
Example 1 β€” Evaluate a piece
For \(f(x)=\begin{cases}x+1,&x<0\\x^2,&x\ge0\end{cases}\), find \(f(-2)\).
Solution

\(-2<0\), so use \(x+1\).

\(f(-2)\)\(=\)\(-2+1=-1\)
f of negative 2 is negative 1
Example 2 β€” The other piece
Using the same \(f\), find \(f(3)\).
Solution

\(3\ge0\), so use \(x^2\).

\(f(3)\)\(=\)\(9\)
f of 3 is 9
Example 3 β€” At the boundary
Find \(f(0)\) for the same function.
Solution

\(0\ge0\), so use \(x^2\).

\(f(0)\)\(=\)\(0\)
f of 0 is 0
Example 4 β€” Which piece?
Which rule gives \(f(-0.5)\)?
Solution

\(-0.5<0\), so the first piece \(x+1\).

\(f(-0.5)\)\(=\)\(0.5\)
the first piece, giving 0.5

Common pitfalls

Use the piece whose condition holds, not the first one.
Check the boundary (\(<\) vs \(\le\)).
Open vs closed dots show which piece owns the endpoint.

Frequently asked questions

What is a piecewise function?

A function with different rules on different intervals.

How do you evaluate one?

Use the piece whose condition the input satisfies.

What do open and closed dots mean?

Closed includes the endpoint; open excludes it.

Can two pieces apply to one input?

No β€” the conditions don't overlap.