# Given a pmf, how is it possible to calculate the cdf?

Given a pmf (probability mass function) for X (random variable):

$$\begin{array}{|c|c|c|c|c|}\hline x&1&2&3&4\\ \hline p(x)&0.4&0.3&0.2&0.1\\ \hline \end{array}$$

How would you know the cdf which is for values for $$1 \leq x < 2$$ since you do not know the values in between?

• @Glen_b Wdym? Yes Probability and Statistics I – user12055579 Oct 24 '19 at 23:14
• No, it's more of a conceptual question for myself, I am just using an example – user12055579 Oct 24 '19 at 23:19

Given that you're talking about a discrete random variable over the integers, you should certainly know how the pmf behaves between those values - the probability of it taking any value in any interval strictly between (say) $$1$$ and $$2$$ is $$0$$.

Consequently, you do also know how the cdf $$F(x)$$ behaves, since it's just the sum of all the probabilities up to $$x$$. It doesn't matter how many zeroes you want add in, they don't change anything.

For further discussion of this point, see Wikipedia's Cumulative Distribution Function; Definition

... and the two sections immediately under that (Properties and Examples). You may find the drawing of a discrete cdf at the right hand side of the Properties section helpful (it's the top one).

Here's an example for a slightly different distribution than the one in your question (though it's broadly similar).

• So cdf (culmulative distribution function) $$F(x) = P(X \leq x)$$ is for values for something less than $$x$$. Given that the pmf is only for specific values (like in the table above) why is it that If $$1 \leq x < 2$$: $$F(x) = P(X \leq x)$$ = $$P(x = 1) = 0.4$$? In other words, why do you only take the specific value for $$x = 1$$ since its for all values more than and equal to $1$ and less than $2$? – user12055579 Oct 24 '19 at 23:27
• Yes, I have that graph too. So I am wondering why is it say $0.4$ between $1$ and $2$ and not just one dot for each $1$, $2$, ... . How can you say its also $0.4$ beween $1$ and $2$? – user12055579 Oct 24 '19 at 23:30
• For a related example (one not using probability). Let's say children arrive at my house for a sleepover on the stroke of each hour (1pm, 2pm, 3pm, 4pm, one child each time) and I am looking at the number of visiting children (i.e. other than my own) in my house as a function of time. How many of these children are in my house at 1:30pm? – Glen_b Oct 24 '19 at 23:34
• Yes, one child; they arrive and don't leave; they just accumulate into a larger group as each new one arrives. Now imagine you have not children, but atoms of probability arriving ("0.4" arrives, then later on "0.3" arrives, etc) congregating in your living room and eating all your snacks. They just arrive and never leave and you just keep getting more probability each time a new one turns up. This is exactly what's implied by $P(X\leq x)$ – Glen_b Oct 24 '19 at 23:38
• There's no jump between integers. There's a jump at each integer. That's when the next "child" turns up. You have a probability of $0.3$ associated with $X=2$, so when you're looking at $P(X\leq 2)$ rather than $P(X\leq 1.999)$ (say) you have to add $0.3$ on to whatever you had before (just like at 2pm you have a whole extra child in your house, one more than there was between 1 pm and 1:59 pm). – Glen_b Oct 24 '19 at 23:41

You can compute the CDF using delta-functions. Express the PMF as follows, $$p(x) = (0.4) \delta(x-1) + (0.3) \delta(x-2) + (0.2) \delta(x-3) + (0.1) \delta(x-4)$$ The CDF is then given by integration, by definition, if $$P(x)$$ is the CDF then, $$P(x) = \int_{-\infty}^x p(y) ~ dy$$ Observe that if $$x<1$$ then each of the delta functions vanish and so $$P(x) = 0$$.

If $$1 then the only delta function which contributes to the integral is $$\delta(x-1)$$, so we see that $$P(x) = (0.4)$$ on this interval.

The same procedure can now be carried out on the other invervals.

• This is pretty complicated way of saying that one needs to sum the values... – Tim Oct 26 '19 at 6:59
• @Tim While this is true, it does offer a new perspective. And sometimes, this new perspective, by using delta-functions, can sometimes be beneficial. For example, suppose you have a random variable whose CDF is neither discrete nor continuous. Then we can express it in terms of Heaviside functions. By differentiating the CDF we will get the PDF in terms of functions and delta functions. That will allow us to compute expected values. I actually never seen this done before anywhere, though I am sure many other people realized this before as well, because it is not profound. – Nicolas Bourbaki Oct 26 '19 at 7:23
• This is not rigorous as the measure $\text{d}y$ in the integral is not well-defined. It cannot be Lebesgue as Dirac functions are not measurable against the Lebesgue measure. It must therefore include masses at $1,\ldots,4$, which makes the definition tautological. – Xi'an Oct 27 '19 at 7:31
• @Xi'an I know it is not rigorous. Neither is the use of the delta function in physics. It leads to the correct answer, and it is an interesting use of the delta function. – Nicolas Bourbaki Oct 27 '19 at 15:33
• I am afraid Nicolas B would disagree! – Xi'an Oct 27 '19 at 15:51