Trying to do this (sorry for the formatting)
$X$ is a random variable with this cdf:
$$ F_X(x) = \left\{ \begin{array}{ll} 0 & \quad x<-3 \\ \frac{1}{6}x+\frac{1}{2} & \quad -3\le x<0 \\ \frac{1}{2} & \quad 0\le x<1 \\ 1-\frac{1}{2}e^{-x+1} & \quad x\ge 1. \end{array} \right. $$
Find $E(X)$
I've tried it in two different ways and I keep getting $0$ as answer, but apparently that's wrong. I tried doing this for instance: $$(-3)\left(\frac{1}{6}(-3) + \frac{1}{2}\right) + 1\left(\left(1-\frac{1}{2}e^{-1+1}\right)-\frac{1}{2}\right) $$
I would use the probability density function, $f(x)$, to calculate the expectation using $$ E(x) = \int x f(x) dx $$
We can get $f(x)$ from the cumulative density function by differentiating in each region: $$ f(x) = \left\{ \begin{array}{ll} 0 & \quad x<-3 \\ \frac{1}{6} & \quad -3\le x<0 \\ 0 & \quad 0\le x<1 \\ \frac{1}{2}e^{-x+1} & \quad x\ge 1. \end{array} \right. $$
Note that $$ \int_{-\infty}^{\infty}f(x)dx = 1$$ as required.
Then, we plug $f(x)$ into the equation for $E(x)$ and compute the integral piecewise: $$ E(x) = \int_{-\infty}^{-3} x \cdot 0 dx + \int_{-3}^0 x\cdot \frac{1}{6} dx + \int_{0}^{1} x \cdot 0 dx + \int_{1}^{\infty} x \cdot \frac{1}{2}\exp(1-x)dx$$
Simplifying, we obtain $$ E(x) = \left[\frac{x^2}{12}\right]_{-3}^{0} - \left[\frac{(x+1)}{2}\cdot \exp(1-x)\right]_{1}^{\infty} $$ which gives $$ E(x)= -\frac{3}{4} + 1 = \frac{1}{4} $$