Once outcomes are assigned numbers, probability becomes something we can calculate and summarize.
Two coin tosses can produce HH, HT, TH, or TT. But the question may be simply: how many heads appeared?
A random variable is a rule that assigns a number to each outcome. HH receives 2, HT and TH receive 1, and TT receives 0.
Key question
Which number should be attached to each outcome, and how should the probabilities of those numbers be represented?
What is a random variable?
| Coin outcome | Random variable X: number of heads |
|---|---|
| HH | 2 |
| HT | 1 |
| TH | 1 |
| TT | 0 |
The variable is not the outcome itself. Different outcomes may map to the same numerical value.
How do discrete and continuous variables differ?
Discrete random variable
Takes countable values
defect count · visits · successes
Continuous random variable
Can take any value in an interval
time · length · temperature · weight
Why the distinction matters
For a discrete variable, individual values can carry probability. For a continuous variable, probability is assigned to intervals.
What does a probability distribution show?
| X | P(X=x) |
|---|---|
| 0 | 0.25 |
| 1 | 0.50 |
| 2 | 0.25 |
Every probability in a discrete distribution is nonnegative, and the probabilities sum to 1.
What a distribution tells us
It shows which values are possible, which values are common, and how the total probability is allocated.
The same experiment can define different variables
Two dice
X = the sum of the two dice
Y = the larger of the two values
Z = the number of even dice
The sample space is unchanged, but the distribution and interpretation depend on the numerical rule chosen.
Change the distribution of heads
Change the probability of heads and watch the distribution of X, the number of heads in two tosses.
X = 0
0.250
X = 1
0.500
X = 2
0.250
Key lesson
A random variable turns a complex outcome into one numerical quantity that can be analysed.