This is a simple question, and I'm sure it was a homework assignment at some point (assuming it's true) but it's one that I'm puzzled over. Suppose I have a compact domain $D \subset \mathbb{R}^n$ with area $1$ and a continuous, bounded function $g(x):D\rightarrow\mathbb{R}$. Let $F(t)$ denote the volume of the subset of $D$ on which $g(x) \leq t$; since the volume of $D$ is $1$ this means that we can think of $F(t)$ as a cumulative distribution function, and we can differentiate this (assuming whatever smoothness properties are necessary) to obtain a pdf $f(t)$. Is it true that

$\iint_D g(x) dA = \int_0^c t f(t) dt $

where $c = \max_{x\in D} g(x)$? In a nutshell, I'm parameterizing the domain $D$ by the level sets of the function $g(x)$, rather than by the points in $D$ themselves. Shouldn't this be true?

If this isn't a MO-level question, then I apologize for spamming.