How to calculate this expected value How do you calculate this expected value? I have tried everything and I cant seem to get the right answer. The distribution function of a random variable $X$ is given by: $$F(X)=\begin {cases} 0& x\lt -3 \\ \frac38 &-3 \le x \lt 0 \\ \frac12 & 0 \le x \lt 3 \\ \frac34 & 3 \le x \lt 4 \\ 1 & x \ge 4\end {cases}$$
I hope this makes sense, in my practice book it has it all lined up nice and neat if it helps to think of it that way. I know that $E(X)=\frac58$ but I'm just not sure how thats the answer.
 A: Note that the function $F$ is the cumulative distribution function of $X$. The usual notation is $F(x)$, or $F_X(x)$ if we want to be reminded of whch random variable we are working with. Very importantly, it should never be written $F(X)$.  
By definition, 
$$F_X(x)=\Pr(X\le x).$$
With continuous random variables, we can be pretty casual about the use of inequality symbols. With discrete random variables, we have to be much more careful, and cannot casually replace $\le $ by $\lt$.
Look at the first part of the specification of $F$. It tells us, among other things, that $F(-17)=0$. So $\Pr(X\le -17)=0$: there is no "weight" at $-17$ or to the left of it.  We also have $F(-\pi)=0$: so $\Pr(X\le -\pi)=0$. 
There is a sudden jump in the cumulative distribution function at $-3$. A tiny bit to the left of $-3$, it was $0$. But all of a sudden, at $-3$, $F$ has value $\dfrac{3}{8}$. The jump at $-3$ means that we must have $\Pr(X=-3)=\dfrac{3}{8}$. 
Then things are steady until $0$, the cumulative distribution function is $\dfrac{3}{8}$ at $-2$, $-1$, $-0.2$. So $\Pr(X\le -0.2)=\dfrac{3}{8}$, no weight has been added. But at $x=0$, the cdf jumps to $\dfrac{1}{2}$. So $\Pr(X=0)=\dfrac{1}{2}-\dfrac{3}{8}=\dfrac{1}{8}$. 
Similarly, $\Pr(X=3)=\dfrac{3}{4}-\dfrac{1}{2}=\dfrac{1}{4}$. similarly, $\Pr(X=4)=\dfrac{1}{4}$.
Now we are at a simple expected value problem.
$$E(X)=(-3)\frac{3}{8}+(0)\frac{1}{8}+(3)\frac{1}{4}+(4)\frac{1}{4}=\frac{5}{8}.$$
Remark: For a non-negative integer-valued random variable $Y$, there is a useful way to compute $E(Y)$:
$$E(Y)=\sum_{i=1}^\infty \Pr(Y\ge i).$$
We can adapt this to our problem by adding $3$ to $X$, computing the expectation by using the above formula, and subtracting $3$ at the end. One needs to be careful in using the cdf to calculate $\Pr(X\ge i)$.   
There is a useful analogue of the above formula for non-negative random variables with continuous distribution. For some details, please look at this. 
