I have seen this definition of expectation of a nonnegative random variable in many places. I do not quite understand how it is gotten.
$$E[X]=\int_0^{\infty}P(X>t) dt $$
I know $E[X]=\int_0^{\infty}x f(x) dx $
This is used to prove the basic version of markov inequality