Piecewise Function

In short: Piecewise function describes a function built from two or more separate rules, each one applying only on its own interval of x-values.
Algebra 1Functions and GraphsF-IF.C.7b
What is Piecewise Function?
A parking garage might charge a flat fee for the first two hours and a rate per hour after that, so one price formula cannot cover both, and a piecewise function glues the pieces together, naming the rule for each stretch of input values.
Each piece has its own condition, such as “for x less than 2” or “for x at least 2”. On the graph, a piece that excludes its endpoint gets an open circle and one that includes it gets a closed circle. At the boundary the graph may jump.
How to spot it
- A story changes its rule at a cutoff: a flat fee then a rate, a tax bracket, a shipping tier.
- A piecewise function is written with two or more lines of rules, each followed by a condition on x.
- A graph consists of separate segments, often with open and closed dots at the break.
- A question asks for an output and you must first choose which rule matches the input.
The method
- Read the conditions and find the interval that contains your input.
- Use only the rule that belongs to that interval and substitute the input.
- At a boundary value, check which piece includes it (at least or at most) before choosing.
- To graph, draw each rule on its own interval, using an open circle for excluded ends and a closed circle for included ends.
Piecewise Function: solved example
Problem
A garage charges $5 for any stay up to 2 hours. After 2 hours it adds $3 per extra hour. Write the rule and find the cost for 1.5 hours, 4 hours and 6 hours.
Solution
For \(0 < h \le 2\) the cost is \(C(h) = 5\). For \(h > 2\) the cost is \(C(h) = 5 + 3(h – 2)\).
At 1.5 hours the first rule applies: $5. At 4 hours: \(5 + 3(2) = 11\). At 6 hours: \(5 + 3(4) = 17\). The costs are $5, $11 and $17.
Try it
Question 1
Let \(f(x) = x + 1\) when x is below 2, and \(f(x) = 6 – x\) when x is 2 or more. Find \(f(2)\), \(f(-3)\) and \(f(5)\).
Show the answer
\(f(2) = 6 – 2 = 4\), \(f(-3) = -3 + 1 = -2\), and \(f(5) = 6 – 5 = 1\).
Question 2
Write \(|x|\) as two separate rules.
Show the answer
It equals x when x is 0 or more, and equals \(-x\) when x is below 0.
Piecewise Function vs. Absolute Value Function
The V-shaped rule is one particular case that can be split into two pieces. This family is much wider: any collection of rules on different intervals, including flat steps, lines, curves and even jumps. Think of the first as a single recipe and the second as a recipe book.
Keep going
Lessons
Worksheets and quizzes
- Functions and Function Notation – Worksheet
- Functions and Function Notation – Quiz
- Functions, Domain and Range – Worksheet
- Functions, Domain and Range – Quiz
Related words
- Absolute Value Function
- Function Notation
- Domain and Range
- Inequality
- Linear Function
- Compound Inequality
Whole dictionary: A–Z · Algebra 1 · Functions and Graphs