Skip to main content
Mathovia

Algebra / Graphing and Functions

Piecewise Functions: Different Rules on Different Intervals

A piecewise function uses one rule on part of its domain and a different rule elsewhere. That sounds exotic until you notice how common it is: tax bands, postage rates, parking charges and mobile data plans are all piecewise. This lesson covers reading the notation, picking the right branch before you substitute, graphing each piece over its own interval, the filled-and-open-dot convention at the boundaries, and how to get the domain and range.

Practice Problems
M
Written by
Mathovia Team
Editorial Team

Some situations genuinely cannot be described by one formula. A parking meter charges by the started hour, a tax system applies different rates to different bands, and a delivery firm has one price up to 2 kg and another beyond it. Piecewise notation is how you write those down.

A piecewise function defined by two rules on different intervals
A piecewise definition

Reading the Notation

The large brace groups the branches. Each line has two parts: the rule on the left and the condition on the right, and the condition tells you when that rule applies.

Read it as a sentence: ” is when is less than 2, and 1 when is at least 2.”

A piecewise graph with a rising line ending in an open circle at (2, 3) and a horizontal ray starting with a filled dot at (2, 1)
Each rule is drawn only across the interval where it applies.

Two things a valid definition must do. The conditions must not overlap, or an input could match two rules and produce two outputs — which would break the one-output rule. And any input the conditions do not cover is simply outside the domain.

Evaluating: Condition First, Then Substitute

The single most common mistake is substituting into the wrong branch. Get into the habit of checking the condition before you touch the algebra.

Step-by-step evaluation checking which condition each input satisfies before substituting
Decide which rule applies, then substitute into that one only.

For when and when :

  • : is ? Yes → use .
  • : is ? No → use .
  • : is ? No, so the second branch applies → .

That last one is the boundary, and it is where marks get lost. The condition includes 3, so the second rule owns it.

Graphing Piece by Piece

Treat each branch as its own small graphing problem, restricted to its interval.

  1. Take one branch. Ignore the others entirely.
  2. Graph it only on its interval. Draw nothing outside.
  3. Mark the endpoints — filled if included, open if not.
  4. Repeat for each branch.
  5. Never join across a break.

The endpoint convention is worth stating precisely:

ConditionEndpointSymbol
not includedopen circle
includedfilled dot
not includedopen circle
includedfilled dot

At a boundary that belongs to the domain, exactly one dot is filled. Two filled dots at the same would mean two outputs; two open circles would mean the function is undefined there.

Jumps and Continuity

Piecewise functions may or may not join up at their boundaries.

If the two branches happen to give the same value at the boundary, the graph is continuous — you can draw it without lifting the pen. For when and when , the left branch approaches 2 and the right branch is 2, so they meet.

If they give different values there is a jump discontinuity, a visible step. That is not an error — most real piecewise models jump, because prices and rates change abruptly.

Step Functions

A step function is a piecewise function whose branches are all constants. The graph is a staircase.

A staircase graph of parking cost, each step flat with a filled dot on the left and an open circle on the right
Each started hour costs the same, so the cost holds flat then jumps.

Car parks work exactly this way: any part of an hour costs a full hour. The filled dot on the left of each step and the open circle on the right say that at exactly 2 hours you pay the 2-hour rate, not the 3-hour rate.

Absolute Value Is Piecewise

is a piecewise function in disguise:

The V-shaped absolute value graph with the left arm labelled y = negative x and the right arm labelled y = x
The V is two straight rules meeting at the origin.

The branch is not negative — for it gives . Rewriting absolute value this way is how you solve equations and inequalities containing it.

Domain and Range

Domain: the union of the intervals the pieces are defined on. If the conditions cover everything, the domain is all real numbers. A value no condition covers is excluded.

Range: work out the outputs each branch produces on its own interval, then take the union. This is where the endpoint dots matter — an open circle at a boundary may mean a value is missing from the range.

For the function graphed at the top of this lesson: the first branch on produces everything below 3 (not including 3), and the second branch produces just . The range is , since 1 is already in there.

Worked Example A: Evaluating

For , find , and .

  • : , so .
  • : is true, so .
  • : , so .

Worked Example B: A Boundary Value

For , find .

The condition includes 1, so use : .

Note the first branch gives 5 as approaches 1 from the left, so the graph jumps from 5 down to 3 at .

Worked Example C: Graphing

Graph .

  • Left branch: the line , drawn only for , ending at with a filled dot.
  • Right branch: the parabola , drawn only for , starting at with an open circle.

Both approach the same point, so the graph looks continuous even though one dot is open — the filled dot from the left branch supplies the value.

Worked Example D: Domain and Range

Find the domain and range of .

Domain: . Nothing above 3 is covered.

Range: the first branch gives only ; the second runs from to . Union: .

Worked Example E: A Real Model

A courier charges £4 for parcels up to 2 kg and £4 plus £1.50 per extra kilogram beyond that.

A 5 kg parcel costs . The matters — the surcharge applies only to the weight above the threshold, which is exactly how tax bands work too.

Common Mistakes to Avoid

  • Substituting before checking the condition. Decide the branch first.
  • Getting the boundary branch wrong. owns 3; does not.
  • Filling both dots at a boundary. That gives one input two outputs.
  • Drawing a branch outside its interval. Each rule stops where its condition stops.
  • Joining across a jump. A discontinuity is a real feature, not a gap to bridge.
  • Reading as negative. For a negative , is positive.
  • Forgetting uncovered values. If no condition includes , it is not in the domain.

Where Piecewise Functions Show Up

  • Tax bands and tiered pricing, where a rate changes at a threshold.
  • Postage and shipping, priced by weight band.
  • Parking and phone charges, as step functions.
  • Absolute value equations and inequalities, solved by splitting into cases.
  • Calculus, where continuity and differentiability at the boundaries are checked directly.
  • Programming, where an if / else if / else chain is a piecewise function written as code.

Practice Problems

Work each one before opening the answer.

Use for Problems 1–3.

Problem 1. Find .

Show answer

, so use : .

Problem 2. Find .

Show answer

includes 1, so use : .

Problem 3. Find .

Show answer

, so : .

Problem 4. Write as a piecewise function.

Show answer

when , and when .

Problem 5. At , a function has for and for . Is there a jump?

Show answer

The left branch gives ; the right approaches 7. Yes — a jump of 3.

Problem 6. For the function in Problem 5, which dot is filled at ?

Show answer

The filled dot is at ; gets an open circle.

Problem 7. Find the domain of .

Show answer

. Nothing between and 1 is covered.

Problem 8. Find the range of .

Show answer

Only two outputs ever occur: .

Problem 9. A gym charges £20 a month for up to 8 visits, then £2 per extra visit. Write the cost function.

Show answer

for , and for .

Problem 10. Why can a piecewise definition not have the conditions and on two different rules?

Show answer

They overlap at , so that input would match both rules and could produce two outputs — which is not allowed for a function.

Quick Reference

TaskMethod
EvaluateCheck the condition first, then substitute
Boundary value or owns the endpoint
GraphDraw each rule only on its interval
Filled dotEndpoint included (, )
Open circleEndpoint excluded (, )
DomainUnion of the intervals
RangeUnion of each branch’s outputs
Conditions mustNot overlap
Step functionAll branches constant

Piecewise rules are graphed with the technique in Graphing Functions, evaluated using function notation, and still obey the one-output rule. Their domain and range come from the branches. More Algebra lessons are available.

Frequently Asked Questions

What is a piecewise function?+

A piecewise function is defined by two or more rules, each applying to a different part of the domain. Which rule you use depends on which interval the input falls in.

How do you evaluate a piecewise function?+

Check the conditions first to see which interval the input belongs to, then substitute into that branch only. For when , evaluating uses because , giving 2.

How do you graph a piecewise function?+

Graph each rule only across the interval where it applies, then mark the boundaries with a filled dot where the endpoint is included and an open circle where it is not. Do not join the pieces across a break.

What do the filled and open dots mean?+

A filled dot means the endpoint belongs to the graph, matching or . An open circle means it does not, matching or . At any boundary value in the domain, exactly one dot should be filled.

How do you find the domain of a piecewise function?+

Take the union of the intervals the pieces are defined on. If they cover every real number with no gaps, the domain is all real numbers; if there is a value no condition covers, that value is excluded.

Is the absolute value function piecewise?+

Yes. equals when and when , which is exactly a two-rule piecewise definition. The V shape is the two straight branches meeting at the origin.

Related lessons