Piecewise-Defined Functions

A piecewise-defined function uses different formulas on different parts of its domain. These functions appear throughout calculus as examples and counterexamples, especially in discussions of continuity and differentiability where the behavior at the boundary between pieces is the key question.

Example Description
< / t d >< t d > x < / t d >< / t r >< t r >< t d > \lfloor x \rfloor$ Floor (greatest integer) function

What Is a Piecewise-Defined Function?

A piecewise-defined function is a function whose formula changes depending on which part of the domain the input belongs to. The general form is:

f(x) = \begin{cases} \text{formula 1} & \text{if } x \in \text{region 1} \\ \text{formula 2} & \text{if } x \in \text{region 2} \\ \vdots & \vdots \end{cases}

You have already seen the most famous example: the absolute value function

|x| = \begin{cases} x & \text{if } x \ge 0 \\ -x & \text{if } x < 0 \end{cases}

The Floor Function

The floor function (also called the greatest integer function) assigns to each real number $x$ the largest integer that is less than or equal to $x$. It is denoted $\lfloor x \rfloor$.

For example:

  • $\lfloor 2.7 \rfloor = 2 < / l i >< l i > \lfloor 3 \rfloor = 3 < / l i >< l i > \lfloor -1.2 \rfloor = -2 ( n o t -1$, because $-2 \le -1.2$ while $-1 > -1.2 ) < / l i >< l i > \lfloor 0.9 \rfloor = 0$

The graph of $y = \lfloor x \rfloor$ is a staircase: it is constant on each interval $[n, n+1)$ for integer $n$, with a jump discontinuity at each integer. This makes it a standard example for studying discontinuities in calculus.

Evaluating Piecewise Functions

To evaluate a piecewise function at a given input, first determine which piece's condition the input satisfies, then apply that piece's formula.

Let $f(x) = \begin{cases} x^2 + 1 & \text{if } x < 0 \\ 2x - 1 & \text{if } x \ge 0 \end{cases}$. Find $f(-3)$, $f(0) , a n d f(4)$.

Solution
  • $f(-3)$: Since $-3 < 0$, use the first piece: $f(-3) = (-3)^2 + 1 = 9 + 1 = 10 . < / l i >< l i > f(0)$: Since $0 \ge 0$, use the second piece: $f(0) = 2(0) - 1 = -1 . < / l i >< l i > f(4)$: Since $4 \ge 0$, use the second piece: $f(4) = 2(4) - 1 = 7$.

Continuity at the Boundary

One of the most common questions about a piecewise function is whether it is continuous at the boundary point where the formula changes. A piecewise function is continuous at the boundary $x = c$ when the two pieces agree at that point (give the same value). If they disagree, there is a jump discontinuity.

In the example above, the two pieces give $f(0) = 0^2 + 1 = 1$ (from the left piece) and $f(0) = 2(0)-1 = -1$ (from the right piece). Since $1 \ne -1$, the function is discontinuous at $x = 0$.

Frequently Asked Questions

Can a piecewise function be differentiable? Yes, but it requires both continuity at the boundary and equal slopes from the left and right. If the two pieces meet smoothly (same value and same tangent slope at the junction), the function is differentiable there. If they meet with different slopes, there is a corner and the derivative does not exist at that point.

What is the ceiling function? The **ceiling function** $\lceil x \rceil$ is the smallest integer greater than or equal to $x$. It is the companion of the floor function. For example, $\lceil 2.3 \rceil = 3 a n d \lceil 4 \rceil = 4$. The ceiling function is less common in calculus but appears in combinatorics and computer science.

Why do piecewise functions matter in real applications? Many real-world quantities are governed by different rules in different regimes: tax brackets (different rates for different income ranges), shipping costs (flat rate up to a weight, then per-pound), physical laws that change at a phase transition. In mathematics, piecewise functions also serve as important examples and counterexamples for testing intuitions about continuity and differentiability.