Allday Education

Piecewise, Step & Absolute Value Functions

A piecewise function uses different rules on different parts of its domain. To evaluate it you first decide which piece your input falls into, then apply that piece's rule.

Step functions and absolute value functions are famous piecewise examples — absolute value is just two lines meeting at a V. The whole skill is choosing the right piece.

Evaluating a piecewise function

Each piece comes with a condition, like x<0x < 0 or x2x \geq 2. Match your input to the condition it satisfies, then plug into that piece only.

The conditions never overlap, so exactly one piece applies to any input. Read the boundaries carefully — \leq versus << decides which piece owns the boundary value.

Absolute value and step functions

Absolute value x|x| is piecewise: it equals xx when x0x \geq 0 and x-x when x<0x < 0, producing the V-shaped graph shown below — the right arm is the line y=xy = x, the left arm the line y=xy = -x.

A step function like the greatest-integer function jumps from one flat level to the next, staying constant on each piece — the source of its staircase look.

-3-2-1123-112345xy

Worked examples

Example 1: choosing the right piece

For f(x)=x2f(x) = x^2 if x<0x < 0 and f(x)=3xf(x) = 3x if x0x \geq 0, find f(2)f(-2).

Is -2 less than 0? Yesuse x2\text{use } x^2
Substitute(2)2(-2)^2
Simplify44

Answer: 44

Example 2: absolute value as pieces

Evaluate 5|{-5}| using the piecewise definition.

-5 is negative, so use -x(5)-(-5)
Simplify55

Answer: 55

Example 3: an input right on the boundary

For f(x)=x2f(x) = x^2 if x<0x < 0 and f(x)=3xf(x) = 3x if x0x \geq 0, find f(0)f(0).

Is 0 less than 0? Nofirst piece does not apply\text{first piece does not apply}
0 satisfies the second condition, so the boundary belongs to that pieceuse 3x\text{use } 3x
Substitute3(0)=03(0) = 0

Answer: 00

Try one yourself

Common questions

How do I pick which piece to use?

Check which condition your input satisfies. The conditions partition the domain, so exactly one piece applies to any given x.

Why is absolute value considered piecewise?

Because it is defined by two rules: xx for non-negative inputs and x-x for negative ones. Those two lines form the V.

What makes a step function 'step'?

It stays constant over each interval and jumps to a new constant at the boundaries, tracing a staircase rather than a smooth curve.

Want the video version?

Allday Everyday Math has video lessons, practice, and an AI tutor for every topic, Pre-Algebra through Algebra 2.

Try it for $1