Analytical "density" of a non-inversible (deterministic) function So the title might be confusing to some. Let me make this clearer:
Formally
Let $f\ :\ x\in(a,b)\ \mapsto\ f(x)$ be a non-inversible function with real scalar values on a finite interval. Let $I_f = f\big((a,b)\big)\subseteq\mathbb{R}$ be the image of this interval by $f$.
Is there an analytical function $g\ :\ I_f\ \mapsto\ [0,1)$ such that:


*

*$\int_{I_f}g(x)\ dx = 1$

*$\forall x\in I_f$, $g(x)$ is proportional to "the size of $\{t\ /\ f(t)=x\}$"?


I would appreciate help:


*

*Finding a clean formulation of this last property if you understand what I mean;

*Answering the actual question;

*Discussing how to extend this "density" definition to the case where $f$ takes multi-dimensional inputs, on possibly infinite intervals, eg. $f\ :\ \mathbb{R}^n\ \mapsto\ \mathbb{R}$.



Hand-wavy Example
Define $f(x) = e^{ -\left(\frac{x-\mu}{\sigma}\right)^2 }$ for $x\in(a,b)$.

I have no idea if this is leads to a correct answer to my question, but intuitively, if the derivative of $f$ is large in absolute value, then it is going to spend "less time" at this point, so the density should be lower where the derivative is large in magnitude.
Following this idea, if I define $g(x) = 1 - \frac{|f^\prime(x)|}{\max_t |f^\prime(t)|}$ and I plot $g(x)$ against $f(x)$, I obtain something that looks like a density to me:

Of course, this works only because $f$ is symmetric in this specific case, otherwise the curve would not look like a well-defined function (there could be several values of $g(x)$ at each corresponding $f(x)$). But you get the idea.
 A: I might try defining the density in a limiting fashion.  We could set
$$
g_\epsilon(t) = \mu\Bigl(\{x : |f(x) - t| < \varepsilon\}\Bigr),
$$
where $g_\epsilon$ is supported on the image of $f$ and $\mu$ is the Lebesgue measure, and
$$
G_\epsilon(t) = \frac{g_\epsilon(t)}{\int_{-\infty}^{\infty} g_\epsilon(s)\,ds},
$$
and hope that
$$
G(t) = \lim_{\epsilon \to 0} G_\epsilon(t)
$$
exists in some sense.

For a concrete example let's consider $f(x) = x^2$ defined on the interval $0 < x < 1$.  Here we have
$$
|x^2 - t| < \epsilon \quad \Longleftrightarrow \quad \sqrt{\max\{0,t-\epsilon\}} < x < \sqrt{\min\{t+\epsilon,1\}},
$$
so
$$
g_\epsilon(t) = \sqrt{\min\{t+\epsilon,1\}} - \sqrt{\max\{0,t-\epsilon\}}.
$$
The integral of $g_\epsilon(t)$ can be calculated explicitly, and it can be shown that
$$
\int_{-\infty}^{\infty} g_\epsilon(s)\,ds = 2\epsilon + O(\epsilon^{3/2})
$$
for small $\epsilon > 0$.  Consequently, for fixed $0 < t < 1$ we have
$$
G(t) = \lim_{\epsilon \to 0} G_\epsilon(t) = \lim_{\epsilon \to 0} \frac{\sqrt{t+\epsilon} - \sqrt{t-\epsilon}}{2\epsilon} = \frac{1}{2\sqrt{t}}.
$$
Intuitively this result seems to align with the desired properties of the density: when $f(x)$ spends a lot of time near $t$, $G(t)$ is large, and when $f(x)$ spends less time near $t$, $G(t)$ is small.
