CDF of a density function with absolute value, given bounds for $X$

density functionprobability distributions

I am trying to find the CDF of A continuous random variable $X$ and I am having trouble coming up with the bounds for the integral.

$f_X(x) = \frac{|x|}{\frac{5}{2}} $, where $ -2 \leq x \leq 1$. 0 otherwise.

My first thought was to split the cases up with the first case being

Case 1: $x < -2$

$\int_{-\infty}^{x}f_X(x) dx =\int_{-\infty}^{x} 0 dx = 0 $

Case 2: $ -2 \leq x \leq 1$

Case 3: $x > 1$

I am stuck on how to do the 2nd and 3rd case. Do I first split the absolute value up within case 2? Or is there a 4th case?

Best Answer

When absolute value is involved, a split at the sign change is helpful.

$$\begin{align}f_X(x)&=\begin{cases}\tfrac 25\lvert x\rvert &:& -2\leqslant x\leqslant 1\\0&:& \text{elsewise}\end{cases}\\[1ex] &=\begin{cases}-\tfrac 25x &:& -2\leqslant x<0\\[1ex]~~~\tfrac 25 x&:& ~~~0\leqslant x\leqslant 1\\~~~0&:& \text{elsewise}\end{cases}\\[2ex]F_X(x)&=\begin{cases}0 &:& x< -2\\[1ex]\displaystyle\int_{-2}^x -\tfrac 25s~\mathrm d s&:& -2\leqslant x<0\\[1ex]\displaystyle\int_{-2}^0 -\tfrac 25s~\mathrm d s+\int_0^x \tfrac 25s~\mathrm d s&:& 0\leqslant x< 1\\[1ex]1&:& 1\leqslant x\end{cases}\\[1ex]&~~\ddots\end{align}$$