← College Algebra

College Algebra

Piecewise Functions

Lesson

A piecewise function uses different rules on different intervals. The function is defined by a list of cases — each case has a rule and the values of xx it applies to. To evaluate, you first figure out which piece appliesto your input, then use that piece’s rule.

f(x)={2x+1,x<0x2,x0f(x) = \begin{cases} 2x + 1, & x < 0 \\ x^2, & x \geq 0 \end{cases}

Read this as: “f(x)f(x) equals 2x+12x + 1 when xx is negative, and equals x2x^2 when x0x \geq 0.”

To evaluate at a specific value:

  1. Compare the input to each interval.
  2. Pick the row whose interval contains the input.
  3. Apply that row’s rule.

Worked example 1

f(x)={2x+1,x<0x2,x0f(x) = \begin{cases} 2x + 1, & x < 0 \\ x^2, & x \geq 0 \end{cases}
f(3)=?f(3) = ?

Is 3<03 < 0? No. Is 303 \geq 0? Yes — use the second piece:

f(3)=32=9f(3) = 3^2 = 9

Worked example 2

f(x)={2x+1,x<0x2,x0f(x) = \begin{cases} 2x + 1, & x < 0 \\ x^2, & x \geq 0 \end{cases}
f(2)=?f(-2) = ?

Is 2<0-2 < 0? Yes — use the first piece:

f(2)=2(2)+1=3f(-2) = 2(-2) + 1 = -3

How to type your answer

Type a single number. Negatives use a minus sign; fractions use a slash. Examples: 9, -3, -1/2.

Practice

Work through these. Stuck? Click Get a hint.

Warm-Up

Quick problems to get going.

Problem 1

f(x)={2x+1,x<0x2,x0; f(3)=?f(x) = \begin{cases} 2x + 1, & x < 0 \\ x^2, & x \geq 0 \end{cases};\ f(3) = ?

Problem 2

f(x)={2x+1,x<0x2,x0; f(2)=?f(x) = \begin{cases} 2x + 1, & x < 0 \\ x^2, & x \geq 0 \end{cases};\ f(-2) = ?

Problem 3

f(x)={x+5,x23x1,x>2; f(0)=?f(x) = \begin{cases} x + 5, & x \leq 2 \\ 3x - 1, & x > 2 \end{cases};\ f(0) = ?

Problem 4

f(x)={x+5,x23x1,x>2; f(4)=?f(x) = \begin{cases} x + 5, & x \leq 2 \\ 3x - 1, & x > 2 \end{cases};\ f(4) = ?

Practice

Standard problems matching the lesson.

Problem 5

f(x)={x,x<32x4,x3; f(1)=?f(x) = \begin{cases} -x, & x < 3 \\ 2x - 4, & x \geq 3 \end{cases};\ f(1) = ?

Problem 6

f(x)={x,x<32x4,x3; f(5)=?f(x) = \begin{cases} -x, & x < 3 \\ 2x - 4, & x \geq 3 \end{cases};\ f(5) = ?

Problem 7

f(x)={x21,x1x+3,x>1; f(2)=?f(x) = \begin{cases} x^2 - 1, & x \leq -1 \\ x + 3, & x > -1 \end{cases};\ f(-2) = ?

Problem 8

f(x)={x21,x1x+3,x>1; f(0)=?f(x) = \begin{cases} x^2 - 1, & x \leq -1 \\ x + 3, & x > -1 \end{cases};\ f(0) = ?

Problem 9

f(x)={x2+1,x<22x1,x2; f(2)=?f(x) = \begin{cases} x^2 + 1, & x < 2 \\ 2x - 1, & x \geq 2 \end{cases};\ f(2) = ?

Problem 10

f(x)={x2+1,x<22x1,x2; f(1)=?f(x) = \begin{cases} x^2 + 1, & x < 2 \\ 2x - 1, & x \geq 2 \end{cases};\ f(-1) = ?

Problem 11

f(x)={2x,x<0x+1,0x35,x>3; f(2)=?f(x) = \begin{cases} 2x, & x < 0 \\ x + 1, & 0 \leq x \leq 3 \\ 5, & x > 3 \end{cases};\ f(-2) = ?

Problem 12

f(x)={2x,x<0x+1,0x35,x>3; f(7)=?f(x) = \begin{cases} 2x, & x < 0 \\ x + 1, & 0 \leq x \leq 3 \\ 5, & x > 3 \end{cases};\ f(7) = ?

Problem 13

f(x)={x,x<0x,x0; f(3)=?f(x) = \begin{cases} |x|, & x < 0 \\ \sqrt{x}, & x \geq 0 \end{cases};\ f(-3) = ?

Problem 14

f(x)={x,x<0x,x0; f(16)=?f(x) = \begin{cases} |x|, & x < 0 \\ \sqrt{x}, & x \geq 0 \end{cases};\ f(16) = ?

Challenge

Harder problems — edge cases, trickier numbers, multiple steps.

Problem 15

f(x)={x3,x<1x+2,x1; f(2)=?f(x) = \begin{cases} x^3, & x < 1 \\ -x + 2, & x \geq 1 \end{cases};\ f(-2) = ?

Problem 16

f(x)={x3,x<1x+2,x1; f(3)=?f(x) = \begin{cases} x^3, & x < 1 \\ -x + 2, & x \geq 1 \end{cases};\ f(3) = ?

Problem 17

f(x)={x+12,x1x23,1<x<24x,x2; f(0)=?f(x) = \begin{cases} \tfrac{x + 1}{2}, & x \leq -1 \\ x^2 - 3, & -1 < x < 2 \\ 4 - x, & x \geq 2 \end{cases};\ f(0) = ?

Problem 18

f(x)={x+12,x1x23,1<x<24x,x2; f(5)=?f(x) = \begin{cases} \tfrac{x + 1}{2}, & x \leq -1 \\ x^2 - 3, & -1 < x < 2 \\ 4 - x, & x \geq 2 \end{cases};\ f(5) = ?

Problem 19

f(x)={2x1,x<1x2+1,1x13x,x>1; f(1)=?f(x) = \begin{cases} -2x - 1, & x < -1 \\ x^2 + 1, & -1 \leq x \leq 1 \\ 3x, & x > 1 \end{cases};\ f(-1) = ?

Problem 20

f(x)={2x1,x<1x2+1,1x13x,x>1; f(3)=?f(x) = \begin{cases} -2x - 1, & x < -1 \\ x^2 + 1, & -1 \leq x \leq 1 \\ 3x, & x > 1 \end{cases};\ f(-3) = ?

Problem 21

f(x)={1x,x<0x22x,x0; f(2)=?f(x) = \begin{cases} \tfrac{1}{x}, & x < 0 \\ x^2 - 2x, & x \geq 0 \end{cases};\ f(-2) = ?

Problem 22

f(x)={1x,x<0x22x,x0; f(3)=?f(x) = \begin{cases} \tfrac{1}{x}, & x < 0 \\ x^2 - 2x, & x \geq 0 \end{cases};\ f(3) = ?