- Practice
- About 20 min
- 5 practice questions
Discrete random variables: probability mass and cumulative distribution functions
Write the probability mass function of a discrete random variable, check its two conditions, find unknown constants, and move between the probability mass function and the cumulative distribution function.
If something looks wrong, please tell us.
By the end of this lesson you can
- Write a probability mass function (pmf) as a table or a formula and check that it is valid.
- Find an unknown constant k from the condition that probabilities add to 1.
- Build the cumulative distribution function (cdf) F(x) from the pmf, and use its properties.
- Recover the pmf from the jumps of a cdf and find probabilities such as P(a < X ≤ b).
Once the inverse images are counted, each value of a discrete random variable gets a probability. The list of these probabilities is the probability distribution, and two functions describe it completely: the probability mass function and the cumulative distribution function.
Probability mass function
If X is discrete with values x₁, x₂, x₃, …, the function f(x_k) = P(X = x_k) is its probability mass function (pmf), also written p(x). A function f is a pmf if and only if (i) f(x_k) ≥ 0 for every k and (ii) Σ f(x_k) = 1. A pmf can be shown as a table, as a graph of vertical bars, or as a formula.
Worked example 1: the larger number on two dice
From lesson 1, X = the larger number on two dice has 2k − 1 points in the inverse image of k, out of 36. So f(k) = (2k − 1)/36 for k = 1, 2, …, 6, that is 1/36, 3/36, 5/36, 7/36, 9/36, 11/36. Every value is positive and the sum is (1 + 3 + 5 + 7 + 9 + 11)/36 = 36/36 = 1, so f is a pmf.
Worked example 2: finding k, and rejecting a negative root
X takes the values 0, 1, 2, 3 with f(0) = k, f(1) = 3k, f(2) = 5k, f(3) = 10k². The sum must be 1: k + 3k + 5k + 10k² = 1, so 10k² + 9k − 1 = 0, which factorises as (10k − 1)(k + 1) = 0. Thus k = 1/10 or k = −1. Since f(0) = k must be non-negative, k = 1/10, and the pmf is 0.1, 0.3, 0.5, 0.1. Check: 0.1 + 0.3 + 0.5 + 0.1 = 1.
Cumulative distribution function
The cumulative distribution function (cdf), or distribution function, is F(x) = P(X ≤ x) = Σ f(x_i) over all x_i ≤ x. Although the pmf lives only at the values x_i, F(x) is defined for every real x. For a variable with values x₁ < x₂ < … < xₙ, F(x) = 0 for x < x₁, F(x) = f(x₁) for x₁ ≤ x < x₂, F(x) = f(x₁) + f(x₂) for x₂ ≤ x < x₃, and so on, reaching 1 for x ≥ xₙ. Its graph is a staircase.
- 0 ≤ F(x) ≤ 1 for all real x.
- F is non-decreasing: if x < y then F(x) ≤ F(y).
- F is continuous from the right: F(x) → F(a) as x → a from the right.
- F(x) → 0 as x → −∞ and F(x) → 1 as x → +∞.
- P(x₁ < X ≤ x₂) = F(x₂) − F(x₁) and P(X > x) = 1 − F(x).
- P(X = x_k) = F(x_k) − F(x_(k−1)): each probability is the height of a jump of the staircase.
F(x) = P(X ≤ x) = Σ f(x_i) for x_i ≤ x; f(x_k) = F(x_k) − F(x_(k−1)); P(a < X ≤ b) = F(b) − F(a).
Worked example 3: cdf from pmf
For the larger number on two dice, F(k) = (1 + 3 + … + (2k − 1))/36 = k²/36, because the sum of the first k odd numbers is k². So F(1) = 1/36, F(2) = 4/36, F(3) = 9/36, F(4) = 16/36, F(5) = 25/36, F(6) = 1, with F(x) = 0 for x < 1 and F constant between the integers. Then P(X ≤ 4) = F(4) = 16/36 = 4/9, P(2 < X ≤ 5) = F(5) − F(2) = 25/36 − 4/36 = 21/36 = 7/12, and P(X > 4) = 1 − F(4) = 20/36 = 5/9.
| x | x < 0 | 0 ≤ x < 1 | 1 ≤ x < 2 | 2 ≤ x < 3 | x ≥ 3 |
|---|---|---|---|---|---|
| F(x) for example 2 | 0 | 0.1 | 0.4 | 0.9 | 1 |
Worked example 4: pmf from cdf
A discrete random variable has F(x) = 0 for x < 0; 0.2 for 0 ≤ x < 1; 0.5 for 1 ≤ x < 3; 0.9 for 3 ≤ x < 4; and 1 for x ≥ 4. The jumps occur at 0, 1, 3 and 4, so these are the values of X. Their heights are the probabilities: f(0) = 0.2 − 0 = 0.2, f(1) = 0.5 − 0.2 = 0.3, f(3) = 0.9 − 0.5 = 0.4, f(4) = 1 − 0.9 = 0.1 (total 1). Then P(X < 3) = f(0) + f(1) = 0.5 (note the strict inequality: F(3) itself would include f(3)), and P(X ≥ 1) = 1 − P(X = 0) = 0.8.
Two descriptions of the same distribution
- pmf f Probabilities at each value.
- Add up to x F(x) = Σ f(x_i), x_i ≤ x.
- cdf F Staircase defined for every real x.
- Read the jumps f(x_k) = F(x_k) − F(x_(k−1)).
Then back to step 1: pmf f
Key takeaways: a pmf has non-negative values that add to 1; use that to find unknown constants, rejecting any value that makes a probability negative. The cdf F(x) = P(X ≤ x) is a right-continuous staircase rising from 0 to 1, and its jumps are the probabilities. Watch strict and non-strict inequalities: for a discrete variable P(X < a) and P(X ≤ a) can differ.
Check your understanding
-
1. X takes the values 0, 1, 2, 3 with f(x) = k(2x + 1). What is k?
- 1/10
- 1/16
- 1/8
- 1/4
Show answer
Answer: B. The probabilities are k, 3k, 5k and 7k, whose sum is 16k. Setting 16k = 1 gives k = 1/16.
-
2. X takes the values 1, 2, 3 and its cdf has F(1) = 0.3, F(2) = 0.7 and F(3) = 1. What is P(X = 2)?
- 0.7
- 0.3
- 0.4
- 1
Show answer
Answer: C. P(X = 2) is the jump of F at 2: F(2) − F(1) = 0.7 − 0.3 = 0.4.
-
3. Which of these cannot be a probability mass function on the values 0, 1, 2?
- f(0) = 0.25, f(1) = 0.5, f(2) = 0.25
- f(0) = 0.1, f(1) = 0.1, f(2) = 0.8
- f(0) = 1/3, f(1) = 1/3, f(2) = 1/3
- f(0) = 0.5, f(1) = 0.6, f(2) = −0.1
Show answer
Answer: D. Although 0.5 + 0.6 − 0.1 = 1, the value −0.1 is negative, and a probability can never be negative. The other three have non-negative values adding to 1.
-
4. For the larger number X on two dice, F(k) = k²/36. What is P(X = 4)?
- 7/36
- 16/36
- 9/36
- 4/36
Show answer
Answer: A. P(X = 4) = F(4) − F(3) = 16/36 − 9/36 = 7/36, which agrees with the 7 pairs whose larger number is 4.
-
5. For a random variable X, F(2) = 0.65. What is P(X > 2)?
- 0.65
- 0.35
- 0.5
- 1.65
Show answer
Answer: B. P(X > 2) = 1 − P(X ≤ 2) = 1 − F(2) = 1 − 0.65 = 0.35.
Sign in to keep track of the lessons you finish.