Let $X$ be a continuous non-negative random variable on $(0,a)$. Prove that $$E(X) = \int_{0}^{a} (1-F_X(x))\,dx$$ where $F_X(x)$ is the CDF for $X$.
I know that by definition: $$F_X(x) = P(X \leq x) => 1 - F_X(x) = P(X>x)$$ So i can easily go to the next step. But what should I do in this case?
$$ \mathbb{P}(0 < X < a) = \int_0^a f_X(x)dx $$
Thank you