Ma · Mathematics

What Is the Derivative of an Indicator Function?

Updated 13 October 2026

At a glance

  1. 1. Check local constancy

    An indicator is differentiable at a point only if it is constant in some neighborhood of that point.

  2. 2. Differentiate within regions

    Where the indicator is locally constant, its ordinary derivative is zero.

  3. 3. Check the boundary

    At a jump between zero and one, the ordinary derivative does not exist.

  4. 4. Choose the derivative sense

    For distributional derivatives, represent upward and downward jumps with signed Dirac delta terms.

An indicator function records whether a point belongs to a set: it is 1 on the set and 0 outside it. Its ordinary derivative is simple wherever the function is constant, but it usually fails to exist at the points where the function jumps. If you use distributional derivatives, those jumps are represented by Dirac delta terms.

Ordinary derivative: zero wherever the function is locally constant

For a set A⊆RA \subseteq \mathbb{R}, define its indicator by

1A(x)={1,x∈A,0,x∉A.\mathbf{1}_A(x)= \begin{cases} 1, & x\in A,\\ 0, & x\notin A. \end{cases}

At a point where membership in AA does not change anywhere nearby, the indicator is constant on a neighborhood. Its ordinary derivative is therefore 0.

In fact, this describes all the points where the ordinary derivative exists. If 1A\mathbf{1}_A is differentiable at xx, then it is continuous there. Continuity means that for sufficiently small hh, the value 1A(x+h)\mathbf{1}_A(x+h) must be within, say, 1/21/2 of 1A(x)\mathbf{1}_A(x). Since the only possible values are 0 and 1, the two values must be equal. Thus the indicator is locally constant at xx, and its derivative is 0.

So an indicator function is differentiable at xx exactly when it is constant on some neighborhood of xx. At a boundary point of AA, both points in AA and points outside AA occur arbitrarily close, so the derivative does not exist.

Worked example: an interval indicator

Take f(x)=1[2,5](x)f(x)=\mathbf{1}_{[2,5]}(x). Then

f(x)={0,x<2,1,2≤x≤5,0,x>5.f(x)= \begin{cases} 0, & x<2,\\ 1, & 2\le x\le 5,\\ 0, & x>5. \end{cases}

For x<2x<2, for 2<x<52<x<5, and for x>5x>5, the function is constant in a small neighborhood. Hence f′(x)=0f'(x)=0 at all those points.

At x=2x=2, the function jumps from 0 to 1. For negative hh close to 0,

f(2+h)−f(2)h=0−1h,\frac{f(2+h)-f(2)}{h}=\frac{0-1}{h},

which becomes unbounded as h→0−h\to 0^-. The derivative at 2 does not exist. The same issue occurs at 5, where the function jumps from 1 to 0. Therefore, the classical derivative is 0 for x∉{2,5}x\notin\{2,5\} and undefined at x=2x=2 and x=5x=5.

Whether the interval includes its endpoints does not change this conclusion about jumps. It can change the function’s value at an endpoint, but the two-sided derivative still fails there.

Distributional derivative: jumps become delta terms

A function with jump discontinuities can still have a derivative in the sense of distributions. For a locally integrable function ff, its distributional derivative is defined by how it acts on a smooth, compactly supported test function φ\varphi:

⟨Df,φ⟩=−∫Rf(x)φ′(x) dx.\langle Df,\varphi\rangle=-\int_{\mathbb{R}} f(x)\varphi'(x)\,dx.

For f=1[a,b]f=\mathbf{1}_{[a,b]}, this gives

⟨Df,φ⟩=−∫abφ′(x) dx=φ(a)−φ(b).\begin{aligned} \langle Df,\varphi\rangle &=-\int_a^b \varphi'(x)\,dx\\ &=\varphi(a)-\varphi(b). \end{aligned}

The Dirac delta δc\delta_c acts on a test function by ⟨δc,φ⟩=φ(c)\langle\delta_c,\varphi\rangle=\varphi(c). Therefore,

D1[a,b]=δa−δb.D\mathbf{1}_{[a,b]}=\delta_a-\delta_b.

The positive sign at aa represents the upward jump; the negative sign at bb represents the downward jump. Similarly, the indicator of a half-line has one jump:

D1[a,∞)=δa.D\mathbf{1}_{[a,\infty)}=\delta_a.

This is not an ordinary function derivative. It is a generalized derivative that records the jump. Changing whether an endpoint is included does not affect this distributional derivative, because changing a function at a single point does not change its integrals.

Common mistakes

  • Saying the derivative is zero everywhere: It is zero wherever the indicator is locally constant, but it does not exist at jump points.
  • Treating a delta as an ordinary value: A Dirac delta is a distribution, not a finite derivative value at the jump.
  • Confusing “almost everywhere” with “everywhere”: An interval indicator has derivative zero except at its endpoints, so it is zero almost everywhere. That does not make the classical derivative exist at the endpoints.
  • Applying the usual chain rule across a jump: The standard chain rule requires differentiability; it does not turn a discontinuous indicator into an ordinarily differentiable function at its boundary.

For an indicator of a more complicated set, use the same test: find where the function is locally constant. The ordinary derivative is 0 at those points and fails to exist at boundary points where membership changes arbitrarily close by.

References

  1. Partial Differential Equations, Second Edition — Lawrence C. Evans
  2. Real Analysis: Modern Techniques and Their Applications, Second Edition — Gerald B. Folland

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.