Let $L$ and $R$ be randomly chosen interval endpoints having an arbitrary join distribution but of course $L \leq R$.
Let $p(x)=Pr\{L \leq x \leq R\}$ be the probability the interval covers the point $x$, and let $X=R-L$ be the length of the interval.
How Can I establish the formula $E[X]=\int_{-\infty}^{\infty} p(x)dx$ ?
Could someone help me with this problem please, I´m really stuck, I can not solve it.
Thank you for your help and time.
Use the definition of expectation:
$$\begin{align}\mathsf E(X) &= \mathsf E(R-L) \\[1ex] & = \mathop{\iint}_{-\infty<L(\omega)\leqslant R(\omega)<\infty} (R(\omega)-L(\omega))~\mathsf d\mathsf P(\omega)\end{align}$$
Now substitute $\displaystyle(R(\omega)-L(\omega))=\int_{L(\omega)\leqslant x\leqslant R(\omega)} \mathsf d x$ , use Fubbini's theorem to change the order of integration, and look what the inner integral becomes!