Piecewise Functions

Evaluate and graph functions defined by different rules on different intervals.

advancedalgebrafunctionspiecewisegraphinghigh-schoolUpdated 2026-02-01

What is a Piecewise Function?

Piecewise function: Function defined by different formulas on different parts of its domain

Written with curly brace notation

Example:

f(x) = { 2x + 1,  if x < 0
       { x²,      if x ≥ 0

Meaning: Use 2x + 1 when x is negative, use x² when x is non-negative

Reading Piecewise Functions

Each piece has:

  • A formula
  • A condition (domain restriction)

Example: Simple Piecewise

f(x) = { 3,      if x < 2
       { x + 1,  if x ≥ 2

For x < 2: Output is always 3 For x 2: Output is x + 1

Evaluating Piecewise Functions

Steps:

  1. Determine which piece applies (check condition)
  2. Use that formula
  3. Substitute and calculate

Example 1: Evaluate Multiple Values

f(x) = { x + 5,  if x < 0
       { 2x,     if x ≥ 0

Find f(-3):

  • Check: -3 < 0 ✓ (use first piece)
  • f(-3) = -3 + 5 = 2

Find f(0):

  • Check: 0 ≥ 0 ✓ (use second piece)
  • f(0) = 2(0) = 0

Find f(4):

  • Check: 4 ≥ 0 ✓ (use second piece)
  • f(4) = 2(4) = 8

Example 2: Three Pieces

g(x) = { -x,      if x < -1
       { 1,       if -1 ≤ x ≤ 1
       { x²,      if x > 1

Find g(-5):

  • Check: -5 < -1 ✓ (first piece)
  • g(-5) = -(-5) = 5

Find g(0):

  • Check: -1 ≤ 0 ≤ 1 ✓ (second piece)
  • g(0) = 1

Find g(3):

  • Check: 3 > 1 ✓ (third piece)
  • g(3) = 3² = 9

Graphing Piecewise Functions

Graph each piece separately on its domain

Use:

  • Open circle (○) if endpoint not included (< or >)
  • Closed circle (●) if endpoint included (≤ or ≥)

Example 1: Graph Two Pieces

f(x) = { 2x + 1,  if x < 1
       { 4,       if x ≥ 1

First piece (x < 1):

  • Line y = 2x + 1
  • Draw only for x < 1
  • At x = 1: y = 2(1) + 1 = 3, open circle at (1, 3)

Second piece (x 1):

  • Horizontal line y = 4
  • Draw only for x ≥ 1
  • At x = 1: y = 4, closed circle at (1, 4)

Result: Line increasing to open circle, then horizontal line from closed circle

Example 2: Continuous Piecewise

f(x) = { x²,      if x ≤ 0
       { x,       if x > 0

First piece: Parabola for x ≤ 0, closed circle at (0, 0) Second piece: Line y = x for x > 0, open circle at (0, 0)

Note: Open and closed circle at same point → function continuous at x = 0

Absolute Value as Piecewise

Absolute value can be written piecewise:

|x| = { -x,  if x < 0
      { x,   if x ≥ 0

Example: Absolute Value Function

f(x) = |x - 2| = { -(x - 2) = -x + 2,  if x < 2
                 { x - 2,               if x ≥ 2

Simplified:

f(x) = { -x + 2,  if x < 2
       { x - 2,   if x ≥ 2

Graph: V-shape with vertex at (2, 0)

Step Functions

Step function: Piecewise with constant values (horizontal segments)

Example: Parking Fees

Cost(h) = { 5,   if 0 < h ≤ 1
          { 8,   if 1 < h ≤ 2
          { 11,  if 2 < h ≤ 3

Graph: Horizontal steps at different heights

Use: Closed circle at right endpoint, open at left

Finding Domain and Range

Domain: All x-values covered by pieces

Range: All y-values from graphing all pieces

Example: Find Domain and Range

f(x) = { x + 3,  if x < 0
       { 2,      if 0 ≤ x < 3
       { -x,     if x ≥ 3

Domain: All real numbers (pieces cover all x)

Range:

  • First piece (x < 0): y < 3
  • Second piece: y = 2
  • Third piece (x ≥ 3): y ≤ -3

Combined range: y ≤ -3 or y = 2 or y < 3 Simplified: All real numbers

Continuity

Continuous: Graph has no breaks or jumps

Check at boundaries:

  • Evaluate limit from left
  • Evaluate limit from right
  • If equal, continuous; if not, discontinuous

Example: Check Continuity at x = 2

f(x) = { x²,      if x < 2
       { 2x,      if x ≥ 2

From left (x → 2⁻): f(x) → 2² = 4 From right (x → 2⁺): f(x) = 2(2) = 4

Both equal 4: Continuous at x = 2

Writing Piecewise Functions

From description or graph

Example 1: From Words

"Function is x² for x < 0 and 3x for x ≥ 0"

Write:

f(x) = { x²,   if x < 0
       { 3x,   if x ≥ 0

Example 2: From Graph Description

"Horizontal line at y = -1 for x < 3, then line y = x - 4 for x ≥ 3"

Write:

f(x) = { -1,     if x < 3
       { x - 4,  if x ≥ 3

Real-World Applications

Tax brackets: Different rates for income ranges

Shipping costs: Price tiers by weight

Utility bills: Different rates for usage levels

Overtime pay: Standard vs. overtime hourly rates

Example: Tax Function

Tax rate: 10% on first $10,000, 15% on amount over $10,000

Tax(x) = { 0.10x,                    if 0 ≤ x ≤ 10000
         { 1000 + 0.15(x - 10000),   if x > 10000

Find tax on $15,000:

  • Use second piece: 1000 + 0.15(15000 - 10000)
  • = 1000 + 0.15(5000)
  • = 1000 + 750 = $1,750

Example: Cell Phone Plan

$50 for up to 5 GB, then $10 per extra GB

Cost(g) = { 50,              if 0 ≤ g ≤ 5
          { 50 + 10(g - 5),  if g > 5

If use 7 GB:

  • Cost(7) = 50 + 10(7 - 5) = 50 + 20 = $70

Solving Piecewise Equations

Set each piece equal to value, check if solution in domain

Example: Solve f(x) = 5

f(x) = { 2x,      if x < 3
       { x + 4,   if x ≥ 3

First piece: 2x = 5 → x = 2.5

  • Check: 2.5 < 3 ✓ (valid)

Second piece: x + 4 = 5 → x = 1

  • Check: 1 ≥ 3 ✗ (not valid, discard)

Answer: x = 2.5

Practice

Evaluate f(2) for f(x) = {x + 3 if x < 2; x² if x ≥ 2}

For f(x) = {-x if x < 0; 2 if 0 ≤ x < 5; x if x ≥ 5}, find f(-3)

What type of circle at x = 1 for the piece 'if x < 1'?

Parking: $3 for 0-1 hr, $7 for 1-3 hr. Cost for 2 hours?