# How to find Expected Value of a non-continuous distribution?

Problem Statement :

The Pacific Transit #1 bus I take to campus is sometimes early and usually late. I model the time the bus leaves my stop using a random variable $X$ representing the difference (in minutes) between the time the bus actually leaves minus its scheduled time. A positive $X$ means the bus is late, a negative $X$ means the bus is early, and $X = 0$ means the bus is on time. $X$ may or may not be a whole number.

The CDF of $X$ is

$$F(y) =\begin{cases} 0,& y<-4\\ \frac15+\frac1{20}y,& -4\leqslant y<0\\ \frac25+\frac1{20}y,& 0\leqslant y<12\\ 1,&y\geqslant 12. \end{cases}$$

From the CDF we can see that it's noncontinuous because of the jump at $x = 0$ from $0.2$ to $0.4$.

How can I find the Expected value of $X$?

$E(X)\text{ ?}$

\begin{align} \mathbb E[X] &= \mathbb E(X\cdot\mathbf 1_{X<0})+\mathbb E(X\cdot\mathbf 1_{X=0})+\mathbb E(X\cdot\mathbf 1_{X>0}) \\[1ex]&= \int_{-\infty}^0 -F(x)\,\mathsf dx + 0 +\int_0^\infty (1-F(x)\,\mathsf dx\\[1ex] &= \int_{-4}^0-\left(\frac15+\frac1{20}x\right)\,\mathsf dx + \int_0^{12} \left(1-\left(\frac25+\frac1{20}x\right)\right)\,\mathsf dx\\[1ex] &= \int_{-4}^0\left(-\frac15 -\frac1{20}x\right)\,\mathsf dx + \int_0^{12} \left(\frac35 - \frac1{20}x\right) \\[1ex] &= \left[-\frac15x-\frac1{40}x^2 \right]_{-4}^0 + \left[\frac35x - \frac1{40}x^2 \right]_0^{12}\\[1ex] &= -\frac45 + \frac25 + \frac{36}5 - \frac{18}5\\[1ex] &= \frac{16}5. \end{align}

• Thanks for the explanation!! – Utkarsh Oct 1 '16 at 5:16