Expectation of non-negative random variable

Let $X$ be a non-negative random variable. In a proof for $E[X]=\int_0^\infty P(X>t)dt$ from the answer of this question, we use Fubini for the middle quality. Why do we need $X$ to be non-negative? We basically have a double integral over a function $f(X,t)$ which is $1$ if $X>t$ and else 0. So this function is non-negative for any $X$ not just for non-negative random variables $X$, thus we could use Fubini regardless. Where is the flaw in my reasoning?

We require $X$ to be non-negative, because otherwise $$X \neq \int_{[0,X)} 1 \ dt, \ \ \mbox{ so in general} \ \ E[X] \neq E \left ( \int_{[0,X)} 1 \ dt \right ).$$

For example, if for some $\omega_0 \in \Omega$ we have that $X(\omega_0) = -5 < 0$, then $[0,X(\omega_0)) = \emptyset$ and $\int_{[0,X(\omega_0))} 1 \ dt = 0 \neq X(\omega_0)$, so we are in trouble if $\mathbb{P} (\omega_0) >0$. Thus, $X$ is required to be non-negative in order for the first equality to hold, not because of the Fubini theorem.

Not that for a non-positive $X$ you get $$E[X] = -E[-X] =- \int_0^{\infty} P (- X > t)\ dt= \int_{-\infty}^0 P (X <s )\ ds.$$

If $x \ge 0$, we can write $x = \int_0^\infty 1_{(t,\infty)}(x) dt$.

Then $E X = \int X d p = \int \int_0^\infty 1_{(t,\infty)}(X) dt d p = \int_0^\infty \int 1_{(t,\infty)}(X) dp dt = \int_0^\infty p \{ \omega|X(\omega)>t\} dt$.

• Yes, this is just the proof given in the question I referenced. My confusion was with us not using the non-negativity for Fubini, but for the first equality.
– fstl
Dec 19 '14 at 21:26

In general, $$\int_0^\infty P(X>t)dt=\int_0^\infty P(\max(X,0)>t)dt=E(\max(X,0)).$$

There is no flaw in the Fubini part. However, the first equality in that proof won't work if you allow $X$ to have negative values.