TITLE: Order of integration problem in probability
QUESTION [5 upvotes]: In a problem in my probability course we change the order of integration, and I am having trouble seeing why we can do it this way.
$$\int_0^\infty \int_{\{x : g(x) > t\}} f_X(x)dxdt = \int_{-\infty}^\infty \int_{\{t : 0 \le t < g(x)\}} f_X(x) dt dx.$$
Can anyone enlighten me to why this works. I know how it works with simple examples, but for some reason the $g(x) > t$ is messing with my head.

REPLY [3 votes]: This is a simple application of indicator functions technique and Fubini's theorem 
$$
\begin{align}
\int\limits_0^\infty \int\limits_{\{x : g(x) > t\}} f_X(x)dxdt &= 
\int\limits_0^\infty \int\limits_{-\infty}^\infty f_X(x) 1_{\{(x,t) : g(x) > t\}}dxdt \\
&=\int\limits_{-\infty}^\infty \int\limits_0^\infty  f_X(x) 1_{\{(x,t) : g(x) > t\}}dtdx \\
&=\int\limits_{-\infty}^\infty \int\limits_0^\infty  f_X(x) 1_{\{(x,t) : g(x) > t\geq 0\}}dtdx \\&=\int\limits_{-\infty}^\infty \int\limits_{\{t : 0\leq t < g(x)\geq 0\}}  f_X(x) dtdx 
\end{align}
$$