So far events were described in words: "even," "a heart." Often the outcome we care about is a number: the number of heads, the sum of two dice, the number of customers in line. A random variable turns each outcome of a sample space into a number, so that we can compute with it.
Key idea
A random variable $X$ assigns a number to each outcome of a chance process. A discrete random variable has separate possible values (often counts). Its probability distribution lists each value $x$ with its probability $P(X = x)$. Every probability is between 0 and 1, and together they add to exactly 1.
Why it works
The values of $X$ split the sample space into separate pieces: every outcome gives exactly one value. So the pieces cover all of $S$ without overlapping, and their probabilities must add to $P(S) = 1$. That gives a free check on every table, and a way to fill in one missing probability.
Worked example: Building a distribution
Flip a fair coin 3 times. Let $X$ be the number of heads. Find the probability distribution of $X$.
- The 8 equally likely outcomes: HHH, HHT, HTH, THH, HTT, THT, TTH, TTT.
- $X = 3$: HHH (1 outcome). $X = 2$: HHT, HTH, THH (3). $X = 1$: 3 outcomes. $X = 0$: TTT (1).
- So $P(X = 0) = \frac{1}{8}$, $P(X = 1) = \frac{3}{8}$, $P(X = 2) = \frac{3}{8}$, $P(X = 3) = \frac{1}{8}$.
- Check: $\frac{1 + 3 + 3 + 1}{8} = 1$.
Answer: Values 0, 1, 2, 3 with probabilities $\frac18, \frac38, \frac38, \frac18$.
| $x$ (pets) | 0 | 1 | 2 | 3 | 4 |
|---|---|---|---|---|---|
| $P(X = x)$ | 0.30 | 0.25 | ? | 0.15 | 0.05 |
Worked example: A missing probability
In the table, find $P(X = 2)$, then $P(X \ge 2)$.
- The known probabilities add to $0.30 + 0.25 + 0.15 + 0.05 = 0.75$.
- So $P(X = 2) = 1 - 0.75 = 0.25$.
- $$P(X \ge 2) = P(X = 2) + P(X = 3) + P(X = 4) = 0.25 + 0.15 + 0.05 = 0.45$$
Answer: $P(X = 2) = 0.25$; $P(X \ge 2) = 0.45$.
Common mistake
Writing a probability table whose probabilities do not add to 1, often by leaving out a value (such as 0 pets) or double-counting outcomes. Check every table by adding the probabilities.