Let X be a random variable that takes on nonnegative values and has distribution function F(x). Show that
E(X)=∫0∞(1−F(x))dx.
Hint: Integrate by parts.
Illustrate this result by calculating E(X) by this method if X has an exponential distribution F(x)=1−e−λx for x≥0, and F(x)=0 otherwise.