Discrete Random Variables
You'll learn what discrete random variables are and how we describe their behavior using probability mass functions.
What is a Discrete Random Variable?
A discrete random variable is a numerical outcome of a random process that can only take on countable values. Think of it like rolling a die—you can get 1, 2, 3, 4, 5, or 6, but never 2.5 or π. The outcomes are distinct and separate.
In computer science, discrete random variables model things like:
- Number of packets dropped in a network
- Number of cache misses during program execution
- Result of a random number generator that picks integers
- Number of successful operations before a failure
Probability Mass Function (PMF)
To fully describe a discrete random variable, we use a probability mass function (PMF). The PMF tells us the probability that the random variable equals each specific value.
If X is our discrete random variable, the PMF is written as:
P(X = x)
This reads: "the probability that X equals x."
Properties of a PMF
- All probabilities are between 0 and 1: 0 ≤ P(X = x) ≤ 1
- The sum of all probabilities equals 1: ΣP(X = x) = 1
Example: Rolling a fair six-sided die, let X = outcome.
P(X = 1) = 1/6, P(X = 2) = 1/6, ..., P(X = 6) = 1/6
Notice how the probabilities sum to 6 × (1/6) = 1. ✓
Key Takeaway: Discrete random variables have countable outcomes, and their probability mass function assigns a probability to each possible value while ensuring all probabilities sum to 1.