foundations of probability
Random Variables
You should know: sample space, functions
Overview
A random variable is a mathematical formalization of a quantity or object which depends on random events. The term 'random variable' in its mathematical definition refers to neither randomness nor variability but instead is a function whose domain is the set of possible outcomes in a sample space and whose range is typically a subset of the real numbers. A random variable lets us attach a number to every outcome of an experiment, so we can apply arithmetic, calculus, and statistics to what would otherwise just be abstract outcomes.
Intuition
A sample space can contain outcomes that aren't numbers at all — {Heads, Tails}, or a deck of cards. A random variable is the bridge that converts those outcomes into numbers so we can do math with them: 'let X be the number of heads in 3 coin flips' assigns the number 0, 1, 2, or 3 to every possible sequence of flips. Once outcomes become numbers, you can ask for averages, spreads, and probabilities of numeric ranges — questions that don't even make sense on raw outcomes like 'Heads'.
Interactive Graph
Formal Definition
A random variable X is a measurable function from a sample space Ω to a measurable space E (usually the real numbers ℝ). For a set S of possible values, the probability that X falls in S is defined via the underlying probability measure on Ω:
X maps each outcome ω in the sample space to a value in E
Most commonly, E is the set of real numbers
The probability that X takes a value in S is the probability of the set of outcomes mapping into S
A common shorthand: the probability that X equals a specific value
Notation
| Notation | Meaning |
|---|---|
| A random variable (capital letters denote random variables, lowercase their realized values) | |
| A specific value that X can take | |
| The probability mass function value for a discrete random variable | |
| The probability density function of a continuous random variable X | |
| The cumulative distribution function (CDF) of X |
Properties
Discrete vs. continuous
CDF is non-decreasing
PMF normalization
Condition: for discrete X
PDF normalization
Condition: for continuous X
Applications
Worked Examples
Sample space: Ω = {HH, HT, TH, TT}, each with probability 1/4.
Group outcomes by the value of X.
Answer: PMF: P(X=0)=1/4, P(X=1)=1/2, P(X=2)=1/4.
Practice Problems
A fair six-sided die is rolled; let X be the value shown. What is P(X ≤ 4)?
Which best describes the difference between a discrete and a continuous random variable?
Classify each as a discrete or continuous random variable: (a) number of cars passing a toll in an hour, (b) the exact wait time until the next car, (c) daily rainfall in mm.
Common Mistakes
Thinking P(X=x) is meaningful and nonzero for a continuous random variable at any specific x.
For continuous random variables, P(X=x) = 0 for any single point x; only probabilities over intervals, like P(a ≤ X ≤ b), are meaningful (computed by integrating the PDF).
Confusing the random variable X (a function) with its realized numeric value x (an outcome).
X is the mapping from outcomes to numbers; x is a particular number X might equal. This is why we write P(X=x), not P(x=x).
Quiz
Summary
- A random variable X is a function from the sample space Ω to the real numbers.
- Discrete random variables are described by a probability mass function (PMF); continuous ones by a probability density function (PDF).
- The cumulative distribution function F_X(x) = P(X ≤ x) is non-decreasing and works for both discrete and continuous variables.
- For continuous random variables, individual points have probability zero — only intervals carry positive probability.
- Random variables let us apply algebra, calculus, and statistics to the outcomes of random experiments.
References
- WebsiteWikipedia — Random variable
Mathematics