finding median with cumulative distribution function (absolute value) I am currently working on distribution with density function
$$f(x)=\begin{cases} \frac{2}{5}|x-2|,& \text{0 ≤ x ≤ 3} \\\\0 & \text{otherwise}\end{cases}$$
I have found that cumulative distribution function of $F(X)$ for $2 ≤ x ≤ 3$ which is $\frac{1}{5}x^2-\frac{4}{5}x + \frac{8}{5}$ and $F(X)$ for $0≤x≤2$ is $\frac{4x-x^2}{5}$.
I know that to find median you have to set 
$$\int_{-\infty}^x f(x)\,dx= 0.5.$$
But what $f(x)$ do I use to find the median of the probability distribution of $X$.
Also how do I find $E(X)$ for this distribution?
Do I just use integral of $xf(x)$? and what $f(x)$ should I use?
I just cannot find any distribution with absolute value thanks!
 A: Did you graph $f_X(x)$? It should be clear that the median is in the interval $[0,2]$. Hence you could do
$$\int_0^c \frac{2}{5}(-x+2)\,dx = .5$$
from the outset, or, since you found $F_X(x)$, use
$$F_X(c) = .5$$
to find $c$, the median.
The expectation can be found from the usual
$$E[X] = \int_0^3 f_X(x)\,dx$$
or you could use the tail sum 
$$E[X] = \int_0^31-F_X(x)\,dx.$$
Of course, there are cases.
A: A number $m$ is a median of $X$ if $\mathbb P(X\leqslant m)\geqslant\frac12$ and $\mathbb P(X\geqslant m)\leqslant\frac12$. The density of $X$ is
$$f(x) = \frac25(2-x)\mathsf 1_{(0,2)}(x) + \frac25(x-2)\mathsf 1_{(2,3)}(x), $$ and so the CDF is obtained by integrating:
$$F(x)=\int_0^x f(t)\ \mathsf dt = \left(4x-\frac15x^2\right)\mathsf 1_{(0,2)}(x) + \frac15\left(4 + (t-2)^2 \right)\mathsf 1_{[2,3)}(x) + \mathsf 1_{[3,\infty)}(x).  $$
Since $F(2)=\frac45>\frac12$ and $F$ is continuous on $(0,2)$, it follows that the median is the unique number $m$ which satisfies
$$\int_0^m \frac25(2-x)\ \mathsf dx = \frac12, $$
that is, $m = 2 - \sqrt{\frac32}$.
