We produce a real number X through a two-stage experiment.
- First roll a fair die to get an outcome $Y\in\{1,2,...,6\}$.
- Then if $Y=k$, choose a point uniformly at random in $[0,k]$, denote it X.
What is the c.d.f. of X? What is the p.d.f. of X?
My Attempt:
The c.d.f. is defined as $F(t)=\mathbb{P}(X\leq t)$, so
\begin{equation} F(t)= \begin{cases} 0&\text{if } t<0\\ \frac{1}{6}\cdot\frac{1}{k-0}&\text{if }t\leq k\\ 1&\text{if } ??? \end{cases} \end{equation}
My thinking on how to get the probability is that there is a $\frac{1}{6}$ chance of rolling a number Y and then there is a $\frac{1}{k-0}$ chance of choosing a random number in $[0,k]$ because it is uniformly distributed. I am not sure what conditions of $t$ would cause a probability of $1$.
The p.d.f can be found by differentiating the c.d.f., but since there would be 6 different functions for $k\in\{1,2,...,6\}$, I am unsure how to combine them to differentiate. Should I sum them?
Here is a nice little diagram. The vertical bars divide the sections of the number line into regions corresponding to the weights (on the right).
X will be uniform on each of these intervals given by the sum of the appropriate weights divided by 36, the sum of the weights. So for example, the pdf for X in the interval 0 and 1 is given by $\frac{6+3+2+3/2+6/5+1}{36}$. If you do this for each interval, you get the following pdf
$$f(X)=\begin{cases}49/120,&0<X<1\\ 29/120&1<X<2\\ 19/120&2<X<3\\ 37/360&3<X<4\\ 11/180&4<X<5\\ 1/36&5<X<6\end{cases}$$
This corresponds to the piecewise cdf with six intervals of straight lines of different slopes...
$$F(X)=\begin{cases}0&X<0\\ 49/120X,&0<X<1\\ 29/120(X-1)+49/120&1<X<2\\ 19/120(X-2)+13/20&2<X<3\\ 37/360(X-3)+97/120&3<X<4\\ 11/180(X-4)+41/45&4<X<5\\ 1/36(X-5)+35/36&5<X<6\\ 1&X>6\end{cases}$$