TITLE: derivative of indicator function
QUESTION [7 upvotes]: I have an indicator function $I(D\leq Q)$which is equal to $1$ if $D\leq Q$ and $0$ otherwise. What would be derivative of this function with respect to different variables such as $D$ or $Q$ or $P$ ($D$ is a function of $P$). 
Clarification to what I am trying to do:

$D$ represents demand which is a function of price, assume $D=a-bp$
$Q$ represents quantity or supply, which is assumed to be fixed

$$\text{profit} = p\min(D,Q)= PDI(D\lt Q)+PQI(Q\leq D)$$
I want to take derivative of profit with respect to price.
Thanks in advance

REPLY [11 votes]: The derivative in the usual sense does not exist at a discontinuity, and is $0$ everywhere else.  If you're talking about a derivative in the sense of distributions, $\dfrac{\partial}{\partial D} I(D \le Q) = -\delta(D-Q)$.