All lessons
⋏⊻

Piecewise Functions

Different rules on different intervals — one graph, many pieces.

Interactive graph

Interactive Lab
Drag corner to resize ↘

Drag the sliders in the Desmos graph. Watch how each parameter reshapes the curve in real time.

Concepts

Building a Piecewise

VisualEach piece is its own function — but only on a specific x-interval. Open dots mean 'not included'; closed dots mean 'included'.

Algebraf(x)={rule1condition1rule2condition2f(x) = \begin{cases} \text{rule}_1 & \text{condition}_1 \\ \text{rule}_2 & \text{condition}_2 \end{cases}

f(x)={x+2x<0x20≤x≤24x>2f(x) = \begin{cases} x+2 & x<0 \\ x^2 & 0\le x\le 2 \\ 4 & x>2 \end{cases}

Continuity at the Joints

VisualAt every boundary, check: do the pieces meet? A jump = discontinuity.

AlgebraFor continuity at x=cx=c: lim⁡x→c−f(x)=lim⁡x→c+f(x)=f(c)\lim_{x\to c^-} f(x) = \lim_{x\to c^+} f(x) = f(c).

Evaluating

VisualFind which interval the input falls into, then use that piece's rule.

AlgebraTo find f(1)f(1) in the example: 1∈[0,2]1 \in [0,2], so f(1)=12=1f(1) = 1^2 = 1.

Key formulas

Piecewise notation
f(x)={…………f(x)=\begin{cases} \dots & \dots \\ \dots & \dots \end{cases}
Rule per interval
Continuity check
lim⁡x→c−f=lim⁡x→c+f=f(c)\lim_{x\to c^-} f = \lim_{x\to c^+} f = f(c)
At each boundary

Finished reading?

Mark this lesson complete to update your mastery.

Quick practice

Full practice
easypiecewise
Evaluate f(2)f(2) for f(x)={x+1x<2x2x≥2f(x)=\begin{cases} x+1 & x<2 \\ x^2 & x \ge 2 \end{cases}.
easypiecewise
Evaluate f(−3)f(-3) for f(x)={2xx<05x≥0f(x)=\begin{cases} 2x & x<0 \\ 5 & x \ge 0 \end{cases}.
mediumpiecewise
For f(x)={x+2x<13x≥1f(x)=\begin{cases} x+2 & x<1 \\ 3 & x \ge 1 \end{cases}, is ff continuous at x=1x=1?
mediumpiecewise
For f(x)={x2x<0−xx≥0f(x)=\begin{cases} x^2 & x<0 \\ -x & x \ge 0 \end{cases}, find f(0)f(0) and the left-hand limit as x→0−x \to 0^-.
hardpiecewise
Write a piecewise function for the absolute value f(x)=∣2x−6∣f(x)=|2x-6|.