I would love some help with this problem:
Let $(X,\mathcal F,\mu)$ be a measurable space and let $f:X\to[0,\infty)$ be a positive Lebesgue integrable function. Prove that $$\int_X fd\mu = \int_0^\infty \mu(\{x\in X : f(x) > \lambda\})d\lambda.$$
I understand why this works geometrically in two dimensions but am not really sure how to go about showing this formally. I believe a good method would be to show the equality for step functions and then somehow generalize, but I'm not sure exactly how to do this either.
I'd appreciate any help.
Thanks!
You can write $$ f(x) = \int_0^{f(x)} \, dt = \int_0^{\infty} 1_{ \{y: f(y)>t \} }(x) \, dt, \tag{1} $$ because $1_{ \{y: f(y)>t \} }(x)$ is $1$ for $t$ between $0$ and $f(x)$ and $0$ otherwise. Now, you use Tonelli's theorem, which says that
In this case, take $Y=[0,\infty)$, $\nu$ normal Lebesgue measure, and then you have $$ \int_X f(x) \, d\mu(x) = \int_X \left( \int_0^{\infty} 1_{ \{y: f(y)>t \} }(x) \, dt \right) \, d\mu(x) \\ = \int_0^{\infty} \left( \int_X 1_{ \{y: f(y)>t \} }(x) \, d\mu(x) \right) \, dt \\ = \int_0^{\infty} \mu\{ y:f(y)>t\} \, dt, $$ using the equality (1), then Tonelli, and lastly the definition of the integral of a characteristic function.