Unit 4, lesson 21

Discrete Random Variables and Probability Distributions

What a random variable is, when it is discrete, and how its support, probability mass function and cumulative distribution function describe its probability distribution, including strict and inclusive events.

  • Video 21
  • Discrete Random Variables and Models

An order can pass through several processing routes, but for planning only one number matters, how many follow-up messages the order will need. Before the order is handled that number is uncertain, yet a probability model can say how likely each value is. This lesson defines a random variable as a numerical function of the outcomes and shows how a probability mass function and a cumulative distribution function describe its distribution. It also shows why the events X<1X < 1 and X≤1X \le 1 can have different probabilities.

Key terms

Random variable

Definition A random variable XX is a function that assigns a real number X(ω)X(\omega) to each outcome ω\omega of a sample space Ω\Omega. For a set BB of real numbers, the event {X∈B}\{X \in B\} consists of the outcomes ω\omega with X(ω)X(\omega) in BB, and P(X∈B)P(X \in B) is its probability. In particular {X=x}\{X = x\} is the set of outcomes that XX maps to the number xx. A capital letter names the random variable and a lowercase letter names one of its possible values.

In plain words The randomness lies in which outcome occurs. The random variable is a fixed rule that reads one number off that outcome, and several outcomes can give the same number.

Example Five processing routes aa, bb, cc, dd and ee have probabilities 0.20.2, 0.20.2, 0.30.3, 0.10.1 and 0.20.2. Let XX be the number of follow-up messages, with X(a)=0X(a) = 0, X(b)=X(c)=1X(b) = X(c) = 1 and X(d)=X(e)=2X(d) = X(e) = 2. The event {X=1}\{X = 1\} is {b,c}\{b, c\}, so P(X=1)=0.2+0.3=0.5P(X = 1) = 0.2 + 0.3 = 0.5. The variable keeps only the count and sets the other details of the route aside.

Discrete random variable

Definition A random variable XX is discrete if there is a finite or countably infinite set CC of real numbers with P(X∈C)=1P(X \in C) = 1. Countably infinite means that the values can be listed in a sequence x1,x2,x3,…x_1, x_2, x_3, \dots that never ends.

In plain words A discrete random variable takes separate values that can be listed, such as 0,1,20, 1, 2 and so on, and its probability sits on those individual values. Counts are the typical case. A quantity measured on a continuous scale, such as a waiting time, is usually modeled in a different way, with a density.

Example The follow-up count takes only the values 00, 11 and 22, so it is discrete with finitely many values. Let WW be the number of tosses of a fair coin up to and including the first head. Its values are 1,2,3,…1, 2, 3, \dots with P(W=w)=(1/2)wP(W = w) = (1/2)^w, and these probabilities add to 11, so WW is discrete with countably infinitely many values.

Support

Definition The support of a discrete random variable XX is the set of values xx with P(X=x)>0P(X = x) > 0. The probabilities of the values in the support add to 11, and every value outside the support has probability 00.

In plain words The support lists the values that the variable takes with positive chance. A value written in a table with probability 00 is not part of it.

Example The follow-up count has support {0,1,2}\{0, 1, 2\}. If a table also listed the value 33 with probability 00, the support would still be {0,1,2}\{0, 1, 2\}. The value 1.51.5 is outside the support, so P(X=1.5)=0P(X = 1.5) = 0, even though it lies between two support values.

Probability distribution

Definition The probability distribution of a random variable XX is the rule that gives the probability P(X∈B)P(X \in B) for every set BB of real numbers, that is, how the total probability 11 is spread over the possible values. For a discrete random variable the distribution is determined by the probabilities of the individual support values, through

P(X∈B)=∑x∈BP(X=x),P(X \in B) = \sum_{x \in B} P(X = x),

where the sum runs over the support values that lie in BB. Different random variables can have the same distribution.

In plain words The distribution says which values XX can take and how likely every set of values is. It is a model for a value that has not been observed yet, not a table of frequencies in observed data.

Example The follow-up count has the distribution with probabilities 0.20.2, 0.50.5 and 0.30.3 at the values 00, 11 and 22. Suppose 10 observed orders needed 00, 11 and 22 follow-ups 11, 66 and 33 times. The relative frequencies 0.10.1, 0.60.6 and 0.30.3 summarize those data, and they can be compared with the model, but they are not the model. For a second example, toss a fair coin once and let HH count heads and TT count tails. These are different random variables, since H+T=1H + T = 1 means they never take the same value. Yet each takes the values 00 and 11 with probability 0.50.5, so they have the same distribution.

Probability mass function

Definition The probability mass function, or PMF, of a discrete random variable XX is the function

pX(x)=P(X=x),p_X(x) = P(X = x),

defined for every real number xx. A function pp is the PMF of some discrete random variable exactly when p(x)≥0p(x) \ge 0 for every xx, p(x)>0p(x) > 0 for at most countably many xx, and those positive values add to 11. Nonnegativity and the total of 11 are separate requirements. A table with a negative entry can still total 11, and a table of nonnegative entries can fail to total 11.

In plain words The PMF puts a mass of probability on each possible value. To find the probability of any event about XX, list the values that satisfy it and add their masses.

Example For the follow-up count, pX(0)=0.2p_X(0) = 0.2, pX(1)=0.5p_X(1) = 0.5, pX(2)=0.3p_X(2) = 0.3 and pX(x)=0p_X(x) = 0 for every other xx. The masses are nonnegative and 0.2+0.5+0.3=10.2 + 0.5 + 0.3 = 1. The event X>0X > 0 contains the values 11 and 22, so it has probability 0.5+0.3=0.80.5 + 0.3 = 0.8. The event X<1X < 1 contains only the value 00, so it has probability 0.20.2. The masses 0.30.3, 0.80.8 and −0.1-0.1 total 11 but do not form a PMF, and neither do the masses 0.20.2, 0.50.5 and 0.20.2, whose total is 0.90.9.

Cumulative distribution function

Definition The cumulative distribution function, or CDF, of a random variable XX is

FX(x)=P(X≤x)F_X(x) = P(X \le x)

for every real number xx. It is nondecreasing, it approaches 00 as x→−∞x \to -\infty and 11 as x→∞x \to \infty, and it is right-continuous, so its value at a point includes the probability at that point. For a discrete random variable the jump of FXF_X at each value xx equals pX(x)p_X(x), and when the support values are spaced apart, as with counts, FXF_X is a step function that is flat between them. For real numbers a<ba < b,

P(a<X≤b)=FX(b)−FX(a),\begin{aligned} &P(a < X \le b) \\[0.4em] &\quad = F_X(b) - F_X(a), \end{aligned}

and for every real xx the strict event has probability P(X<x)=FX(x)−pX(x)P(X < x) = F_X(x) - p_X(x).

In plain words The CDF gives, for every cutoff xx, the probability that XX is at most xx. Moving the cutoff to the right can only add values, so the CDF never decreases. With discrete values the inequality sign matters, because a single value can carry positive probability.

Example For the follow-up count,

FX(x)={0,x<0,0.2,0≤x<1,0.7,1≤x<2,1,x≥2.F_X(x) = \begin{cases} 0, & x < 0, \\ 0.2, & 0 \le x < 1, \\ 0.7, & 1 \le x < 2, \\ 1, & x \ge 2. \end{cases}

So P(X≤1)=FX(1)=0.7P(X \le 1) = F_X(1) = 0.7, while P(X<1)=0.7−0.5=0.2P(X < 1) = 0.7 - 0.5 = 0.2. The difference FX(2)−FX(0.5)=1−0.2=0.8F_X(2) - F_X(0.5) = 1 - 0.2 = 0.8 is the probability of the values 11 and 22. The event 1≤X≤21 \le X \le 2 also has probability 0.80.8, but FX(2)−FX(1)=0.3F_X(2) - F_X(1) = 0.3, because that difference is P(1<X≤2)P(1 < X \le 2) and leaves out the mass at 11.

Check yourself

  1. A random variable XX takes only the values 00, 11 and 22, with pX(0)=0.1p_X(0) = 0.1 and pX(1)=0.6p_X(1) = 0.6. Find pX(2)p_X(2) and P(X≥1)P(X \ge 1).
Show the answer

The masses must add to 11, so pX(2)=1−0.1−0.6=0.3p_X(2) = 1 - 0.1 - 0.6 = 0.3. The event X≥1X \ge 1 contains the values 11 and 22, so P(X≥1)=0.6+0.3=0.9P(X \ge 1) = 0.6 + 0.3 = 0.9. This is not FX(1)=0.7F_X(1) = 0.7, which is the probability of the different event X≤1X \le 1.

  1. For the random variable of question 1, find P(X<2)P(X < 2), P(X≤2)P(X \le 2) and FX(1.5)F_X(1.5), and write out its CDF.
Show the answer

The strict event X<2X < 2 contains 00 and 11, so its probability is 0.1+0.6=0.70.1 + 0.6 = 0.7. The inclusive event X≤2X \le 2 contains every support value, so its probability is 11. No support value lies between 11 and 1.51.5, so FX(1.5)=FX(1)=0.7F_X(1.5) = F_X(1) = 0.7. The CDF is

FX(x)={0,x<0,0.1,0≤x<1,0.7,1≤x<2,1,x≥2.F_X(x) = \begin{cases} 0, & x < 0, \\ 0.1, & 0 \le x < 1, \\ 0.7, & 1 \le x < 2, \\ 1, & x \ge 2. \end{cases}
  1. Someone proposes the following function as the CDF of a count. Can it be one?
G(x)={0,x<0,0.6,0≤x<1,0.4,1≤x<2,1,x≥2.G(x) = \begin{cases} 0, & x < 0, \\ 0.6, & 0 \le x < 1, \\ 0.4, & 1 \le x < 2, \\ 1, & x \ge 2. \end{cases}
Show the answer

No. The function falls from 0.60.6 to 0.40.4 at x=1x = 1, but a CDF never decreases, because the event X≤0X \le 0 is contained in the event X≤1X \le 1. Reading the jump at 11 as a probability mass would give P(X=1)=0.4−0.6=−0.2P(X = 1) = 0.4 - 0.6 = -0.2, and a probability cannot be negative.

How this lesson connects