Random Variable: From Intuition to Definition
Imagine you're about to toss a coin three times. Before you toss, the outcome is uncertain — it could be HHH, HHT, HTH, HTT, THH, THT, TTH, or TTT. But you're not really interested in the exact sequence. You care about something simpler: how many heads appear.
That number — the count of heads — is a random variable. It's a way of turning a random experiment into a number you can work with.
The Core Idea
A random variable is a rule that assigns a numerical value to each outcome of a random experiment. It's not "random" in the sense of being unpredictable — it's a function. The randomness comes from the experiment, not from the variable itself.
In the coin-toss example:
- Outcome HHH → value 3
- Outcome HHT → value 2
- Outcome HTH → value 2
- Outcome HTT → value 1
- and so on
The same experiment can have many different random variables. You could define:
- X = number of heads
- Y = 1 if the first toss is heads, 0 otherwise
- Z = number of tails minus number of heads
Each is a different function on the same set of outcomes.
The Precise Definition
A random variable is a function X:S→R that assigns a real number X(ω) to every outcome ω in the sample space S.
That's it. Three key points:
- Domain: the sample space S (all possible outcomes of the experiment)
- Codomain: the real numbers R
- Rule: each outcome gets exactly one number
Why This Matters
Before the experiment, you don't know which outcome will occur, so you don't know what value X will take. But you can talk about probabilities: "What's the probability that X=2?" or "What's the probability that X≥1?"
This is the whole point. Random variables let you move from talking about abstract outcomes (like "HTH") to talking about concrete numbers and their probabilities. That's what makes probability a mathematical science rather than just a list of possibilities.
Two Flavors
Random variables come in two types, depending on what values they can take:
Discrete: takes only a finite or countably infinite set of values. Examples: number of heads, number of defective items in a batch, the sum of two dice.
Continuous: can take any value in an interval. Examples: height of a randomly selected student, time until a radioactive atom decays, the exact temperature at noon. …