A piecewise function can look more complicated than it really is. Instead of seeing one familiar formula, you see several formulas stacked together, each with a condition involving x. To solve one, the most important step is figuring out which formula applies to the given input.
The process is simple: find the input value, identify the interval it belongs to, choose the correct formula, and substitute the value to get the answer.
In this guide, you’ll learn how to solve a piecewise function step by step, evaluate values correctly, read the conditions, and graph piecewise functions with clear examples you can use for homework and exam practice.
What Is a Piecewise Function?
This notation tells you that the function behaves differently
depending on the value of x.
| Input Condition | Formula to Use | What It Means |
|---|---|---|
| x < 0 | 2x + 3 | Use this piece for negative inputs. |
| x ≥ 0 | x2 | Use this piece for inputs of 0 or greater. |
If you need to find f(-2), the input -2 satisfies
x < 0, so you use 2x + 3.
If you need to find f(4), then 4 satisfies
x ≥ 0, so you use x2.
The most important idea is simple: you do not use every formula for every input.
The condition beside each formula tells you when that particular piece applies.
Why are functions defined in pieces?
Piecewise-defined functions are useful when a relationship changes after a particular point.
Imagine a museum charges one admission price for children and another for adults. Or suppose a delivery company charges a constant base fee for the first few miles and then adds a cost per mile beyond that distance.
One formula cannot always describe these situations neatly. A piecewise function can.
For example, a tutoring resource platform might model a hypothetical fee as:
Here, h represents hours and C(h) represents cost.
The first piece covers one part of the domain, while the second formula
covers another.
This is why piecewise functions are more than an algebra exercise.
They provide a way to model situations in which rules change
at defined boundaries.
Important piecewise function vocabulary
Knowing the notation makes these problems much easier to read.
| Term | Meaning |
|---|---|
| Function | A rule that assigns each valid input exactly one output. |
| Input | The number substituted for the variable, usually x. |
| Output | The resulting value of the function. |
| Domain | All permitted input values. |
| Piece | One formula within a piecewise-defined function. |
| Interval | A section of the domain where a particular formula applies. |
| Boundary Point | A value where the rule changes from one piece to another. |
| Function Notation | Notation such as f(x), g(x), or C(x) used to name a function. |
Why? If x is negative, taking −x produces its nonnegative absolute value. If x is already 0 or greater, its absolute value is simply x.
A step function is another type of piecewise-defined
function. Instead of sloping lines or curves, its graph contains
constant sections that resemble steps.
Once you recognize that every piece owns a particular portion of the
domain, evaluating these functions becomes much more systematic.
How to Evaluate a Piecewise-Defined Function Step by Step
When students make mistakes with piecewise functions, the algebra itself often is not the problem. The error usually happens before the calculation: the wrong piece is selected.
A reliable process prevents that.
Step 1: Identify the given input
Suppose you have:
and you are asked to find:
g(2)
Your input value is 2.
Do not substitute 2 into anything yet.
First, determine which condition contains it.
Step 2: Compare the input with every interval
The function has three different pieces of the domain:
| Condition | Does x = 2 Belong Here? | Formula |
|---|---|---|
| x < −1 | No | x + 4 |
| −1 ≤ x ≤ 3 | Yes | x2 |
| x > 3 | No | 10 − x |
Because 2 lies between −1-1 and 3, the middle formula applies.
This is the decision that controls the rest of the problem.
Step 3: Select only the matching formula
Now temporarily ignore the other two pieces.
You need:
g(x) = x2
for this particular input.
A common mistake is trying to combine the formulas or evaluate all three. That is unnecessary. A given input should correspond to the appropriate rule in the function’s domain.
Step 4: Substitute the input value
Replace x with 2:
g(2) = 22
Step 5: Simplify
g(2) = 4
The entire process can be remembered as:
Input → Interval → Formula → Substitute → Simplify
That sequence is worth practicing until it becomes automatic.
Be especially careful with boundary values
Boundary points deserve extra attention because symbols such as <, ≤, >, and ≥ determine which piece owns the endpoint.
Return to:
Consider g(−1).
| Condition | Does −1 Qualify? | Why? |
|---|---|---|
| x < −1 | No | −1 is not smaller than itself. |
| −1 ≤ x ≤ 3 | Yes | The ≤ symbol includes −1. |
| x > 3 | No | −1 is not greater than 3. |
Therefore, use x2:
g(−1) = (−1)2 = 1
Now consider g(3). Because the middle interval says
−1 ≤ x ≤ 3, the number 3 is also
included in the middle piece:
g(3) = 32 = 9
But g(4) belongs to
x > 3:
g(4) = 10 − 4 = 6
Small inequality symbols can completely change the answer, so checking
them should be part of your routine.
A quick self-check before moving on
Before accepting an answer, ask yourself:
- What was the given input?
- Which interval contains that number?
- Did I use only the formula corresponding to that interval?
- Did I substitute the input everywhere xx appears?
- Did I follow the correct order of operations?
If those five answers are clear, you are much less likely to lose points through a selection error.
Now let’s apply the process to a complete example.
Piecewise Function Example With a Complete Solution
Consider the function:
Suppose you need to determine:
f(−4),
f(0),
f(5)
Instead of rushing into substitution, treat each input as a separate decision.
Example 1: Find f(−4)
First identify where −4 belongs.
Since:
−4 < −2
we use:
f(x) = 2x + 1
Substitute −4:
f(−4) = 2(−4) + 1
Simplify:
f(−4) = −8 + 1 = −7
Therefore:
f(−4) = −7
Example 2: Find f(0)
Now check the conditions.
The number 0 satisfies:
−2 ≤ 0 ≤ 3
So the middle piece applies:
f(x) = x2 − 1
Substitute:
f(0) = 02 − 1
Therefore:
f(0) = −1
Notice that 0 did not automatically make the entire function equal zero.
The formula assigned to that input determines the output.
Example 3: Find f(5)
Because:
5 > 3
we select:
f(x) = 4x − 2
Then:
f(5) = 4(5) − 2
Simplify:
f(5) = 20 − 2 = 18
Therefore:
f(5) = 18
Here are all three results side by side:
| Given Input | Matching Part of the Domain | Formula Used | Function Value |
|---|---|---|---|
| −4 | x < −2 | 2x + 1 | f(−4) = −7 |
| 0 | −2 ≤ x ≤ 3 | x2 − 1 | f(0) = −1 |
| 5 | x > 3 | 4x − 2 | f(5) = 18 |
What if the input is exactly on a boundary?
Suppose we evaluate f(2).
Look carefully at the conditions:
−2 ≤ x ≤ 2
and
x > 2
The first condition includes 2 because of the
≤ symbol. The third does not.
Therefore:
f(2) = 22 − 1 = 3
This distinction becomes especially important when you graph the function because included and excluded boundary values are represented differently.
How to Graph a Piecewise Function
There are three pieces, so we graph three sections.
Step 1: Separate the formulas and their domains
Before plotting anything, organize the information.
| Piece | Formula | Domain Restriction | Graph Type |
|---|---|---|---|
| 1 | y = x + 2 | x < 0 | Linear |
| 2 | y = 3 − x | 0 ≤ x ≤ 3 | Linear |
| 3 | y = −x + 6 | x > 3 | Linear |
This prevents one of the most common graphing mistakes: extending a formula across the entire coordinate plane.
Each formula should appear only where its domain allows it.
Step 2: Graph the first piece
For:
y = x + 2, x < 0
Draw the line y = x + 2,
but keep only the portion where x is less than 0.
At the boundary x = 0:
y = 0 + 2 = 2
However, the condition is
x < 0, not x ≤ 0.
Therefore, this piece does not include its endpoint at
x = 0.
That is normally shown with an open circle at (0, 2).
Step 3: Graph the Second Piece
The second rule is:
y = 3 − x, 0 ≤ x ≤ 3
This creates a decreasing line segment from
x = 0 to x = 3.
At x = 0:
y = 3 − 0 = 3
At x = 3:
y = 3 − 3 = 0
Both endpoints are included because the condition uses ≤.
So this piece has closed circles at:
(0, 3) and (3, 0)
Step 4: Graph the Final Piece
The last formula is:
y = −x + 6, x > 3
At the boundary x = 3, the corresponding line would give:
y = −3 + 6 = 3
But the condition says
x > 3, so this piece excludes x = 3.
Place an open circle at:
(3, 3) and draw the line only to the right of x = 3.

How To Master Precalculus with Expert Online Tutors
Precalculus feels confusing with trigonometry and algebra? This guide simplifies pre-calculus concepts and builds mathematical skills for calculus success
Common Types of Piecewise-Defined Functions
Piecewise-defined functions can look complicated at first because a single function contains at least two rules. The key idea, however, is straightforward: each rule applies only to a particular part of the domain of the function.
Think of it like choosing the correct fare on public transportation. The amount you pay might depend on your age, the distance traveled, or the time of day. There is one system, but different conditions determine which rule applies.
In algebra and precalculus, you will encounter several common types.
Constant piecewise functions
A constant piecewise function assigns the same output to every input within one interval. When several constant pieces are combined, the graph often looks like a set of horizontal steps.
This structure appears in a step function. For example, a delivery company might charge:
| Order Value | Delivery Cost |
|---|---|
| Less than $25 | $8 |
| $25 to less than $50 | $5 |
| Greater than or equal to $50 | $0 |
The delivery charge changes when the input crosses a boundary, rather than changing gradually.
This is one reason we can use piecewise functions to describe situations involving pricing tiers, shipping fees, tax brackets, and other rules that change at specific thresholds.
Linear piecewise functions
A linear piecewise function uses linear equations for its pieces. Each equation may have a different slope or starting value.
Suppose a manufacturer charges $6 per item for the first 20 units but reduces the cost per piece for additional units. A piecewise model can represent the changing pricing structure.
These problems are useful because they connect algebra to a practical application: students can use the appropriate rule to determine the cost for a particular order size.
Absolute value functions
An absolute value function is another important example. The familiar function f(x)=∣x∣f(x)=|x| can be written using two linear rules:
f(x) = x
when x ≥ 0.f(x) = −x
when x < 0.
Together, those rules produce the familiar V-shaped graph.
This example also demonstrates an important property of piecewise functions: having different rules does not necessarily mean the graph has gaps or jumps. An absolute value function is continuous, even though it can be described using separate pieces.
Real-world piecewise models
Piecewise functions are especially valuable when one formula cannot accurately represent an entire situation.
For example, income may be calculated differently depending on hours worked. A worker could receive a standard hourly rate for the first 40 hours and a higher overtime rate after that point.
| Situation | Why a Piecewise Function Helps |
|---|---|
| Overtime Income | The pay rate changes after a set number of hours. |
| Shipping Charges | The fee changes at order-value thresholds. |
| Parking Costs | Different rates may apply to different time periods. |
| Utility Bills | Usage may be charged at different rates. |
| Bulk Purchases | Cost per piece may decrease after a quantity threshold. |
How to Define a Piecewise Function From a Graph
Sometimes an algebra problem gives you equations and asks you to draw the graph. Other times, it does the reverse: you see a graph and must define the piecewise function that created it.
The second type can feel harder because you need to identify both the equation and the interval associated with each piece.
A reliable approach is to separate those jobs.
Step 1: Identify each distinct piece
Start by looking for places where the graph changes its behavior.
You might see:
- one horizontal segment followed by a sloping line
- two lines with different slopes
- a curved section connected to a linear section; or
- separate sections divided by open or closed endpoints.
Treat each distinct section as its own rule.
If the graph has three visibly different sections, for example, expect the final function to contain three pieces.
Step 2: Determine the equation for each piece
Next, focus on one section at a time.
For a straight line, determine its slope and y-intercept. You can then write the equation in the familiar form:
y = mx + b
For a horizontal section, the equation is simply a constant such as
y = 4.
For curved pieces, look for familiar parent functions, including quadratic or absolute value patterns.
Do not worry about the interval yet. First make sure the equation describes the shape of that particular section.
Step 3: Read the endpoints carefully
Endpoints tell you which x-values belong to each rule.
| Graph Symbol | Typical Meaning | Inequality |
|---|---|---|
| Open Circle | Endpoint is excluded | x < 3 or x > 3 |
| Closed Circle | Endpoint is included | x ≤ 3 or x ≥ 3 |
| Arrow | Graph continues | Extends through additional real numbers |
For example, a closed circle at x = 2
means that 2 belongs to that piece. Depending on the direction of the graph,
its condition might therefore be
x ≤ 2 or
x ≥ 2.
This distinction is easy to overlook, but it can change the answer.
Step 4: Match Each Equation to Its Interval
Now combine the equation and its condition.
Imagine a graph containing:
a line
y = x + 2 for −1 < x < 1; anda horizontal segment
y = 4 for x ≥ 1.
The piecewise function would use the first equation when x is below 1 and the second when x is greater than or equal to 1.
The important question is always:
Which x-values make this rule active?
That question helps prevent one of the most common errors: finding the right equations but assigning them to the wrong intervals.
Step 5: Check the complete domain
Before finishing, examine the domain of the function.
Ask whether the pieces cover all required inputs. Some piecewise functions are defined for all real numbers, while others intentionally contain gaps or restrictions.
Also check boundary values. If one interval ends at x=3x=3 and another begins there, determine which piece actually includes 3.
A quick check of the equations, endpoints, and intervals can catch errors before they cost points.
Once you can translate graphs into rules, exam questions become much more manageable. The next step is having a fast, repeatable method for solving them under time pressure.
A Simple Strategy for Solving Piecewise Functions on Exams
On an exam, piecewise functions often test careful reading as much as algebra.
A student may know how to substitute a number into an equation perfectly and still lose a mark by choosing the wrong piece. That is why a structured process is more dependable than trying to solve everything mentally.
Use the interval-first method
When asked to find a value such as f(5),
resist the urge to start calculating immediately.
Instead, follow this sequence:
- Circle the input. In f(5), the input is 5.
- Compare it with every condition. Decide which interval contains 5.
- Select only that rule. Ignore the other equations.
- Substitute the input. Put 5 into the correct equation.
- Simplify carefully.
- Check the condition again. Make sure you did not overlook an equality sign.
This turns a visually complicated problem into a short decision
followed by ordinary algebra.
Pay Extra Attention to Boundary Values
Suppose a function uses one rule when
x < 4
and another when
x ≥ 4.
Which rule should you use for
f(4)?
| Input | Condition It Satisfies | Rule to Use |
|---|---|---|
| 3 | x < 4 | First piece |
| 4 | x ≥ 4 | Second piece |
| 5 | x ≥ 4 | Second piece |
The equality line underneath the inequality symbol matters. At a boundary, check whether the condition says less than, less than or equal to, greater than, or greater than or equal to the boundary value.
Separate selection mistakes from algebra mistakes
When checking your work, ask two different questions:
- Did I choose the correct piece?
- Did I correctly evaluate that piece?
This distinction is useful during exam preparation. If you repeatedly make selection errors, you need more interval practice. If you choose the right piece but calculate incorrectly, focus on substitution and algebraic simplification instead.
That makes revision more targeted.
Build Confidence One Piece at a Time



Piecewise Function Practice Questions
The best way to become comfortable with piecewise functions is to work through several types of questions. Try the problems below without looking at the answers first.
Practice 1: Evaluate a function
Let
Find:
- f(−2)
- f(0)
- f(3)
Answers:
For f(−2), use 2x + 3 because −2 < 0:
f(−2) = 2(−2) + 3
= −4 + 3
= −1
So, f(−2) = −1.
For f(0), use
x2 + 1 because 0 satisfies x ≥ 0:
f(0) = 02 + 1 = 1
So, f(0) = 1.
For f(3), use
x2 + 1 because
3 ≥ 0:
f(3) = 32 + 1
= 9 + 1
= 10
So, f(3) = 10.
Notice that x = 0 is a boundary value. Checking the equality symbol before calculating is essential.
Practice 2: Work with three pieces
Suppose
Find: g(−4), g(2), and g(3).
| Input | Correct Piece | Value |
|---|---|---|
| −4 | x < −1 | −2 |
| 2 | −1 ≤ x < 3 | 3 |
| 3 | x ≥ 3 | 7 |
The middle rule applies over one interval, while the other two pieces cover the values on either side.
Practice 3: Apply a piecewise function to cost
A printing service charges $0.20 per page for the first 50 pages. For orders above 50 pages, it charges a flat $10 for the first 50 pages plus $0.12 for each additional page.
Which calculation should you use for an order of 80 pages?
Because 80 is above 50, use the second pricing rule:
10 + 0.12(80 − 50)
= 10 + 0.12(30)
= 10 + 3.60
= 13.60
The total is $13.60.
This is a practical example of how piecewise functions describe situations where a pricing rule changes after a threshold. The same idea can model income, shipping rates, parking fees, and changing cost per piece.
Practice 4: Think about continuity
Consider:
A final self-check
Before moving on, see whether you can confidently do all of the following:- identify which piece applies to a given input;
- interpret open and closed endpoints;
- distinguish < from ≤ and > from ≥.
- evaluate functions at boundary values;
- identify the domain of the function;
- define a piecewise function from a graph;
- recognize whether separate pieces connect continuously; and
- use piecewise functions to describe real-world situations.
Ready to Feel More Confident With Piecewise Functions?
Piecewise functions become much easier when you have the right explanation, focused practice, and someone who can pinpoint exactly where you are getting stuck.
YourPrivate Tutor gives students personalized math support built around their individual learning needs. Whether you need help with algebra, precalculus, homework, exam preparation, or building stronger foundations, our private tutors can turn confusing concepts into clear, manageable steps.
Instead of memorizing your way through the next test, build math skills you can use with confidence.
Contact YourPrivate Tutor today to find the right math tutor and get the support you need to move forward.
Book a $5 Trial Session Now
Related Resources

Master the Radian Unit Circle Chart With Easy Study Tips
Not sure which piece of a piecewise function to use? Learn how to match x to the right interval and find the value step by step in algebra.

Unit Circle Quadrants and Signs Explained
Confused by unit circle signs? Learn how angle, coordinate, and radius of 1 define each quadrant, with a clear example and practice.

Inverse Functions in Calculus Made Easy for Students
Confused by inverse function notation? Learn how input and output switch with a simple f(x) example and clear diagram.
