# Finding pdf and cdf of a random variable

For a random variable given as:

$X=\begin{cases}3 , -3<x<5 \\ x,5 \leq x \leq 7 \\ 8, 7<x<9\end{cases}$

I am not sure if this describes a discrete random variable or continuous, as if it is discrete I would just list all the values $X$ can take and their probability:

$X={3,5,6,7,8}$

$P(X=3)=\frac{7}{11}$

$P(X=5)=P(X=6)=P(X=7)=P(X=8)=\frac{1}{11}$

$F(x)=\begin{cases}0 , x\le -3 \\ \frac{7}{11},-3<x<5 \\ \frac{10}{11}, 5 \leq x \leq 7 \\ 1, x> 7\end{cases}$

I am not sure how to do it if X was a continuous random variable, as other examples I have seen already have a pdf given so cdf is just the integral.

UPDATE: as brought up by Bungo, I am also given that the random variable is sampled uniformly.

So I guess using the uniform distribution

$f(x)=\begin{cases}0 , otherwise \\ \frac{1}{8},-3<x<5 \\ \frac{1}{2}, 5 \leq x \leq 7 \\ \frac{1}{2}, 7<x<9 \end{cases},F(x)=\begin{cases}0 , otherwise \\ \frac{1}{8},-3<x<5 \\ \frac{5}{8}, 5 \leq x \leq 7 \\ \frac{9}{8}, 7<x<9 \end{cases}$

But I think this is incorrect as $\frac{9}{8}$ should be 1

• What is the probability distribution of $x$? Without this, there's not enough information to answer. – Bungo Aug 27 '18 at 6:40
• @Bungo , i am not given it. but if it helps. i am also told that the value of the random variable is chosen uniformly at random from the interval (-3,9). Does this suggest that the pdf is of the uniform distribution? – glockm15 Aug 27 '18 at 6:47

The random variable is neither discrete nor continuous. It takes values other than $3,5,6,7,8$. It is defined on the space $(-3,9)$ with normalized Lebesgue measure as the basic probability measure. The correct values of $F(x)$ are $0$ for $x <3$, $2/3$ for $3 \leq x \leq 5$, $\frac {x+5} {12}$ for $5 \leq x \leq 7$, $1$ for $x \geq 8$.
• By the very definition this random variable takes uncountable number of values: it takes all values between $5$ and $7$. So your answer is not correct. Answering this question requires some familiarity with general probability spaces because $X$ is neither discrete nor continuous. Is it a mixture of the two types. – Kavi Rama Murthy Aug 27 '18 at 7:53
• The formula for $5 \leq x \leq 7$ isn't right. In that interval, the cdf should climb linearly from $2/3$ to $5/6$. Also should mention that the cdf equals the constant $5/6$ for $7 \leq x < 8$. – Bungo Aug 27 '18 at 15:31