Derivative of the measure of the set where $f > t$ Let $f$ be a continuous function on a topological measure space $(X,\mu)$. Define $g(t) = \mu\{f \geq t\}$ for $t\in \mathbb R$. I am interested in the derivative of $g$. Is there a simple expression for it? What conditions on $f$ will ensure that it exists almost everywhere? What about everywhere?
 A: Perhaps the right question to ask is whether $g$ is absolutely continuous; this is equivalent to $g$ being almost everywhere diferentiable and equal to the integral of its derivative (i.e. the fundamental theorem of calculus holds).  
(For a function which is not absolutely continuous, the derivative, even if it exists, is generally not very useful.  For an example with this property, take $X$ to be the Cantor set and $\mu$ the Cantor measure, and $f : X \to \mathbb{R}$ the inclusion function.  Then $g$ is the Cantor function, which is a.e. differentiable but whose derivative is zero.  You can't learn very much about this function from its derivative.)
In your setting, the function $g$ is absolutely continuous if and only if the push-forward measure $\mu \circ f^{-1}$ on $\mathbb{R}$ is absolutely continuous with respect to Lebesgue measure; that is, if for any $A \subset \mathbb{R}$ which has Lebesgue measure zero, we have $\mu(f^{-1}(A))=0$.  (See Wikipedia for references.)
Conditions on $f$ for this to hold can be a bit tricky and will probably require more structure.  For example, in the case where $X = \mathbb{R}^n$ and $\mu$ is a nice smooth measure (e.g. Gaussian measure), a typical condition for $g$ to be absolutely continuous is that $f$ be (weakly) differentiable and $\nabla f \ne 0$ $\mu$-almost everywhere.  (If $X$ is a Banach space and $\mu$ is a Gaussian measure, one can get the same result by means of the Malliavin calculus.)  Is there a particular setting you have in mind?
Edit: You ask about a formula for $g'$.  Let's suppose $X = \mathbb{R}^d$ and $\mu$ is absolutely continuous to Lebesgue measure with $C^1$ density  $p$ (i.e. $d\mu = p dm$).  Also suppose $f$ is, say, $C^1$.  Then, at least formally, we have
$$g'(t) = \int_{\{f > t\}} \left(\nabla \cdot \left(\frac{\nabla f}{|\nabla f|^2}\right) + \frac{\nabla f \cdot \nabla p}{|\nabla f|^2 p}\right)\,d\mu.$$
Proof sketch.  Let $\psi(t) = 1_{[a,b)}(t)$, so $\int_X \psi(f)\,d\mu = g(a) - g(b)$.  Set $\phi(s) = \int_{a}^s \psi(t)\,dt = \int_a^b 1_{\{s > t\}}\,dt$ so that $\phi' = \psi$, and note by the chain rule that $\nabla \phi(f) = \psi(f) \nabla f$.  We thus have
$$\psi(f) = \nabla \phi(f) \cdot \frac{\nabla f}{|\nabla f|^2}$$
and so
$$\begin{align*}
g(a) - g(b) &= \int_X \nabla \phi(f) \cdot \frac{\nabla f}{|\nabla f|^2}\,d\mu \\
&= \int_X \nabla \phi(f) \cdot \frac{\nabla f}{|\nabla f|^2}p \,dm \\
&= -\int_X \phi(f) \left(p \nabla \cdot \left(\frac{\nabla f}{|\nabla f|^2}\right) + \nabla p \cdot \frac{\nabla f}{|\nabla f|^2}\right)\,dm \\
&= -\int_X \phi(f) \left(\nabla \cdot \left(\frac{\nabla f}{|\nabla f|^2}\right) + \frac{\nabla p \cdot \nabla f}{|\nabla f|^2 p}\right)\,d\mu \end{align*}$$
where in the third line we used integration by parts.
If we write $h =   \left(\nabla \cdot \left(\frac{\nabla f}{|\nabla f|^2}\right) + \frac{\nabla p \cdot \nabla f}{|\nabla f|^2 p}\right)$ for short, we have
$$\begin{align*} g(a) - g(b) &= -\int_X \phi(f) h\,d\mu \\
&= -\int_X \int_a^b 1_{\{f > t\}}\,dt\, h\,d\mu \\
&= -\int_a^b \int_X 1_{\{f > t\}} h \,d\mu\,dt  \end{align*}$$
by Fubini's theorem.  Now thanks to the fundamental theorem of calculus we are done.
Of course, one needs to check integrability conditions in several places to make this a real proof, but it does suggest that an essential feature will be that $|\nabla f|$ does not get too close to 0.  I don't know whether this is the kind of formula you are looking for; as I said it suggests that you will need more structure than just a topological measure space.
I took this proof from D. Nualart, The Malliavin Calculus and Related Topics, Proposition 2.1.1.  (There it is in the context of Gaussian measure in infinite dimensions, but the idea is the same.)
A: Let $T=\inf\{t\ge0:g(t)<+\infty\}$. Then $g$ is decreasing on $(T,+\infty)$, so that it is almost everywhere differentiable on that interval (see for instance Theorem 14 in this post on Terry Tao's blog.) Observe that continuity is not needed.
As for everywhere differentiability, my impression is that it is a more difficult question.
