Skip to content
🎯⭐ INTERACTIVE LESSON

Piecewise Functions

Learn step-by-step with interactive practice!

Piecewise Functions - Complete Interactive Lesson

Part 1: Anatomy & Notation

🧩 Piecewise Functions

Part 1 of 7 — Anatomy & Notation


Topics in This Part

Section
What Is a Piecewise Function?
Reading the Brace Notation
Which Rule Applies Where

🔑 Key Concept: A piecewise function is one function defined by different rules on different parts of its domain. Think of it as a recipe with conditions: "if the input is over here, use this rule; if it's over there, use that rule."

What Is a Piecewise Function?

Most functions you've met use one rule for every input — like f(x)=2x+1f(x) = 2x + 1. A piecewise function switches rules depending on where xx lands.

A classic real-world example is a parking garage:

Input (xx = hours parked)Rule (cost)
First 2 hoursflat $5
After 2 hours$5 plus $3 per extra hour

The cost is still a function of hours — every input has exactly one output — but the formula you use depends on the input. That's the whole idea.

We collect the rules under a single brace:

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

💡 The function is still one function. The brace is just shorthand for "here are all my rules and the conditions that select them."

Reading the Brace Notation

Every row of a piecewise definition has two parts:

2x+1⏟the rulex<0⏟the condition (a piece of the domain)\underbrace{2x + 1}_{\text{the rule}} \qquad \underbrace{x < 0}_{\text{the condition (a piece of the domain)}}

To use the function, you ask one question: which condition does my input satisfy? That tells you which rule to apply.

For

f(x)={2x+1x<0x2x≥0f(x) = \begin{cases} 2x + 1 & x < 0 \\ x^2 & x \ge 0 \end{cases}
  • An input like x=−3x = -3 satisfies x<0x < 0, so use the top rule: 2(−3)+12(-3)+1.
  • An input like x=4x = 4 satisfies x≥0x \ge 0, so use the bottom rule: 424^2.

⚠️ The conditions must not overlap — every input belongs to exactly one piece. If two conditions claimed the same xx, you'd get two outputs, and it wouldn't be a function. Notice x<0x<0 and x≥0x\ge 0 together cover all real numbers with no overlap.

Concept Check 🎯

Mind the Boundary 🎯

Match Input to Rule 🔽

For f(x)={2x+1x<0x2x≥0f(x) = \begin{cases} 2x+1 & x<0 \\ x^2 & x\ge 0 \end{cases}, pick the rule each input triggers.

Recap

You now know how to read a piecewise function:

  1. Each row is a rule paired with a condition.
  2. To evaluate, find the one condition your input satisfies, then apply that row's rule.
  3. The conditions tile the domain — no gaps, no overlaps — and the boundary value belongs to whichever piece uses ≤\le or ≥\ge (the one with the "equals" line).

In Part 2 we put this into action: plugging numbers in carefully, especially right at the boundaries where mistakes love to hide.

Part 2: Evaluating Piecewise Functions

🧩 Piecewise Functions

Part 2 of 7 — Evaluating Piecewise Functions


🔑 The One-Step Method: To find f(a)f(a), ignore the rules at first. Ask only: which condition does aa satisfy? Then plug aa into that — and only that — rule.

Evaluating, Step by Step

Use this function throughout:

f(x)={−x−2x<−1x2−1≤x<26x≥2f(x) = \begin{cases} -x - 2 & x < -1 \\ x^2 & -1 \le x < 2 \\ 6 & x \ge 2 \end{cases}

Find f(−4)f(-4)

Step 1 — pick the piece. Is −4<−1-4 < -1? Yes. Use the top rule −x−2-x-2. Step 2 — substitute. f(−4)=−(−4)−2=4−2=2f(-4) = -(-4) - 2 = 4 - 2 = 2.

Find f(1)f(1)

Step 1 — pick the piece. Is −1≤1<2-1 \le 1 < 2? Yes. Use the middle rule x2x^2. Step 2 — substitute. f(1)=12=1f(1) = 1^2 = 1.

Find f(5)f(5)

Step 1 — pick the piece. Is 5≥25 \ge 2? Yes. Use the bottom rule, the constant 66. Step 2 — substitute. f(5)=6f(5) = 6.

💡 The bottom piece is a constant: f(x)=6f(x)=6 for every x≥2x \ge 2. The input doesn't appear in the rule, so the output never changes there.

The Boundary Is Where Points Are Lost

The danger zone is the boundary between pieces. Check the inequality signs carefully.

For the same ff, evaluate at the boundary x=−1x = -1:

f(x)={−x−2x<−1x2−1≤x<26x≥2f(x) = \begin{cases} -x - 2 & x < -1 \\ x^2 & -1 \le x < 2 \\ 6 & x \ge 2 \end{cases}
  • Top condition x<−1x < -1: is −1<−1-1 < -1? No (strict).
  • Middle condition −1≤x<2-1 \le x < 2: is −1≤−1-1 \le -1? Yes (the ≤\le includes −1-1).

So x=−1x=-1 belongs to the middle piece, and f(−1)=(−1)2=1f(-1) = (-1)^2 = 1.

⚠️ Don't grab the first rule whose number "looks close." Read the inequality: << and >> exclude the endpoint; ≤\le and ≥\ge include it.

Evaluate It 🧮

Use f(x)={−x−2x<−1x2−1≤x<26x≥2f(x) = \begin{cases} -x - 2 & x < -1 \\ x^2 & -1 \le x < 2 \\ 6 & x \ge 2 \end{cases}

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

Which Piece? 🔽

For f(x)={−x−2x<−1x2−1≤x<26x≥2f(x) = \begin{cases} -x - 2 & x < -1 \\ x^2 & -1 \le x < 2 \\ 6 & x \ge 2 \end{cases}, choose the piece each input uses.

Concept Check 🎯

Part 3: Graphing & Open/Closed Dots

🧩 Piecewise Functions

Part 3 of 7 — Graphing & Open/Closed Dots


🔑 The Plan: Graph each piece as if it were a normal function, but only draw it over its own interval. The open and closed dots at the boundaries tell the whole story of what happens at the edges.

How to Graph a Piecewise Function

For each piece:

  1. Graph the rule as usual (line, parabola, constant, etc.).
  2. Keep only the part over that piece's interval — erase everything outside it.
  3. Mark the endpoints:
    • ≤\le or ≥\ge (endpoint included) → a closed (filled) dot ●
    • << or >> (endpoint excluded) → an open (hollow) dot ○

The Endpoint Test

At a boundary x=cx = c, evaluate the rule on each side at cc:

  • The piece whose condition includes cc gets the closed dot (that's the actual function value).
  • The piece whose condition excludes cc gets an open dot.

💡 A vertical line at any xx should cross your graph exactly once (the vertical line test) — that's the visual version of "one output per input."

Worked Example

h(x)={x+3x<1−2x+6x≥1h(x) = \begin{cases} x + 3 & x < 1 \\ -2x + 6 & x \ge 1 \end{cases}

Left piece y=x+3y = x+3, drawn for x<1x<1. Plugging the boundary into this rule gives 1+3=41+3 = 4. Since x<1x<1 excludes 11, put an open dot ○ at (1,4)(1, 4).

Right piece y=−2x+6y=-2x+6, drawn for x≥1x \ge 1. At x=1x=1, y=−2(1)+6=4y = -2(1)+6 = 4. Since x≥1x\ge 1 includes 11, put a closed dot ● at (1,4)(1, 4).

Here both dots land at (1,4)(1,4) — the open one is "filled in" by the closed one, so the two pieces meet and the graph has no gap.

At x=1x = 1Left rule x+3x+3Right rule −2x+6-2x+6
Value44 (open ○)44 (closed ●)

⚠️ Always plug the boundary into both rules. If the two values differ, the graph jumps there, leaving a visible gap.

Concept Check 🎯

Find the Endpoints 🧮

For h(x)={x+3x<1−2x+6x≥1h(x) = \begin{cases} x+3 & x<1 \\ -2x+6 & x\ge 1 \end{cases}, the boundary is x=1x = 1.

1) Plug x=1x=1 into the left rule x+3x+3: the open dot is at height y= ?y = \,? 2) Plug x=1x=1 into the right rule −2x+6-2x+6: the closed dot is at height y= ?y = \,? 3) The yy-intercept of the graph is h(0)= ?h(0) = \,? (use the correct piece)

When the Graph Jumps

Not every piecewise graph connects. Consider:

j(x)={x+1x<2x−3x≥2j(x) = \begin{cases} x + 1 & x < 2 \\ x - 3 & x \ge 2 \end{cases}

At the boundary x=2x = 2:

  • Left rule: 2+1=32 + 1 = 3 → open dot ○ at (2,3)(2, 3).
  • Right rule: 2−3=−12 - 3 = -1 → closed dot ● at (2,−1)(2, -1).

The two endpoints are at different heights (33 vs. −1-1), so the graph jumps down by 44 at x=2x=2. There's a visible break — a hole at (2,3)(2,3) and a solid point at (2,−1)(2,-1).

💡 A jump is perfectly legal: it's still a function (one output per input — j(2)=−1j(2)=-1, the closed dot). The two pieces simply don't meet at x=2x = 2.

Dots at the Jump 🔽

For j(x)={x+1x<2x−3x≥2j(x) = \begin{cases} x+1 & x<2 \\ x-3 & x\ge 2 \end{cases}, describe the endpoints at x=2x=2.

Part 4: Building Piecewise Models

🧩 Piecewise Functions

Part 4 of 7 — Building Piecewise Models


🔑 Why piecewise? A piecewise-defined function is a set of functions defined over non-overlapping intervals of the domain. It is the right model when a data set or a real situation behaves differently on different intervals: a flat fee and then a per-unit charge, a tank that fills and then drains, a speed that changes partway through a trip.

From Words to a Piecewise Rule

Scenario: A phone plan costs $30 per month and includes up to 55 GB of data. Each GB over 55 costs $10.

Step 1 — Find the intervals. The rule changes at g=5g = 5 GB. "Up to 55 GB" includes 55, so the first interval is 0≤g≤50 \le g \le 5 and the second is g>5g > 5.

Step 2 — Write a rule for each interval.

  • For 0≤g≤50 \le g \le 5: the cost is the flat $30.
  • For g>5g > 5: $30 plus $10 for each GB over 55, which is 30+10(g−5)30 + 10(g - 5).
C(g)={300≤g≤530+10(g−5)g>5C(g) = \begin{cases} 30 & 0 \le g \le 5 \\ 30 + 10(g - 5) & g > 5 \end{cases}

Step 3 — Check. Using 88 GB is 33 GB over, so C(8)=30+10(3)=60C(8) = 30 + 10(3) = 60, or $60.

Boundary Words → Inequality Signs

WordingSignBoundary value is…
"at most", "up to and including", "no more than"≤\leincluded
"less than", "under", "below"<<excluded
"at least", "or more"≥\geincluded
"more than", "over", "above">>excluded

⚠️ Writing (g−5)(g - 5) instead of gg matters: the $10 charge applies only to the GB beyond the threshold.

Concept Check 🎯

From Data to a Piecewise Model

A tank's volume V(t)V(t), in liters, is recorded every 55 minutes:

tt (min)0055101015152020
V(t)V(t)5050150150250250210210170170

The data change behavior at t=10t = 10: the volume rises 100100 liters every 55 minutes, then falls 4040 liters every 55 minutes. Model each interval separately.

Piece 1, 0≤t≤100 \le t \le 10: rate 1005=20\frac{100}{5} = 20 L/min, starting at 5050: V=50+20tV = 50 + 20t.

Piece 2, 10<t≤2010 < t \le 20: rate −405=−8\frac{-40}{5} = -8 L/min, starting from 250250 at t=10t = 10: V=250−8(t−10)V = 250 - 8(t - 10).

V(t)={50+20t0≤t≤10250−8(t−10)10<t≤20V(t) = \begin{cases} 50 + 20t & 0 \le t \le 10 \\ 250 - 8(t - 10) & 10 < t \le 20 \end{cases}

Assumptions and Restrictions

  • Domain from context: the data cover 0≤t≤200 \le t \le 20, so the model is restricted to that interval.
  • Agreement at the switch: a tank's volume cannot change instantly, so both rules should give 250250 at t=10t = 10. They do: 50+20(10)=25050 + 20(10) = 250.
  • Other function types: a piece does not have to be linear. Each piece can be built with whatever technique fits its interval: a line, a quadratic, a constant, or a regression.

Use the Tank Model 🧮

V(t)={50+20t0≤t≤10250−8(t−10)10<t≤20V(t) = \begin{cases} 50 + 20t & 0 \le t \le 10 \\ 250 - 8(t - 10) & 10 < t \le 20 \end{cases}

1) V(4)= ?V(4) = \,? 2) V(16)= ?V(16) = \,? 3) The rate of change of VV on the second piece, in L/min:

Words to Conditions 🔽

Turn each phrase into the condition for its piece.

Part 5: Domain & Range

🧩 Piecewise Functions

Part 5 of 7 — Domain & Range


🔑 Domain = all valid inputs; Range = all possible outputs. For piecewise functions, you find each by examining the pieces together, paying special attention to the boundaries and which dots are open vs. closed.

Finding the Domain

The domain is every xx for which some piece is defined. Just take the union of all the condition-intervals.

f(x)={x0≤x≤4x−2x>4f(x) = \begin{cases} \sqrt{x} & 0 \le x \le 4 \\ x - 2 & x > 4 \end{cases}
  • Piece 1 covers [0,4][0, 4].
  • Piece 2 covers (4,∞)(4, \infty).

Union: [0,∞)[0, \infty). There's no rule for x<0x<0, so negatives are not in the domain.

💡 If the conditions leave a gap (say nothing is defined on 1<x<21<x<2), that gap is excluded from the domain. Read the conditions as the menu of allowed inputs.

Finding the Range

The range is every yy the graph actually reaches. Find the output set of each piece over its own interval, then take the union.

f(x)={x2−2≤x<0x+10≤x≤3f(x) = \begin{cases} x^2 & -2 \le x < 0 \\ x + 1 & 0 \le x \le 3 \end{cases}

Piece 1, x2x^2 on [−2,0)[-2, 0): As xx runs from −2-2 up to (but not including) 00, x2x^2 runs from (−2)2=4(-2)^2=4 down toward 02=00^2=0. At x=−2x=-2 (included) we get 44; for inputs just left of 00 (which is excluded), x2x^2 gets close to 00 but never reaches it. Outputs: (0,4](0, 4].

Piece 2, x+1x+1 on [0,3][0, 3]: Linear and increasing, from 0+1=10+1=1 to 3+1=43+1=4. Outputs: [1,4][1, 4].

Union: (0,4]∪[1,4]=(0,4](0,4] \cup [1,4] = (0, 4]. So the range is (0,4](0, 4].

⚠️ The range comes from the outputs, not the inputs. Always plug each interval's endpoints into that piece's rule, and watch which yy-values are actually attained.

Domain & Range 🔽

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

Concept Check 🎯

Range Endpoints 🧮

For the piece x+1x+1 defined on 0≤x≤30 \le x \le 3:

1) Smallest output (at x=0x=0): y= ?y = \,? 2) Largest output (at x=3x=3): y= ?y = \,?

For the piece x2x^2 defined on −2≤x<0-2 \le x < 0:

3) Largest output (at x=−2x=-2): y= ?y = \,?

Part 6: Absolute Value & Step Functions

🧩 Piecewise Functions

Part 6 of 7 — Absolute Value & Step Functions


🔑 Hidden Pieces: Two famous functions are secretly piecewise — the absolute value function and the greatest-integer (step) function. Recognizing them as piecewise unlocks how to evaluate and graph them.

Absolute Value Is Piecewise

The absolute value ∣x∣|x| keeps positives the same and flips negatives positive. As a piecewise rule:

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

For a negative input like −5-5, the rule −x-x gives −(−5)=5-(-5)=5. That's why ∣−5∣=5|{-5}|=5.

A shifted absolute value

f(x)=∣x−3∣={−(x−3)x<3x−3x≥3={3−xx<3x−3x≥3f(x) = |x - 3| = \begin{cases} -(x-3) & x < 3 \\ x - 3 & x \ge 3 \end{cases} = \begin{cases} 3 - x & x < 3 \\ x - 3 & x \ge 3 \end{cases}

The "corner" (vertex) sits where the inside equals zero: x−3=0⇒x=3x - 3 = 0 \Rightarrow x = 3. The graph is a V with its point at (3,0)(3, 0).

💡 To split any ∣stuff∣|{\text{stuff}}| into pieces, find where stuff =0=0. Left of that, the inside is negative (so you negate it); right of that, it's positive (so you keep it).

Concept Check 🎯

The Greatest-Integer (Step) Function

The greatest-integer function ⌊x⌋\lfloor x \rfloor rounds down to the nearest integer — it returns the largest integer less than or equal to xx.

xx⌊x⌋\lfloor x \rfloorWhy
2.72.722largest integer ≤2.7\le 2.7
222222 itself
−1.3-1.3−2-2largest integer ≤−1.3\le -1.3 is −2-2, not −1-1!
555555 itself

Its graph is a series of flat steps, each one unit wide, with a closed dot on the left (included) and an open dot on the right (excluded) — a piecewise function with infinitely many constant pieces.

⚠️ The trap is negatives. ⌊−1.3⌋=−2\lfloor -1.3 \rfloor = -2, because −2≤−1.3-2 \le -1.3 but −1>−1.3-1 > -1.3. "Round down" always moves toward −∞-\infty, not toward zero.

Step Function Values 🧮

Evaluate the greatest-integer 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.5⌋= ?\lfloor -2.5 \rfloor = \,?

Special Functions 🔽

Part 7: Modeling, Mixed Practice & Exit Quiz

🧩 Piecewise Functions

Part 7 of 7 — Modeling, Mixed Practice & Exit Quiz


You can read brace notation, evaluate carefully at boundaries, graph with open/closed dots, build piecewise models from words and data, find domain and range, and decode absolute-value and step functions. Now let's use it on a real model — then prove your mastery.

Real-World Modeling: A Tax Bracket

Piecewise functions are how the world handles "the rate changes after a threshold." Suppose a simplified tax on income xx (in dollars) is:

T(x)={0.10 x0≤x≤100001000+0.20(x−10000)x>10000T(x) = \begin{cases} 0.10\,x & 0 \le x \le 10000 \\ 1000 + 0.20(x - 10000) & x > 10000 \end{cases}
  • The first $10,000 is taxed at 10%10\%: that's at most 0.10×10000=10000.10 \times 10000 = 1000, i.e. $1000.
  • Every dollar above $10,000 is taxed at 20%20\%, and the constant 10001000 carries over the tax already owed on the first bracket.

Tax on $25,000

Since 25000>1000025000 > 10000, use the bottom rule:

T(25000)=1000+0.20(25000−10000)=1000+0.20(15000)=1000+3000=4000T(25000) = 1000 + 0.20(25000 - 10000) = 1000 + 0.20(15000) = 1000 + 3000 = 4000

So the tax is $4000.

💡 The brackets agree at the boundary. At x=10000x=10000: top gives 0.10(10000)=10000.10(10000)=1000; bottom gives 1000+0.20(0)=10001000+0.20(0)=1000. They match, so earning one more dollar never causes a sudden leap in tax — exactly how real brackets are designed.

Use the Model 🧮

Use T(x)={0.10 x0≤x≤100001000+0.20(x−10000)x>10000T(x) = \begin{cases} 0.10\,x & 0 \le x \le 10000 \\ 1000 + 0.20(x - 10000) & x > 10000 \end{cases}

1) Tax on an income of $8000: T(8000)= ?T(8000) = \,? 2) Tax on an income of $10000: T(10000)= ?T(10000) = \,? 3) Tax on an income of $30000: T(30000)= ?T(30000) = \,?

Mixed Practice 🎯

Quick Reference

TaskWhat to do
Evaluate f(a)f(a)Find the one condition aa satisfies; plug into that rule
Boundary value≤,≥\le, \ge include the endpoint; <,><, > exclude it
Graph a pieceDraw the rule, keep it over its interval, ● if included / ○ if excluded
Build a modelOne rule per interval; "at most" → ≤\le, "more than" → >>; restrict the domain to the context
DomainUnion of all condition-intervals (allowed inputs)
RangeUnion of each piece's output set over its interval
⌊x⌋\lfloor x \rfloorRound down toward −∞-\infty (watch negatives!)

🔑 The whole topic reduces to one habit: always read the inequality at the boundary, then plug into the right rule.

Exit Quiz ✅

Answer all three to finish the lesson.