On this concept: Formula

Not sure which lesson to do first? Find your level and get a plan →

Math · Advanced Functions · Grade 9-12

Piecewise Behavior

Piecewise behavior means a function acts differently in different parts of its domain — a different slope, curvature, or formula in each region, separated by boundaries.

∣x∣={xif x≥0−xif x<0

Quick Answer

Piecewise behavior means a function acts differently in different parts of its domain — a different slope, curvature, or formula in each region, separated by boundaries. You meet it whenever a rule changes at a threshold: a phone plan with 5 GB included and a charge per extra GB, overtime pay after 40 hours, or ∣x∣, which slopes down left of 0 and up to the right. To work with it, find the input's region, use that region's formula, and check each boundary separately, where the graph may join smoothly, form a corner or jump.

Why This Matters

Many real rules change character at a threshold, and a single formula stretched across that threshold is wrong on at least one side. Thinking piecewise lets you compute an overtime paycheck or a tax bill correctly, and it makes you ask the two questions that matter at each seam: do the pieces meet, and which piece owns the boundary point? Skipping them produces errors at exactly the inputs people check most, the cutoffs.

Intuitive Explanation

Take a phone plan: the first 5 GB of data are included in a $30 fee, and each GB after that costs $8. For x≤5 the bill is B(x)=30; for x>5 it is B(x)=30+8(x−5). The graph runs flat, then at x=5 it bends upward into a line of slope 8. It is one function with two behaviors, and x=5 is where the behavior switches.

Every piecewise problem has two jobs. The first is routing: before using any formula, decide which region the input belongs to, so B(7) uses the second piece and gives 30+8⋅2=46. The second is the seams. At a boundary a, compare the value the left piece approaches with the value the right piece approaches. Here both give 30 at x=5, so the graph is continuous but has a corner. When the two values differ the graph jumps, and the inequality signs (≤ or <) decide which piece supplies f(a) itself.

Changing direction is not the same as changing rules. The parabola y=x2 falls and then rises, yet one formula describes it everywhere, and it turns smoothly. ∣x∣ also falls then rises, but its slope switches abruptly from −1 to 1 at 0, because two different formulas meet there. A sharp corner or a jump in a graph is the visible sign of piecewise behavior; a smooth turn is not.

Think of it like this. A car with gears: below a certain speed the engine responds one way, and at the shift point the same pedal produces a different response. The function is the car, the regions are the gears, and each boundary is a shift point. Unlike a gearbox, a function can also jump to a new output at the shift.

Core idea. A function shows piecewise behavior when it follows one rule until a boundary, then switches to a qualitatively different rule.


When to Use

Think piecewise when a rule comes with conditions ("if x<0", "for orders over 50 dollars"), when a graph has a corner or a jump, or when a quantity is free, flat or charged differently past a threshold. Absolute value, tax brackets and overtime pay are standard cases. If one formula covers the whole domain, even one that turns around like a parabola, treat it as a single function; if every piece is a constant, the simpler step-function view applies.

Tip. Ask: Does the function switch to a different rule depending on which region of the domain the input is in?

How to Recognize It

Before splitting a function into pieces, find the input values where the rule changes and check what the output does exactly at those values.

  1. Does the formula contain an absolute value, the larger or smaller of two expressions, or an 'if' condition?

    If yes, rewrite it in pieces: ∣x−3∣ is 3−x for x<3 and x−3 for x≥3. Each piece is then a plain formula you can graph or solve.

  2. Is every piece a constant, with no x left in any of the formulas?

    If yes, it is a step function, and you only need the band each input falls in. If at least one piece has a slope or a curve, use each formula on its own region and test the boundaries.

  3. Do the left and right pieces give the same value at a boundary?

    If yes, the graph joins there, though it may still form a corner, as ∣x∣ does at 0. If no, the graph jumps, and the inequality signs decide which piece supplies f at that point.

  4. Could one formula, such as x2−4x, describe the whole graph even though the graph turns around?

    If yes, it is a single function, and turning around does not make it piecewise. Piecewise means the rule itself changes; a parabola's vertex is a turning point inside one rule.

Piecewise Behavior compared with Step function, Continuity at a boundary, and Single smooth function

All four rows concern graphs that may bend, break or turn, so they get filed together. Ask whether the rule itself changes at some input, whether every piece is flat, and whether the pieces actually meet.

Piecewise Behavior

Meaning
Use this when a function follows qualitatively different rules in different regions of its domain.
Key test
Does the function switch to a different rule depending on which region of the domain the input is in?
Formula
∣x∣={xif x≥0−xif x<0
Example
For f(x)=∣x∣ defined as x if x≥0 and −x if x<0, find f(−4) and check the join at 0.

Step function

Meaning
A special piecewise function where every piece is a flat constant.
Key test
Use when each region's output is constant, not just a different formula.
Formula
⌊x⌋
Example
Postage by weight band

Continuity at a boundary

Meaning
Whether the pieces actually connect without a jump.
Key test
Use when you must verify the left and right limits and the value all agree at a.
Formula
lim⁡x→a−f=lim⁡x→a+f=f(a)
Example
Checking ∣x∣ joins at x=0

Single smooth function

Meaning
One formula governs the whole domain with no regime switch.
Key test
Use when the same rule fits everywhere, like a single parabola.
Example
f(x)=x2 on all reals

Formula & Notation

∣x∣={xif x≥0−xif x<0
f exhibits piecewise behavior on {Di} if f∣Di has qualitatively different properties (slope, concavity, continuity) on each subdomain Di, with ⋃Di=Dom(f).

How to read it: Continuity at boundary a: check that lim⁡x→a−f(x)=lim⁡x→a+f(x)=f(a).

Worked Examples

Example 1 — Evaluate absolute value

Easy

For f(x)=∣x∣ defined as x if x≥0 and −x if x<0, find f(−4) and check the join at 0.
Show the steps and the answer
  1. Route the input: −4<0, so use the piece −x.

    The condition x<0 owns every negative input; the piece x would give the wrong sign.

  2. Evaluate: f(−4)=−(−4)=4.

    Negating a negative input gives a positive output, which is why ∣x∣ is never negative.

  3. Approach the seam from the left: as x→0−, −x→0.

    For the pieces to join, the left piece must head toward the same height as f(0).

  4. Approach from the right: as x→0+, x→0, and f(0)=0 from the piece x≥0.

    All three values agree, so there is no jump; the slope still switches from −1 to 1, which makes a corner.

Answer: f(−4)=4, continuous at 0

Takeaway: Route the input to its piece before computing, then compare the left value, right value and boundary value; when all three agree, the pieces join.

Example 2 — One rule, no switch

Standard

Is f(x)=x2 a piecewise-behavior function because it falls then rises?
Show the steps and the answer
  1. Look for a change of rule: f(x)=x2 uses the same formula for every real x.

    Piecewise behavior needs different formulas on different regions, and here there is only one.

  2. Compare small steps near the turn: from x=−0.2 to −0.1, y drops from 0.04 to 0.01; from 0.1 to 0.2, it rises from 0.01 to 0.04.

    The changes shrink toward zero at the vertex and grow again, so the graph turns smoothly with no corner.

  3. Contrast ∣x∣ over the same steps: it drops from 0.2 to 0.1, then rises from 0.1 to 0.2.

    ∣x∣ keeps its full slope right up to 0 and then switches sign at once; that abrupt switch is what two formulas meeting produces.

Answer: No — it's a single function

Takeaway: Falling then rising is not enough: piecewise behavior means the rule itself changes, which usually shows as a corner or a jump.

Example 3 — Find the mistake: assuming the pieces meet

Application

Let g(x)={x+2if x<12xif x≥1. Lee writes: "Both pieces are lines, so the graph is one unbroken path, and g(1)=1+2=3." Find the mistake and correct it.
Show the steps and the answer
  1. Find which piece owns x=1: the condition x≥1 belongs to 2x, so g(1)=2(1)=2.

    Lee used x+2, but that piece only covers inputs below 1.

  2. Find the left-hand value: as x→1−, x+2→3.

    The left piece heads toward 3 even though it never actually reaches x=1.

  3. Compare the two sides: the left side approaches 3, the right side starts at 2.

    Two lines that arrive at different heights do not meet, so the graph jumps down by 1 at x=1.

  4. Draw it: an open circle at (1,3) ending the left line and a closed dot at (1,2) starting the right line.

    Open and closed dots record which piece owns the boundary point.

Answer: g(1)=2, and g is not continuous at x=1: it jumps from values near 3 down to 2.

Takeaway: Pieces that are each unbroken can still fail to meet; compute both one-sided values at every boundary before calling the graph continuous.

Where You'll See It

  • Overtime pay

    A worker earning $20 an hour gets time and a half after 40 hours: P(h)=20h for h≤40 and P(h)=800+30(h−40) above that. Both pieces give 800 dollars at 40 hours, so pay is continuous, but each extra hour now adds 30 dollars instead of 20: a corner in the graph.

  • Income tax brackets

    In a simple two-bracket system, income up to 10,000 is taxed at 10% and income above it at 20%. Tax on 15,000 is 0.10(10,000)+0.20(5,000)=2,000, not 20% of everything (3,000). The rate switches at the boundary, but the tax owed rises without a jump.

  • Free shipping thresholds

    A store adds $6 shipping to orders under $50 and ships free from $50 up. A $49 order costs $55 in total, while a $50 order costs $50. The total jumps down at the boundary, which is why shoppers add a small item to reach it.

Common Mistakes

  1. The slip: Assuming continuity for free

    Instead: a piecewise definition can jump; check the limits at each boundary.

  2. The slip: Using the wrong piece for a given input

    Instead: match the input to its region before applying a rule.

  3. The slip: Forgetting which piece owns the boundary point itself

    Instead: the conditions (≤ vs <) decide which formula gives f(a).


Mini Practice

Try these on your own. Tap Reveal when you want to check.

  1. Let f(x)={x+2x<14−xx≥1. Find the slope of each piece and check whether the pieces meet at x=1.

    Hint: Put x=1 into both formulas and compare.

  2. Let g(x)={x2x≤2x+3x>2. Is there a jump at x=2, and how big is it?

    Hint: Find the value from the left piece and the value the right piece approaches.

  3. A phone plan costs $20 for up to 5 GB, then $4 for each extra GB. Write the cost C(g) as a piecewise function and find C(8).

    Hint: Only the gigabytes above 5 cost extra.

  4. Write h(x)=∣x−3∣+1 as a piecewise function. Where is it decreasing, and where is it increasing?

    Hint: Split at the input that makes x−3 equal to zero.

  5. A tank fills at 5 litres per minute for 10 minutes, then a valve opens and it drains at 2 litres per minute. Is volume one linear function, or a function with piecewise behaviour?

    Hint: Does the rate stay the same for the whole time?

  6. For f(x)={2xx<3x+4x≥3, a student draws the graph as one connected path. Find and correct the mistake.

    Hint: Compare what the left piece approaches at 3 with f(3).

Want the full set?

50 practice questions for this concept — free to try, every one with a complete worked solution showing the why, not just the answer.

Frequently Asked Questions

How do I solve ∣2x−1∣=5 using pieces?

Split where 2x−12x - 1 changes sign, at x=12x = \frac{1}{2}. To the right, ∣2x−1∣=2x−1|2x - 1| = 2x - 1, so 2x−1=52x - 1 = 5 gives x=3x = 3, which lies in that region. To the left, ∣2x−1∣=1−2x|2x - 1| = 1 - 2x, so 1−2x=51 - 2x = 5 gives x=−2x = -2, which lies in its region too. Both answers stand. Always check that each solution belongs to the piece that produced it, and discard any that lands outside.

Does ∣x∣ have a slope at its corner?

No. To the left of 0, ∣x∣|x| has slope −1-1; to the right, slope 1. At 0 the two sides disagree, so there is no single tangent line and no slope there. The graph is still unbroken, since you can draw it without lifting the pen. A corner is continuous but not smooth, which is why calculus treats the boundaries of piecewise functions as special points to check on their own.

Why are electricity bills often piecewise?

Many utilities charge one price for a first block of electricity and a higher price for use above it, to encourage saving. If the first 500 kWh cost 12 cents each and the rest cost 18 cents, a 700 kWh month costs 500×0.12+200×0.18=60+36=96500 \times 0.12 + 200 \times 0.18 = 60 + 36 = 96, so $96. The bill rises at one rate, then at a steeper rate, with a corner at 500 kWh where the pieces join.

Do the pieces have to cover every real number?

No. The pieces cover whatever the domain is, and the domain can have gaps. A rule defined as x+1x + 1 for x<0x < 0 and x2x^2 for x>0x > 0 simply has no value at 0. What the pieces must not do is overlap with different answers: if one piece says f(2)=4f(2) = 4 and another says f(2)=5f(2) = 5, the rule is not a function. Where two pieces overlap, they must agree.

Learning Path

← Before

Piecewise Function
Piecewise Behavior

You are here

Next →

Absolute Value
Piecewise Function gives you the notation: several formulas, each with its own interval. Piecewise behavior adds the habits that make that notation useful: routing each input to its region, and testing every boundary for a match, a corner or a jump. Next, Absolute Value is the most used piecewise function; its V-shape, equations and inequalities all come from the two pieces x and −x.

See Also