# Getting PDF and CDF from the outcome of an experiment

Knowing that my experiment can return results within $\{a, b, c\}$, so that any possible result has a density of $\frac{1}{3}$, and that executing the experiment three times returned the sequence $a, b, c$ so that distributions are $\{\frac13,\frac23,\frac33\}$, how can I get both PDF and CDF?

I couldn't find anything online and I've been requested to write a code that does this computation, but I'm not really into probability and stuff like that so I'd like some hints or the full algorithm if possible.

Discrete results do not have a probability density; they have a probability mass.   Which is $\tfrac 1 3$

(PS: It's continuous valued random variables that have a probability density.)

The probability mass of three discrete results cannot all be $\tfrac 1 2$.   The sum of all possible probabilities must equal $1$.   So if they are equal, then they must all be $\tfrac 1 3$. (ed: as you noted that was a typo in the OP.)

That is the Probability Mass Function (pmf).   $p(x) = \begin{cases} \tfrac 1 3 & : x\in\{a,b,c\} \\ 0 & :\text{otherwise}\end{cases}$

A Cumulative Distribution Function (CDF) is exactly what it sounds like: the accumulated probabilities of outcomes in the distribution up to a certain value.   $F(x) = \Pr(X\leq x)$ .   As such it only makes sense for a strictly ordered set of results.   However, if we can say the set is ordered so that $a < b < c$, then we can say : $F(a)=p(a)\\ F(b)=p(a)+p(b)\\ F(c)=p(a)+p(b)+p(c)$

The CDF is then: $$F(x) = \begin{cases} 0 & : x<a \\ 1/3 & : a\leq x< b \\ 2/3 & : b\leq x< c \\ 1 & : c\leq x\end{cases}$$

• That $\frac12$ was a typo, I fixed it now. I'll read your reply ASAP btw. – StepTNT Oct 28 '15 at 23:05
• Thanks for the answer but I think I may need something more. I've been requested to plot those functions, so I'm looking for a form like $F(x)=1-e^x$. Is there any chance to get it or am I out of luck? – StepTNT Oct 29 '15 at 9:15