Post · 5 min read· pp. 155–159

3.1.3 Probability Mass Function (PMF)


Video Available Video Available

If XX is a discrete random variable then its range RXR_X is a countable set, so, we can list the elements in RXR_X. In other words, we can write

RX={x1,x2,x3,...}.R_X=\{x_1,x_2,x_3,...\}.
Note that here x1,x2,x3,...x_1, x_2,x_3,... are possible values of the random variable XX. While random variables are usually denoted by capital letters, to represent the numbers in the range we usually use lowercase letters such as xx, x1x_1, yy, zz, etc. For a discrete random variable XX, we are interested in knowing the probabilities of X=xkX=x_k. Note that here, the event A={X=xk}A=\{X=x_k\} is defined as the set of outcomes ss in the sample space SS for which the corresponding value of XX is equal to xkx_k. In particular,
A={s∈S∣X(s)=xk}.A=\{s \in S | X(s)=x_k\}.
The probabilities of events {X=xk}\{X=x_k\} are formally shown by the probability mass function (pmf) of XX.

Definition Let XX be a discrete random variable with range RX={x1,x2,x3,...}R_X=\{x_1,x_2,x_3, ...\} (finite or countably infinite). The function

PX(xk)=P(X=xk), for k=1,2,3,...,P_X(x_k)=P(X=x_k), \textrm{ for } k=1,2,3,...,
is called the probability mass function (PMF) of XX.

Thus, the PMF is a probability measure that gives us probabilities of the possible values for a random variable. While the above notation is the standard notation for the PMF of XX, it might look confusing at first. The subscript XX here indicates that this is the PMF of the random variable XX. Thus, for example, PX(1)P_X(1) shows the probability that X=1X=1. To better understand all of the above concepts, let's look at some examples.


Example

I toss a fair coin twice, and let XX be defined as the number of heads I observe. Find the range of XX, RXR_X, as well as its probability mass function PXP_X.

  • Solution
    • Here, our sample space is given by
      S={HH,HT,TH,TT}.S=\{HH,HT,TH,TT\}.
      The number of heads will be $0$, $1$ or $2$. Thus
      RX={0,1,2}.R_X=\{0,1,2\}.
      Since this is a finite (and thus a countable) set, the random variable XX is a discrete random variable. Next, we need to find PMF of XX. The PMF is defined as
      PX(k)=P(X=k) for k=0,1,2.P_X(k)=P(X=k) \textrm{ for } k=0,1,2.
      We have
      PX(0)=P(X=0)=P(TT)=14,P_X(0)=P(X=0)=P(TT)=\frac{1}{4},
      PX(1)=P(X=1)=P({HT,TH})=14+14=12,P_X(1) =P(X=1)=P(\{HT,TH\})=\frac{1}{4}+\frac{1}{4}=\frac{1}{2},
      PX(2)=P(X=2)=P(HH)=14.P_X(2)=P(X=2)=P(HH)=\frac{1}{4}.

Although the PMF is usually defined for values in the range, it is sometimes convenient to extend the PMF of XX to all real numbers. If x∉RXx \notin R_X, we can simply write PX(x)=P(X=x)=0P_X(x)=P(X=x)=0. Thus, in general we can write \begin{equation} \nonumber P_X(x) = \left{ \begin{array}{l l} P(X=x) & \quad \text{if xx is in } R_X\ 0 & \quad \text{otherwise} \end{array} \right. \end{equation}

To better visualize the PMF, we can plot it. Figure 3.1 shows the PMF of the above random variable XX. As we see, the random variable can take three possible values $0,1$ and $2$. The figure also clearly indicates that the event X=1X=1 is twice as likely as the other two possible values. The Figure can be interpreted in the following way: If we repeat the random experiment (tossing a coin twice) a large number of times, then about half of the times we observe X=1X=1, about a quarter of times we observe X=0X=0, and about a quarter of times we observe X=2X=2.

pmf

Fig.3.1 - PMF for random Variable XX in Example 3.3.

For discrete random variables, the PMF is also called the probability distribution. Thus, when asked to find the probability distribution of a discrete random variable XX, we can do this by finding its PMF. The phrase distribution function is usually reserved exclusively for the cumulative distribution function CDF (as defined later in the book). The word distribution, on the other hand, in this book is used in a broader sense and could refer to PMF, probability density function (PDF), or CDF.


Example

I have an unfair coin for which P(H)=pP(H)=p, where $0 < p < 1$. I toss the coin repeatedly until I observe a heads for the first time. Let YY be the total number of coin tosses. Find the distribution of YY.

  • Solution
    • First, we note that the random variable YY can potentially take any positive integer, so we have RY=N={1,2,3,...}R_Y=\mathbb{N}=\{1,2,3,...\}. To find the distribution of YY, we need to find PY(k)=P(Y=k)P_Y(k)=P(Y=k) for k=1,2,3,...k=1,2,3,.... We have
      PY(1)=P(Y=1)=P(H)=p,P_Y(1) =P(Y=1)=P(H)=p,
      PY(2)=P(Y=2)=P(TH)=(1−p)p,P_Y(2) =P(Y=2)=P(TH)=(1-p)p,
      PY(3)=P(Y=3)=P(TTH)=(1−p)2p,P_Y(3) =P(Y=3)=P(TTH)=(1-p)^2 p,
      ..... \hspace{50pt} . \hspace{50pt} . \hspace{50pt} .
      ..... \hspace{50pt} . \hspace{50pt} . \hspace{50pt} .
      ..... \hspace{50pt} . \hspace{50pt} . \hspace{50pt} .
      PY(k)=P(Y=k)=P(TT...TH)=(1−p)k−1p.P_Y(k) =P(Y=k)=P(TT...TH)=(1-p)^{k-1} p.
      Thus, we can write the PMF of YY in the following way \begin{equation} \nonumber P_Y(y) = \left{ \begin{array}{l l} (1-p)^{y-1} p& \quad \text{for } y=1,2,3,...\ 0 & \quad \text{otherwise} \end{array} \right. \end{equation}

Consider a discrete random variable XX with Range(X)=RX(X)=R_X. Note that by definition the PMF is a probability measure, so it satisfies all properties of a probability measure. In particular, we have

  • $0\leq P_X(x) \leq 1$ for all xx, and
  • ∑x∈RXPX(x)=1\sum_{x \in R_X} P_X(x)=1.

Also note that for any set A⊂RXA \subset R_X, we can find the probability that X∈AX \in A using the PMF

P(X∈A)=∑x∈APX(x).P(X \in A)=\sum_{x \in A} P_X(x).

Properties of PMF:

  • $0\leq P_X(x) \leq 1$ for all xx;
  • ∑x∈RXPX(x)=1\sum_{x \in R_X} P_X(x)=1;
  • for any set A⊂RX,P(X∈A)=∑x∈APX(x)A \subset R_X, P(X \in A)=\sum_{x \in A} P_X(x).

Example

For the random variable YY in Example 3.4,

  1. Check that ∑y∈RYPY(y)=1\sum_{y \in R_Y} P_Y(y)=1.
  2. If p=12p=\frac{1}{2}, find P(2≤Y<5)P(2\leq Y <5).
  • Solution
    • In Example 3.4, we obtained
      PY(k)=P(Y=k)=(1−p)k−1p, for k=1,2,3,...P_Y(k) =P(Y=k)=(1-p)^{k-1} p, \textrm{ for } k=1,2,3,...
      Thus,
      1. to check that ∑y∈RYPY(y)=1\sum_{y \in R_Y} P_Y(y)=1, we have

        ∑y∈RYPY(y)\sum_{y \in R_Y} P_Y(y)=∑k=1∞(1−p)k−1p= \sum_{k=1}^{\infty} (1-p)^{k-1} p
        =p∑j=0∞(1−p)j= p \sum_{j=0}^{\infty} (1-p)^{j}
        =p11−(1−p)= p \frac{1}{1-(1-p)} Geometric sum\hspace{30pt}\textrm{ Geometric sum}
        =1= 1;
      2. if p=12p=\frac{1}{2}, to find P(2≤Y<5)(2\leq Y < 5), we can write

        P(2≤Y<5)\textrm{P}(2\leq Y < 5)=∑k=24PY(k)= \sum_{k=2}^{4} P_Y(k)
        =∑k=24(1−p)k−1p= \sum_{k=2}^{4} (1-p)^{k-1} p
        =12(12+14+18)= \frac{1}{2}\bigg(\frac{1}{2}+\frac{1}{4}+\frac{1}{8}\bigg)
        =716=\frac{7}{16}.