Question: Let $f$ and $g$ be Lebesgue integrable function on $\mathbb{R}^d$. Show that $$\int_{\mathbb{R}^d} (f(x) - g(x))^+ \, dx = \int_{-\infty}^{\infty} |\{g(x) < t < f(x)\}|\, dt.$$
My attempt: Using the identity, $(f-g)^+ = \frac{1}{2}( |f-g| + (f-g) )$, if the following equality of sets $$\{g(x) < t < f(x)\} = \{-\frac{1}{2}|f(x)-g(x)| < t < \frac{1}{2}(f(x)-g(x))\}$$ hold for all $t \in \mathbb{R}$, I am able to directly apply the layer-cake representation. However, I am only able to show the equality of sets holds for all $t\geq0$. Are there any other ways I can solve this problem? Any hints are appreciated.