Let $X$ be a random variable.I want to prove:
$E[x]=\int_{-\infty}^{\infty}{P[X > x]dx}$...(*)
Here is my proof.let $f$ be the PDF(probability density function) of $X$.$\int_{-\infty}^{\infty}{P[X > x]dx}=\int_{-\infty}^{\infty}{(1-\int_{-\infty}^{x}{f(t)dt)}dx}$.For the right hand size,we integral by part.
$\int_{-\infty}^{\infty}{(1-\int_{-\infty}^{x}{f(t)dt)}dx}=(x-x\int_{-\infty}^{x}{f(t)dt})\mid_{-\infty}^{\infty}+\int_{-\infty}^{\infty}xf(x)dx$.Since the first item $(x-x\int_{-\infty}^{x}{f(t)dt})\mid_{-\infty}^{\infty}$ equals zero,we have proved $E[x]=\int_{-\infty}^{\infty}{P[X > x]dx}$.
However I find my proof is $\textbf{WRONG}$ because PDF $f\quad\textbf{May Not be continous}$.How can I handle this case?Is (*) always right,or exists some counterexample?Well I am not good at probability theory,I search for help.