Question about the derivative of a Heaviside function of a function, $\theta(f(x))$ It seems to me that the derivative of the Heaviside function with a function as its argument should be via the chain rule:
$$\theta_{x}(f(x))=\delta(f(x))f_{x}(x) $$
But there is also the Delta distribution identity:
$$\delta\big(f(x)\big) = \sum_{i}\frac{\delta(x-a_{i})}{\left|{f_{x}(a_{i})}\right|}$$
Where $a_{i}$ are the roots of the function f(x). This leads to the following equation:
$$\theta_{x}(f(x))=\sum_{i}\frac{\delta(x-a_{i})}{\left|{f_{x}(a_{i})}\right|}f_{x}(x)$$
which I do not understand. It does not seem to have a reasonable interpretation. 
My question is:  what is the derivative of a Heaviside function with a function as its argument?
 A: Note, $f(x) \, \delta(x-a) = f(a) \, \delta(x-a)$, so
$$
\theta_{x} (f(x))
= \sum_{i} \frac{\delta(x-a_{i})}{\left|{f_{x}(a_{i})}\right|}f_{x}(x)
= \sum_{i} \frac{\delta(x-a_{i})}{\left|{f_{x}(a_{i})}\right|}f_{x}(a)
= \sum_{i} \frac{f_{x}(a)}{\left|{f_{x}(a_{i})}\right|}\delta(x-a_{i}) \\
= \sum_{i} \operatorname{sign}(f_{x}(a_{i})) \, \delta(x-a_{i})
$$

Going to the definitions:
By definition,
$$
\left\langle \frac{d}{dx} \theta(f(x)), \phi(x) \right\rangle
= - \langle \theta(f(x)), \phi'(x) \rangle
= - \int \theta(f(x)) \, \phi'(x) \, dx
= - \int_{\{x \mid f(x)>0\}} \phi'(x) \, dx
.
$$
Now assume that $f>0$ on the nonoverlapping intervals $(a_i, b_i)$. Then we have
$$
-\int_{\{x \mid f(x)>0\}} \phi'(x) \, dx
= -\int_{\bigcup_i (a_i,b_i)} \phi'(x) \, dx
= -\sum_i \int_{(a_i,b_i)} \phi'(x) \, dx
= -\sum_i \left( \phi(b_i) - \phi(a_i) \right) \\
= -\sum_i \left( \langle \delta(x-b_i), \phi(x) \rangle - \langle \delta(x-a_i), \phi(x) \rangle \right)
= \langle \sum_i \delta(x-a_i) - \sum_i \delta(x-b_i), \phi(x) \rangle
.
$$
Thus,
$$
\frac{d}{dx} \theta(f(x))
= \sum_i \delta(x-a_i) - \sum_i \delta(x-b_i).
$$
Note that if $f$ is differentiable, and thus continuous, then $a_i$ and $b_i$ are zeroes of $f$, and if $f_x \neq 0$ at $a_i$ and $b_i$ then $f_x(a_i) > 0$ and $f_x(b_i) < 0$, so $\operatorname{sign}(f_x(a_i)) = +1$ and $\operatorname{sign}(f_x(b_i)) = -1$.
Thus,
$$
\frac{d}{dx} \theta(f(x))
= \sum_{c_i = a_i, b_i} \operatorname{sign}(f_x(c_i)) \, \delta(x-c_i)
$$
in accordence with the equation at the top.
