Skip to content
🎯⭐ INTERACTIVE LESSON

Piecewise Functions

Learn step-by-step with interactive practice!

Piecewise Functions - Complete Interactive Lesson

Part 1: Reading the Notation

🧩 Piecewise Functions

Part 1 of 5 — Reading the Notation


Topics in This Part

Section
What Is a Piecewise Function?
The Big Curly Brace
Choosing the Right Piece

🔑 Key Concept: A piecewise function is one function built from several rules — each rule applies only on its own stretch of the number line. The whole game is figuring out which rule to use for which input.

What Is a Piecewise Function?

Most functions you've met use a single formula for every input — like f(x)=2x+1f(x) = 2x + 1. A piecewise function uses different formulas on different intervals.

Think of a parking garage:

  • The first hour costs a flat $5.
  • After that it's $2 per additional hour.

That's two rules glued together. Mathematically we stack them under a single curly brace:

f(x)={50≤x≤15+2(x−1)x>1f(x) = \begin{cases} 5 & 0 \le x \le 1 \\ 5 + 2(x - 1) & x > 1 \end{cases}

Each line is a piece: a formula on the left and the interval where it applies on the right.

💡 The function still passes the vertical line test — for any single input xx, exactly one piece gives the output. The intervals are designed so they never overlap.

The Anatomy of the Notation

Read a piecewise function right-to-left: first check the condition, then use the matching formula.

f(x)={x2x<0x+1x≥0f(x) = \begin{cases} x^2 & x < 0 \\ x + 1 & x \ge 0 \end{cases}

To find...Ask: which interval is xx in?Then use...
f(−3)f(-3)−3<0-3 < 0 ✓x2=(−3)2=9x^2 = (-3)^2 = 9
f(0)f(0)0≥00 \ge 0 ✓x+1=0+1=1x + 1 = 0 + 1 = 1
f(4)f(4)4≥04 \ge 0 ✓x+1=4+1=5x + 1 = 4 + 1 = 5

⚠️ Don't plug a number into every formula. A piecewise function gives you a menu of formulas; you pick the one whose condition your input satisfies, and ignore the rest.

Concept Check 🎯

Match Input to Piece 🔽

Use f(x)={x2x<0x+1x≥0f(x) = \begin{cases} x^2 & x < 0 \\ x + 1 & x \ge 0 \end{cases}. For each input, choose the formula you'd use.

From "Which Piece" to "What Value"

Choosing the right piece is half the job. The other half is just plugging in — substitute your input into that one formula and simplify.

g(x)={x2x<02x+3x≥0g(x) = \begin{cases} x^2 & x < 0 \\ 2x + 3 & x \ge 0 \end{cases}

To find g(−2)g(-2): since −2<0-2 < 0, use x2⇒g(−2)=(−2)2=4x^2 \Rightarrow g(-2) = (-2)^2 = 4.

💡 Slow down on the sign of the input. A negative input squared becomes positive, but a negative input in 2x+32x+3 stays negative until you add. Substitution mistakes — not piece-selection mistakes — are where most lost points actually come from.

Pick the Piece, Then Evaluate 🧮

Use g(x)={x2x<02x+3x≥0g(x) = \begin{cases} x^2 & x < 0 \\ 2x + 3 & x \ge 0 \end{cases}

1) g(−4)= ?g(-4) = \,? 2) g(0)= ?g(0) = \,? 3) g(6)= ?g(6) = \,?

Recap

To work with any piecewise function:

  1. Read the conditions on the right of each piece.
  2. Locate your input xx on the number line — find the interval it belongs to.
  3. Use only that piece's formula.

You've got the reading skill down. In Part 2 we zoom in on the trickiest spot: the boundary point where two intervals meet, and what those <<, ≤\le, >>, ≥\ge symbols really decide.

Part 2: Boundary Points & Evaluating Carefully

🧩 Piecewise Functions

Part 2 of 5 — Boundary Points & Evaluating Carefully


🔑 The Idea: Two pieces meet at a boundary. The inequality symbol (<< vs ≤\le) decides which piece owns that exact boundary value. Getting this right is the #1 skill for evaluating and graphing piecewise functions.

Who Owns the Boundary?

Look at where the intervals "touch":

f(x)={x+1x≤32x−2x>3f(x) = \begin{cases} x + 1 & x \le 3 \\ 2x - 2 & x > 3 \end{cases}

The boundary is x=3x = 3. Which piece claims it?

  • The first piece says x≤3x \le 3. The ≤\le includes 33. ✓
  • The second piece says x>3x > 3. The strict >> excludes 33.

So f(3)f(3) uses the first piece: f(3)=3+1=4f(3) = 3 + 1 = 4.

🔑 Rule of thumb: The piece with the "or-equal-to" symbol (≤\le or ≥\ge) is the one that owns the boundary. A well-defined piecewise function gives exactly one piece the equality at each boundary.

Read the Inequalities 🔽

Use f(x)={x+1x≤32x−2x>3f(x) = \begin{cases} x + 1 & x \le 3 \\ 2x - 2 & x > 3 \end{cases}

Functions With Three (or More) Pieces

The same logic scales. Just walk the number line from left to right and find the one interval your input lives in.

h(x)={−xx<−11−1≤x≤1x2x>1h(x) = \begin{cases} -x & x < -1 \\ 1 & -1 \le x \le 1 \\ x^2 & x > 1 \end{cases}

InputInterval testOutput
h(−4)h(-4)−4<−1-4 < -1 ✓−(−4)=4-(-4) = 4
h(−1)h(-1)−1≤−1≤1-1 \le -1 \le 1 ✓11 (the middle piece)
h(0)h(0)−1≤0≤1-1 \le 0 \le 1 ✓11
h(3)h(3)3>13 > 1 ✓32=93^2 = 9

💡 The middle piece here is a constant, 11. Constant pieces are perfectly legal — the function just flat-lines across that interval.

Concept Check 🎯

Mind the Boundary 🧮

Use f(x)={4−xx<13x1≤x<4x2−10x≥4f(x) = \begin{cases} 4 - x & x < 1 \\ 3x & 1 \le x < 4 \\ x^2 - 10 & x \ge 4 \end{cases}

1) f(0)= ?f(0) = \,? 2) f(1)= ?f(1) = \,? 3) f(4)= ?f(4) = \,?

Part 3: Graphing Piecewise Functions

🧩 Piecewise Functions

Part 3 of 5 — Graphing Piecewise Functions


🔑 Big Payoff: A piecewise graph is just each piece's graph, trimmed to its own interval. The only new skill is marking endpoints correctly: a closed dot ● for "included," an open dot ○ for "excluded."

Open vs. Closed Endpoints

At every boundary, the inequality tells you the dot:

Symbol at the boundaryEndpoint dotMeaning
≤\le or ≥\ge● closed (filled)the point is on the graph
<< or >>○ open (hollow)the point is not on the graph

Example

f(x)={x+1x≤25x>2f(x) = \begin{cases} x + 1 & x \le 2 \\ 5 & x > 2 \end{cases}

  • The first piece, y=x+1y = x+1, runs up to x=2x = 2. Since x≤2x \le 2, put a closed dot ● at its right end: (2, 3)(2,\, 3) because 2+1=32 + 1 = 3.
  • The second piece, y=5y = 5, starts just after x=2x = 2. Since x>2x > 2, put an open dot ○ at (2, 5)(2,\, 5).

💡 At a boundary you often draw two dots stacked vertically — one closed, one open — because the two pieces disagree about the height there. That vertical gap is called a jump.

Concept Check 🎯

Reading Domain & Range From the Graph

Once a piecewise function is graphed, the domain is the set of xx-values it covers, and the range is the set of yy-values it reaches.

Example

f(x)={−2−4≤x<0x0≤x≤3f(x) = \begin{cases} -2 & -4 \le x < 0 \\ x & 0 \le x \le 3 \end{cases}

  • Domain: the pieces cover −4≤x<0-4 \le x < 0 joined with 0≤x≤30 \le x \le 3, which together fill −4≤x≤3-4 \le x \le 3. In interval notation: [−4, 3][-4,\, 3].
  • Range: the first piece is the single value y=−2y = -2. The second piece, y=xy = x for 0≤x≤30 \le x \le 3, sweeps from 00 up to 33. So the outputs are {−2}\{-2\} together with [0,3][0, 3].

⚠️ Don't assume the domain is "all real numbers." Piecewise functions are often defined only on a limited set of intervals — read the conditions to find where the function actually lives.

Endpoints & Domain 🔽

Use f(x)={−2−4≤x<0x0≤x≤3f(x) = \begin{cases} -2 & -4 \le x < 0 \\ x & 0 \le x \le 3 \end{cases}

Plot the Endpoints 🧮

Use f(x)={x+4x<−1x2x≥−1f(x) = \begin{cases} x + 4 & x < -1 \\ x^2 & x \ge -1 \end{cases}. Find the yy-coordinate of each endpoint at the boundary x=−1x = -1.

1) Left piece's endpoint height: ff-value from x+4x + 4 at x=−1x = -1 is  ?\,? (this dot is open ○) 2) Right piece's endpoint height: ff-value from x2x^2 at x=−1x = -1 is  ?\,? (this dot is closed ●) 3) The size of the jump (closed height minus open height) is  ?\,?

Part 4: Absolute Value, Step Functions & Continuity

🧩 Piecewise Functions

Part 4 of 5 — Absolute Value, Step Functions & Continuity


🔑 The Reveal: Some "famous" functions are secretly piecewise. Absolute value is the classic example, and step functions model real costs. We'll also learn to spot whether a piecewise graph is continuous (no gaps) or has a jump.

Absolute Value Is Piecewise

The definition of absolute value is a piecewise rule:

∣x∣={−xx<0xx≥0|x| = \begin{cases} -x & x < 0 \\ x & x \ge 0 \end{cases}

When xx is negative, −x-x makes it positive; when xx is non-negative, you leave it alone. That's why the graph of y=∣x∣y = |x| is a V: a downward ray on the left, an upward ray on the right, meeting at the origin.

Rewriting a Shifted Absolute Value

y=∣x−3∣y = |x - 3| becomes y={−(x−3)x<3x−3x≥3={−x+3x<3x−3x≥3y = \begin{cases} -(x - 3) & x < 3 \\ x - 3 & x \ge 3 \end{cases} = \begin{cases} -x + 3 & x < 3 \\ x - 3 & x \ge 3 \end{cases}

The "corner" of the V sits where the inside equals zero: x−3=0⇒x=3x - 3 = 0 \Rightarrow x = 3.

💡 To convert ∣expression∣|expression| into pieces: find where the inside is 00 (that's the boundary), keep the expression as-is where it's ≥0\ge 0, and negate it where it's <0< 0.

Concept Check 🎯

Step Functions

A step function is piecewise-constant: it's flat on each interval and "jumps" to a new height at the boundaries, producing a staircase.

The most famous is the greatest integer (floor) function, ⌊x⌋\lfloor x \rfloor, which rounds down to the nearest integer:

⌊2.7⌋=2,⌊2⌋=2,⌊−1.3⌋=−2\lfloor 2.7 \rfloor = 2, \quad \lfloor 2 \rfloor = 2, \quad \lfloor -1.3 \rfloor = -2

xx⌊x⌋\lfloor x \rfloor
1.91.911
3.03.033
−0.5-0.5−1-1

⚠️ For negative inputs the floor goes more negative: ⌊−1.3⌋=−2\lfloor -1.3 \rfloor = -2, not −1-1, because −2-2 is the greatest integer that is still ≤−1.3\le -1.3.

Real-world steps: a parking meter charging by the started hour, or postage that jumps at each ounce — the price is constant within a band, then leaps at the edge.

Floor Function Practice 🧮

Evaluate the greatest-integer (floor) function ⌊x⌋\lfloor x \rfloor — round down to the nearest integer.

1) ⌊4.9⌋= ?\lfloor 4.9 \rfloor = \,? 2) ⌊7⌋= ?\lfloor 7 \rfloor = \,? 3) ⌊−2.1⌋= ?\lfloor -2.1 \rfloor = \,?

Continuous or a Jump?

A piecewise function is continuous at a boundary if the two pieces meet at the same height there — no gap, no jump. Test it by plugging the boundary into both neighboring formulas:

f(x)={x+1x≤23x−3x>2f(x) = \begin{cases} x + 1 & x \le 2 \\ 3x - 3 & x > 2 \end{cases}

  • Left piece at x=2x = 2: 2+1=32 + 1 = 3.
  • Right piece approaching x=2x = 2: 3(2)−3=33(2) - 3 = 3.

Both give 33, so the graph connects — it's continuous at x=2x = 2. ✓

Compare with f(x)={x+1x≤23xx>2f(x) = \begin{cases} x + 1 & x \le 2 \\ 3x & x > 2 \end{cases}: now the left gives 33 but the right approaches 3(2)=63(2) = 6. The heights differ, so there's a jump of 6−3=36 - 3 = 3.

🔑 Continuity test at a boundary x=ax=a: evaluate both pieces at aa. Equal heights ⇒ continuous. Different heights ⇒ jump (discontinuity).

Continuous or Jump? 🔽

Part 5: Applications & Mastery Check

🧩 Piecewise Functions

Part 5 of 5 — Applications & Mastery Check


You can now read the notation, evaluate carefully across boundaries, graph the pieces with correct dots, recognize absolute-value and step functions, and test for continuity. Let's apply it to the real world — then finish with an Exit Quiz.

Real-World Models: Tiered Pricing

Piecewise functions are everywhere money is involved: tax brackets, shipping, phone plans, and utility bills all change rate at thresholds.

Example: Cell-Phone Data

A plan charges a flat $30 for up to 22 GB, then $10 per extra GB beyond 22:

C(g)={300≤g≤230+10(g−2)g>2C(g) = \begin{cases} 30 & 0 \le g \le 2 \\ 30 + 10(g - 2) & g > 2 \end{cases}

Data used ggWhich pieceCost C(g)C(g)
1.51.5 GB0≤g≤20 \le g \le 2$30
22 GB0≤g≤20 \le g \le 2$30
55 GBg>2g > 230+10(5−2)=6030 + 10(5-2) = 60, i.e. $60

💡 Notice the model is continuous at g=2g = 2: the flat piece gives $30 and the second piece gives 30+10(0)=3030 + 10(0) = 30, i.e. $30. Good pricing models usually avoid surprise jumps right at the threshold.

Apply the Model 🧮

A ride-share charges a $4 base for the first 33 miles, then $2 per additional mile:

F(m)={40≤m≤34+2(m−3)m>3F(m) = \begin{cases} 4 & 0 \le m \le 3 \\ 4 + 2(m - 3) & m > 3 \end{cases}

1) Cost of a 22-mile ride: F(2)= ?F(2) = \,? (dollars) 2) Cost of a 33-mile ride: F(3)= ?F(3) = \,? (dollars) 3) Cost of an 88-mile ride: F(8)= ?F(8) = \,? (dollars)

Building a Piecewise Function From Words

Translating a scenario into notation is a top exam skill. Work in three steps:

  1. Identify the thresholds — the inputs where the rule changes (these become your boundaries).
  2. Write a formula for each interval — often a constant or a "base + rate × extra" expression.
  3. Attach the correct inequalities so every input lands in exactly one piece.

Example: Movie-Theater Tickets

"Kids (1212 and under) pay $6; everyone else pays $11."

The threshold is age 1212. Translating:

P(a)={6a≤1211a>12P(a) = \begin{cases} 6 & a \le 12 \\ 11 & a > 12 \end{cases}

The ≤\le on the first piece makes sure a 1212-year-old gets the kids' price, and the strict >> keeps 13+13+ at the adult price — no overlap, no gap.

Mixed Practice 🎯

Exit Quiz ✅

Answer all three to finish the lesson.