Piecewise Behavior Examples: 46 Problems with Answers

Worked examples of Piecewise Behavior to try before you open each solution, then practice problems with answers.

Worked Examples

Example 1

easy
Write ∣x∣ as an explicit piecewise function, evaluate ∣−4∣, ∣0∣, and ∣7∣, and sketch its graph.
Show solution

Answer

∣−4∣=4, ∣0∣=0, ∣7∣=7; V-shaped graph with vertex at origin

First step

1.
Definition: ∣x∣={xif x≥0−xif x<0.

Full solution

  1. 2.
    Evaluate: ∣−4∣=−(−4)=4; ∣0∣=0; ∣7∣=7.
  2. 3.
    Graph: two rays meeting at the origin (0,0), slope −1 for x<0 and slope +1 for x≥0, forming a 'V' shape.
The absolute value function is the simplest and most important piecewise function. It measures distance from zero, always returning a non-negative value. Its V-shape has slope ±1 and vertex at the origin.

Example 2

medium
Solve the equation ∣2x−5∣=7 and the inequality ∣2x−5∣<7.

Example 3

medium
Solve ∣3x−6∣=9.

Example 4

medium
Solve ∣x+2∣≤4 and express as an interval.

Example 5

hard
Express f(x)=∣x2−1∣ as a piecewise function.

Example 6

hard
Find constants a and b so that f(x)={x2x<2ax+bx≥2 is BOTH continuous AND has a matching slope at x=2.

Example 7

challenge
Express f(x)=max⁡(x,3−x) as a piecewise function and find its minimum.

Practice Problems

Try each one, then open the solution to compare your method.

Example 1

easy
Simplify ∣x−3∣+∣x+1∣ for x=−2, x=1, and x=5.

Example 2

hard
Express f(x)=∣x2−4∣ as a piecewise function (without absolute value bars) and identify where f(x)=0.

Example 3

easy
For f(x)={xx<02xx≥0, find f(−3).

Example 4

easy
For the same f, find f(4).

Example 5

easy
Which piece applies to x=0 in f(x)={1x<05x≥0?

Example 6

easy
Does a piecewise function have to be continuous?

Example 7

easy
How many rules does a 3-piece function use?

Example 8

easy
For f(x)={x2x<2x+1x≥2, find f(1).

Example 9

easy
For the same f, find f(2).

Example 10

easy
Does each region of a piecewise function need the same kind of formula?

Example 11

medium
Is f(x)={x+1x<12xx≥1 continuous at x=1?

Example 12

medium
Is f(x)={x+1x<12x+3x≥1 continuous at x=1?

Example 13

medium
For f(x)={−xx<0xx≥0, simplify f(x).

Example 14

medium
Evaluate f(−2)+f(3) for f(x)={x2x<02x−1x≥0.

Example 15

medium
A function is f(x)=x2 for x≤1 and a line for x>1. If the line continues the value smoothly with f(1)=1, what is f(1)?

Example 16

medium
For f(x)={3x<2x+1x≥2, on which region is f constant?

Example 17

medium
For f(x)={2xx<3x2x≥3, is the rate constant on x<3?

Example 18

medium
Find the domain region where f(x)={1/xx<0xx≥0 uses x.

Example 19

challenge
Choose a so that f(x)={ax+1x<2x2x≥2 is continuous at x=2.

Example 20

challenge
For f(x)={x+kx<13xx≥1, find k making it continuous, then compute f(0).

Example 21

challenge
A piecewise function is x2 for x<0, 0 for 0≤x≤1, and x−1 for x>1. Where is it NOT continuous?

Example 22

medium
For f(x)={2x<0x2x≥0, find f(−5)+f(2).

Example 23

easy
Evaluate ∣x−2∣ at x=5.

Example 24

easy
Evaluate ∣x−2∣ at x=−1.

Example 25

easy
Write ∣2x+1∣ as a piecewise function (no absolute value).

Example 26

easy
For f(x)={x+1x<32xx≥3, find f(3).

Example 27

easy
Find ∣x∣+∣x−3∣ when x=1.

Example 28

medium
For f(x)={1−xx<0x20≤x≤23x>2, compute f(−1)+f(2)+f(5).

Example 29

medium
Is f(x)={x2x<12x−1x≥1 continuous at x=1?

Example 30

medium
Find a so that f(x)={ax2x<12x+1x≥1 is continuous at x=1.

Example 31

medium
Find ⌊−2.5⌋ (floor of −2.5).

Example 32

medium
Express f(x)=∣x∣+x as a piecewise function.

Example 33

medium
For what x does ∣x−4∣ equal ∣x∣?

Example 34

hard
For f(x)=∣x∣+∣x−4∣, find the MINIMUM value of f and where it occurs.

Example 35

hard
For f(x)={2x+1x<0x2+1x≥0, sketch its key features and identify any jump at x=0.

Example 36

hard
Solve ∣x−1∣=2x−5 (be careful — check both branches and the validity).

Example 37

hard
Sketch the rate of change of f(x)=∣x−3∣. Where is the rate +1, and where is it −1?

Example 38

challenge
For f(x)=⌊x⌋, find all x where f(x)=2.

Example 39

challenge
Solve ∣x∣+∣x−2∣=6.

What to focus on

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

Common stuck point: The procedure for piecewise behavior is the easy part; the trap is assuming continuity for free. Asking "Does the function switch to a different rule depending on which region of the domain the input is in?" first is what keeps a correct-looking calculation from being attached to the wrong concept.

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

Concept recap

Piecewise behavior refers to a function that exhibits qualitatively different characteristics in different regions of its domain, like having a different slope or curvature in each region.

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.

Read the full lesson on Piecewise Behavior

Piecewise Behavior is covered with related ideas in the guide Rational Functions: Definition, Graphs, Asymptotes, and Applications.

Background knowledge

These ideas may be useful before you work through the harder examples.

piecewise function