# Find the CDF of a function given its PDF

The probability density function of the random variable X is as follows

$f_{X}(x) = \begin{cases} 1/4, & \text{if 0 < x < 1} \\ 1/4, & \text{if 2 < x < 4}\\ 1/4, & \text{if 6 < x < 7}\\ 0, & \text{elsewhere}\\ \end{cases}$

I know that

• I can find the cumulative distribution function by integrating the probability density function from $-\infty$ to $x$,
• and also that for values of $x$ less than or equal to $0$, the CDF will be $0$,
• and for values of $x$ greater than or equal to $7$, the CDF will be $1$.

I know how to integrate each piece, however how do I fill in the gaps between the pieces, such as $1 < x < 2$?

I thought that since it is cumulative, this part would just be the same as the part before it since it doesn't add anymore probability, however if I were to let, for example, $F_x(x)$ = $\frac{1}{4}x$ for 0 < x < 2, then if I were to differentiate this to get back to the PDF, it isn't going to result in the correct domain.

• For the "gaps" you use the "elsewhere" part of the density function. – Jack May 25 '16 at 16:08
• @Jack if I use this part though, integrating 0dt will just give me zero. However, since it is cumulative, it should not be zero in these gap spots, right? – mmm May 25 '16 at 16:11

## 2 Answers

As a typical example of what happens in a gap, look at $3/2$, which is in the first gap. The CDF value at $3/2$ is $$\int_{-\infty}^{3/2}f_X(x)\,dx= \int_{-\infty}^00\,dx+\int_0^1\frac14\,dx+\int_1^{3/2}0\,dx= 0+\frac14+0=\frac14.$$ The rest of $F_X$ can be computed the same way (though the integral splits into more pieces when you go to later intervals).

$F_{X}(x) = \begin{cases} 0, & x \leq 0 \\ x/4, & \text{if 0 < x } \leq 1\\ 1/4, & \text{if 1< x }\leq 2\\ 1/4+(x-2)/4, & \text{if 2 < x } \leq 4\\ 3/4, & \text{if 4 < x } \leq 6\\ 3/4+(x-6)/4, & \text{if 6 < x }\leq 7\\ 1, & \text{elsewhere}\\ \end{cases}$

The CDF stays constant when the density is zero.