Given $F_X(x)=\begin{cases} 0, \text{x<0} \\ \frac{x}{4}, \text{$0 \leqq x <2$} \\ \frac{1}{2}, \text{$1 \leqq x <3$} \\ 1, \text{$3 \leqq x$} \end{cases}$ Compute the mean and variance of X.
$E(X) =\int_{-\infty}^{\infty} x F_X(x) dx + \sum_x x P(X=x)$
Since $F_X(x)= \begin{cases} \frac{1}{4}, \text{0<x<2} \\ 0, elsewhere \end{cases} and P(X=x)=\begin{cases} \frac{1}{2}, \text{x=3} \\ 0, \text{elsewhere} \end{cases}$
$E[X]=\int_0^2 x*\frac{1}{4}dx+3*\frac{1}{2}= 2$
Question: I don't get $P(X=x)=\begin{cases} \frac{1}{2}, \text{x=3} \\ 0, \text{elsewhere} \end{cases}$, how does it arrive at $\frac{1}{2}$?
The cumulative distribution function $F_X(x)$ is right-continuous. That means that
$$P(X=3)=P(X\leq 3)-P(X<3)=F_X(3)-F_X(3^-)=1-\frac12=\frac12$$
Btw, you don´t have to write in the manner of a pdf to express $P(X=x)$. No "elsewhere" etc. is needed.