Evaluate a piecewise function f(x) = {x² if x < 2; 3x-2 if x ≥ 2} at three different input values, applying the correct piece each time.

For f(x) = x² if x < 2; 3x - 2 if x ≥ 2: f(1): since 1 < 2, use x²: f(1) = 1² = 1. f(2): since 2 ≥ 2, use 3x - 2: f(2) = 3(2) - 2 = 4. f(3): since 3 ≥ 2, use 3x - 2: f(3) = 3(3) - 2 = 7.

Example

Choose the matching piece for each input, then evaluate.

highlighted = computed this step

Step 1 — Set up

Set up the expression.

f(x)={x2x<23x2x2f(x)=\begin{cases}x^{ 2 }&x< 2 \\ 3x - 2 &x\ge 2 \end{cases}

Step 2 — Use first piece

Since 1 is less than 2, use x squared: 1 squared is 1.

f(1)=12=1f( 1 )= 1 ^{ 2 }= \hl{1}

Step 3 — Use second piece at boundary

Since 2 is at least 2, use the linear piece; the value is 4.

f(2)=3(2)2=4f( 2 )= 3 ( 2 )- 2 = \hl{4}

Step 4 — Use second piece

Since 3 is at least 2, use the linear piece; the value is 7.

f(3)=3(3)2=7f( 3 )= 3 ( 3 )- 2 = \hl{7}
piecewise-functions A piecewise function uses different formulas on different parts of its domain. To evaluate, first determine which piece applies to the input value, then use that formula.