Resources For Teachers For Tutors For Students & Parents Pricing
Pre-Calculus Functions (advanced)

Piecewise and step functions (advanced graphing)

20 practice questions 0 video lessons Theory + worked examples

Piecewise and Step Functions

Texas Precalculus (TEKS) • Standard P.2(F) • Functions

Piecewise and Step Functions is a topic in Functions in the Texas Essential Knowledge and Skills (Precalculus, §111.42). It is aligned to Standard P.2(F), which requires students to graph piecewise functions.

A piecewise function is defined by different rules on different intervals; a step function, such as the floor \(\lfloor x\rfloor\), is a special piecewise function that jumps between constant values.

Texas Precalculus (TEKS) › Functions › Piecewise and Step Functions  —  Standard P.2(F)

Create a free accountTrack your progress and save your work as you go.
Create free account

Theory

A piecewise function is defined by different rules on different parts of its domain, written with a brace:

\[f(x)=\begin{cases}\text{rule 1},&\text{on interval 1}\\[2pt]\text{rule 2},&\text{on interval 2}\end{cases}\]

To evaluate, pick the single branch whose condition the input satisfies.

A step function is a special piecewise function that is constant on each interval and jumps between values. The most important is the floor (greatest integer) function \(\lfloor x\rfloor\), the greatest integer \(\le x\).

Open vs closed dots: a closed dot means the endpoint is included (that branch's \(\le\) or \(\ge\)); an open dot means it is excluded. Exactly one branch owns each boundary point.
Graph of a two-piece piecewise function A piecewise function equal to negative 1 for x below 0 and x plus 1 for x at least 0, with an open dot where the branch is excluded and a closed dot where it is included. x y y=−1 y=x+1
A two-piece function: \(y=-1\) for \(x<0\) (open at \((0,-1)\)) and \(y=x+1\) for \(x\ge 0\) (closed at \((0,1)\)).
Graph of the floor step function The floor function is constant on each unit interval and jumps up by 1 at every integer, drawn as steps with closed left endpoints and open right endpoints. x y y=⌊x⌋
The floor function \(y=\lfloor x\rfloor\): steps that jump up by 1 at each integer.

Piecewise notation and the floor function:

\[|x|=\begin{cases}x,&x\ge 0\\ -x,&x<0\end{cases}\qquad \lfloor x\rfloor=\text{greatest integer}\le x\]
absolute value of x is x for x nonnegative and negative x otherwise; floor of x is the greatest integer at most x
Each input uses one branch. The conditions must not overlap; together they must cover the whole domain.

How to work with a piecewise function

  1. To evaluate: check which condition the input meets, then use only that branch's rule.
  2. To graph: draw each branch only over its interval.
  3. Mark endpoints: closed dot where the branch includes the boundary, open dot where it doesn't.
  4. Check coverage: every \(x\) in the domain should satisfy exactly one condition.
Example 1 — Evaluate a piecewise function
For \(f(x)=\begin{cases}-1,&x<0\\ x+1,&x\ge 0\end{cases}\), find \(f(-3)\) and \(f(2)\).
Solution

Choose the branch whose condition the input satisfies.

\(-3<0\Rightarrow f(-3)\)\(=\)\(-1\)
\(2\ge 0\Rightarrow f(2)\)\(=\)\(2+1=3\)
f of negative 3 is negative 1; f of 2 is 3
Example 2 — Value at the boundary
Using the same \(f\), find \(f(0)\).
Solution

The boundary \(x=0\) belongs to the branch whose condition includes it. Here \(x\ge 0\) uses \(x+1\).

\(f(0)\)\(=\)\(0+1=1\)

On the graph this is the closed dot at \((0,1)\); the other branch has an open dot at \((0,-1)\).

f of 0 equals 1, the closed endpoint
Example 3 — The floor function
Evaluate \(\lfloor 2.7\rfloor\) and \(\lfloor -1.3\rfloor\).
Solution

The floor \(\lfloor x\rfloor\) is the greatest integer that is \(\le x\).

\(\lfloor 2.7\rfloor\)\(=\)\(2\)
\(\lfloor -1.3\rfloor\)\(=\)\(-2\)

For \(-1.3\), the largest integer not exceeding it is \(-2\), not \(-1\) — watch the negatives.

floor of 2.7 is 2; floor of negative 1.3 is negative 2
Example 4 — Absolute value as a piecewise function
Write \(f(x)=|x|\) as a piecewise function.
Solution

Absolute value leaves nonnegative inputs alone and negates negative inputs.

\[|x|=\begin{cases}x,&x\ge 0\\ -x,&x<0\end{cases}\]

Both pieces are lines that meet at the origin, giving the familiar V shape.

absolute value equals x for x nonnegative and negative x for x negative

Common pitfalls

Boundary belongs to one branch. Use the branch whose inequality includes the endpoint (\(\le\) or \(\ge\)); the other gets an open dot.
Floor of a negative rounds down, not toward zero. \(\lfloor -1.3\rfloor=-2\), not \(-1\).
Don't blend the branches. Only one rule applies at each input; never average or add them.

Frequently asked questions

What is a piecewise function?

A function defined by different rules on different parts of its domain. You evaluate it by using the branch whose condition the input satisfies.

How do you evaluate a piecewise function?

Find which interval the input falls in, then apply only that branch's formula.

What is the floor (greatest integer) function?

\(\lfloor x\rfloor\) is the greatest integer less than or equal to \(x\). For example \(\lfloor 2.7\rfloor=2\) and \(\lfloor -1.3\rfloor=-2\).

When do you use an open versus a closed dot?

Closed when the endpoint is included in that branch (\(\le\) or \(\ge\)); open when it is excluded (\(<\) or \(>\)).