# Uniform distribution probability

A 5km road running north and south, the location of a crime is a uniform random variable. The city is trying to place the police station at the best location

(a) If the police headquarters were located at km n = 3, fi nd the cdf and pdf of the distance to a crime.

(b) Now suppose the police headquarters is located at km n for some n from 0 to 5. Find the cdf and pdf of the distance to a crime.

Hint: Note that, if n is in [0, 2.5] (i.e., the police headquarters is located closer to the north end of the road), then the largest distance that would need to be travelled to a crime is (5 - n) and it is n if n is in [2.5, 5]. That is, the possible values of the random variable for the distance to a crime are in the interval [0; max{5-n,n}].

(c) Using the PDF found in part (b), compute the expected value of the distance to a crime.

(d) Where would you recommend the city to locate a new police headquarters and why?

This is my work so far. X~uniform (0,5) Y = crime given distance = |x-3|

$F_{Y}$ = P(Y $\leq$ y) = P(|x-3| $\leq$ y) = P((3-y)$\leq$ x $\leq$ (y+3)) and i end up with

$F_x$(y+3) - $F_x$(3-y)

I"m not sure how to continue with this question.

• To avoid confussion always remember that symbols for random variables, and values, are case sensitive. $X$ is your random variable, $x$ is something else. Nov 9, 2017 at 0:29

Yes, that is correct so far.   $F_Y(y) = F_X(3+y)-F_X(3-y)$ . (Note: capitalisation.)

Now consider that $F_X(x) = \begin{cases} 0 & :& x\leqslant 0\\ x/5 &:& 0< x < 5\\ 1 &:& x\geqslant 5\end{cases}$

So, therefore $F_Y(y) = \begin{cases} 0 &:& y\leqslant 0 \\ \bbox[border:1pt pink solid]{\phantom{2y/5\qquad}} &:& 0< y < 2 \\ \bbox[border:1pt pink solid]{\phantom{(y+2)/5}} &:& 2\leqslant y < 3 \\ 1 &:& 3\leq y \end{cases}$

Another way to view it is that you have folded a bit of the original distribution onto itself, so the density in this merged interval will be twice that of the original.   Thus the probability density function is:

$$f_Y(y) ~{=\begin{cases} f_X(3+y)+f_X(3-y) & :& 0<y < 2 \\ f_X(3-y) &:& 2\leqslant y< 3\\ 0 & :& \text{elsewhere} \end{cases} \\= \begin{cases} 2/5 &:& 0< y < 2 \\ 1/5 &:& 2\leqslant y < 3 \\ 0 &:& \text{otherwise} \end{cases}}$$

From which you can find the CDF.

• in the cdf and pdf are there always three cases and two cases respectively? Would there be a scenario where there are more cases? Nov 9, 2017 at 1:17
• Yes, there may be more cases. As in this senario. Nov 9, 2017 at 1:24
• for part b i separated it into range from 0 to 2.5 and 2.5 to 5, however when i did the calculations i got 2y/5 for both of them and doesn't seem correct to me. Nov 9, 2017 at 21:58
• That is the correct value of the CDF in the fold, its the size of the folded and the unfolded intervals that distinguish the CDF for different values of $n$. Nov 9, 2017 at 22:17
• So the cdf would look something like 2y/5 when y is [0,2.5] and 2y/5 when (2.5,5] ? Nov 9, 2017 at 22:19