Resources For Teachers For Tutors For Students & Parents Pricing
Algebra 2 Other functions (advanced)

Piecewise functions (advanced)

20 practice questions 0 video lessons Theory + worked examples
Create a free accountTrack your progress and save your work as you go.
Create free account

Theory

A piecewise function is defined by 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 by choosing the piece whose condition holds.
  • Closed dot includes the endpoint; open dot excludes it.
Each \(x\) uses exactly one piece β€” the conditions cannot overlap.
A piecewise function Each rule of a piecewise function applies on its own interval, with open or closed endpoints at the break. x y x+3 xΒ²
Two rules meet at \(x=0\) with open/closed dots.
Piecewise functions Piecewise functions Piecewise functions different rule on each interval closed dot: value included open dot: value 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 satisfies.
  3. Apply that rule only.
  4. Watch endpoints: open vs closed.
Example 1 β€” Evaluate each piece
For \(f(x)=\begin{cases}x+1,&x<0\\x^2,&x\ge0\end{cases}\), find \(f(-2)\) and \(f(3)\).
Solution

Pick the piece matching each input.

\(f(-2)\)\(=\)\(-2+1=-1\)
\(f(3)\)\(=\)\(3^2=9\)
f of negative 2 is negative 1 and f of 3 is 9
Example 2 β€” At the boundary
Using the same \(f\), find \(f(0)\).
Solution

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

\(f(0)\)\(=\)\(0^2=0\)
f of 0 is 0, from the second piece
Example 3 β€” Absolute value as piecewise
Write \(|x|\) as a piecewise function.
Solution

Split at the point where the inside changes sign.

\(|x|\)\(=\)\(\begin{cases}x,&x\ge0\\-x,&x<0\end{cases}\)
absolute value of x is x when x is non-negative and negative x otherwise
Example 4 β€” Which piece?
For the function in Example 1, which rule gives \(f(-0.5)\)?
Solution

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

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

Common pitfalls

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

Frequently asked questions

What is a piecewise function?

A function defined by different rules on different intervals.

How do you evaluate a piecewise function?

Choose 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 the same x?

No β€” the conditions must not overlap.