This question already has an answer here:

I was wondering what the derivative is of an indicator function. So we have the function:

$$f(Y, a) = \Bbb1(Y \le a).$$

I am trying to differentiate this function to $a$. Is this equal to $0$?

Thank you


marked as duplicate by caverac, Stefan4024, José Carlos Santos, uniquesolution, Dietrich Burde Dec 3 '17 at 19:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Hey Nina! Welcome to MSE. I've taken the liberty of editing your post to use MathJax (which I highly recommend you learn because it makes it so much easier to read your questions.) Feel free to edit it if you don't like how I've edited it $\endgroup$ – eepperly16 Dec 3 '17 at 10:40

The indicator function $\Bbb 1_{Y\ge a}$ has a jump discontinuity at $a$ since

$$ \lim_{y\to a^-} \Bbb 1_{Y\ge a}(y) = 0 \ne \lim_{y\to a^+} \Bbb 1_{Y\ge a}(y) = 1. $$

So $\Bbb 1_{Y\ge a}$ is not even continuous at $a$, and certainly not differentiable.

If you are a physicist, you might say that the derivative of $\Bbb 1_{Y\ge a}$ is a dirac delta function $\delta(y-a)$, but this is outside of the purview of the analysis taught in most undergraduate classes. The rigorous mathematics of delta functions requires some care.

  • $\begingroup$ Thanks for your answer. But in this paper: arxiv.org/pdf/1707.05108.pdf. They are differentiating equation (6) and they do nothing with the indicator function and report this in equation (30). Is that correct? I am trying to program this in Matlab and I think it is not correct. But I don't know how to solve the problem then. $\endgroup$ – Nina Dec 3 '17 at 10:47
  • $\begingroup$ The derivative of the indicator function exists and equals $0$ everywhere except at $y = a$. Thus, in this paper you cite, I imagine that in the context the author is writing in, they don't need to evaluate the derivative at every point, but almost every point. $\endgroup$ – eepperly16 Dec 3 '17 at 10:54
  • $\begingroup$ It is not uncommon in applications of math for one to ignore points at which the function is not differentiable if there are finitely many. For example, in Machine Learning, when training certain algorithms, the derivative of a certain cost function is not defined at the point $x = 0$. But since its just a single point out of the infinitely many possible points, in applications we don't actually need to care. I imagine your paper is very similar: in your actual Matlab implementation, you can treat the derivative of the indicator function as $0$ in practice $\endgroup$ – eepperly16 Dec 3 '17 at 10:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.