Random Variables
Suppose two dice are rolled and you care only about their sum. The underlying outcome is a pair like . But your interest lives entirely in the number . This gap — between the raw, often unwieldy sample space and the numerical summaries we actually reason about — is exactly what the concept of a random variable is built to close. A random variable is not "variable" in the algebraic sense. It is also not random in the sense of being undefined. Instead, it is a completely determined function. Its "randomness" is inherited entirely from the probabilistic structure of the space it maps from. This matters because almost nothing in applied probability is stated in terms of raw outcomes. We ask for the probability that a sum exceeds . We ask whether a queue has more than three customers. We ask if a stock return is negative. These are all statements about numbers, not about elements of an abstract . To make such statements rigorous, we need the pullback to always be an event. This ensures can assign it a probability. That single requirement — measurability — is the entire technical content of the definition. It is what allows every subsequent object (distributions, expectations, densities) to be built on solid ground. The big picture: probability theory begins with . This is an abstract measure-theoretic scaffold established once and for all by The Axioms of Probability. Random variables are the bridge that lets us transport this abstract machinery onto the real line. There, calculus, algebra, and ordinary numerical intuition apply. Once a random variable is fixed, it induces its own probability measure on — the law of . The study of random variables becomes, in large part, the study of these induced measures. This happens via distribution functions, densities, and mass functions. This article gives the precise definition of a random variable as a measurable function. It explains why measurability is not a technicality but a load-bearing requirement. It proves the key structural theorem that guarantees induced probabilities are well-defined. It also works through examples with genuinely non-symmetric numbers. It closes by pointing toward the two natural next steps. These are the discrete theory built from probability mass functions, and the general theory built from cumulative distribution functions.
- A random variable is a function , not a number and not literally random.
- The defining requirement is measurability: for every real .
- Measurability is exactly what is needed so that makes sense for events built from .
- Every random variable induces a probability measure on called its law or distribution.
- Sums, products, and (measurable) functions of random variables are again random variables.
- Key idea: randomness lives in on ; is a fixed rule that transports it to the real line.
Where this lives today
The measurable-function definition of a random variable is not merely a formality — it is the load-bearing structure underneath essentially all of modern quantitative science. In statistics, every estimator (a sample mean, a maximum-likelihood estimate) is itself a random variable, a measurable function of the data, and its sampling distribution is exactly the induced law described here. In stochastic processes and mathematical finance, an entire process is a family of random variables indexed by time, and questions about stopping times or filtrations hinge on which -algebra each is measurable with respect to — directly generalizing the single-variable definition above. In information theory and machine learning, random variables model both noisy data and internal randomness of algorithms (e.g. random initializations, stochastic gradient noise), with measurability ensuring quantities like cross-entropy loss are well-defined expectations. In statistical physics, macroscopic observables (energy, magnetization) are random variables on a microstate space, exactly mirroring the abstract--to- structure introduced here. In cryptography, the security of a scheme is often phrased via random variables representing an adversary's view or output, with measurability guaranteeing that "probability of successful attack" is a well-posed number rather than an ill-defined heuristic.
Ask the tutor: How does the choice of -algebra change which functions on qualify as random variables?
Let be a probability space, where is the sample space, is a -algebra of events on , and is a probability measure on . A random variable is a function
such that for every ,
A function satisfying this condition is called -measurable (or Borel measurable, since it is equivalent to measurability with respect to the Borel -algebra generated by intervals). We write as shorthand for the event above, and more generally for whenever is a Borel set.
Intuition
Think of as the true, possibly enormous or unstructured, space of outcomes: a sequence of coin flips, a random path of a particle, a hand of cards. The probability measure lives on and encodes everything about the experiment's uncertainty. A random variable is a reading device: it looks at an outcome and reports a single real number , deterministically and always the same way. Roll the same two dice showing the same faces twice — you get the same sum both times. The variable does not "choose" a value; the outcome does, and just reads it off. Why require measurability? Because the only thing we know how to compute probabilities for are elements of . If we want to ask "what is ?", this question is only meaningful if the underlying set of outcomes is itself an event — a member of that knows how to measure. Measurability guarantees this for every real threshold , and (as the theorem below shows) that guarantee automatically extends to every Borel set, which is essentially every set of reals one could reasonably want to consider.
Let be a measurable space and let be a function. The following are equivalent: 1. for every . 2. for every Borel set . Consequently, if is a random variable, then defines a well-defined probability measure on , called the law (or distribution) of .
Technique: the good-sets (Dynkin -) principle, applied to show a collection of "good" Borel sets is a -algebra containing a generating class.
(2) (1). Every interval is a Borel set, since Borel sets are generated by such intervals (or, equivalently, by open sets, and each is a countable intersection of open sets ). So (2) applied to immediately gives (1). This direction requires no further argument.
(1) (2). This is the substantive direction. Define
We show is a -algebra on containing every interval ; since is by definition the smallest -algebra containing these intervals, this forces , which is exactly claim (2). Step 1: contains the generating intervals. By hypothesis (1), for every . Step 2: contains . Since (as is a -algebra on ), we have . Step 3: is closed under complementation. Suppose , so . The key set-theoretic fact about preimages is
Since is closed under complements, , hence , i.e. . Step 4: is closed under countable unions. Let . The preimage of a union is the union of preimages:
Indeed lies in the left side iff iff for some iff for some , iff lies in the right side. Since each and is closed under countable unions, the right-hand side is in . Hence . Steps 2–4 show is a -algebra (containing , closed under complements, closed under countable unions — closure under countable intersections then follows from De Morgan's laws applied to Steps 3 and 4). Step 1 shows contains all the intervals . Since is the smallest -algebra containing these intervals and is a -algebra containing them, minimality gives . This proves (1) (2).
Well-definedness of the law. Define for . By the equivalence just proved, for every such , so is a genuine, well-defined number in by the axioms established in The Axioms of Probability. We verify the three probability axioms for :
- Nonnegativity: since on .
- Total mass one: .
- Countable additivity: if are pairwise disjoint Borel sets, then their preimages are pairwise disjoint subsets of (if for then , contradiction). Using the preimage-of-union identity from Step 4 and countable additivity of ,
Hence is a probability measure on .
∎If and are random variables on the same probability space , and is Borel measurable (in particular, if is continuous, monotone, or piecewise continuous with countably many pieces), then , , for , and are all random variables on .
(Proof sketch, stated for completeness — not the focus of this article: one shows using countability of and closure of under countable unions and finite intersections; measurability of follows from and part (2) of the theorem above applied twice, since is Borel whenever is Borel measurable and is Borel.)
Worked examples
Example 1 — A biased, non-symmetric coin-flip random variable. Let with and , . Define
Check measurability directly from the definition: for any ,
Every one of these four possible sets () lies in , so is a random variable. Its law is the Borel measure
a two-point (Bernoulli-type) distribution on , concentrated at and with the given asymmetric weights — illustrating that the numeric values assigned by are irrelevant to which weights attach to which outcome; only the underlying on determines the probabilities. Now compute a genuine probability statement: . Since (as but ), and , this is a legitimate event with . Had mapped and to values with landing outside , this computation would be undefined — which cannot happen here precisely because is the full power set of , but would be a genuine risk on a coarser -algebra (see the counterexample below).
Example 2 — Sum of two non-identical dice, an explicit induced law. Let (36 outcomes), the power set, and suppose the two dice are not fair in the same way: die 1 shows each face with probability (fair), but die 2 is loaded so that face has probability and faces – each have probability (check: ). Assume independence of the two dice, as defined in Independence of Events, so
Define . This is a random variable on trivially, since makes every subset of an event, so every preimage automatically lies in . Compute explicitly. The pairs with and are
Using independence and the two different marginal laws:
Summing with a common denominator of : and each , so
This exhibits the full pipeline: is measurable (trivially, since is the power set), the event is identified explicitly as a subset of , and is computed from the underlying (here asymmetric) measure on — precisely the content of the theorem above applied to the single point .
Consider , each outcome equally likely under the axioms of probability, so for each . Take the coarse -algebra
which is a legitimate -algebra (closed under complements and unions, contains ), representing an observer who can only tell whether the outcome is in or , not the exact outcome. Define itself, i.e. — the identity map. Test measurability at :
That happens to lie in . But test at :
Is ? Scanning the four sets in — — the singleton is not among them. So , and fails to be a random variable on . The failure is not cosmetic. If we tried to ask "?", the set is simply not assigned a probability by on this -algebra — is only defined on , and . There is no consistent way to extend to give a value without additional information, since is compatible with infinitely many different splits between and once we leave . This is exactly why the theorem's hypothesis — measurability with respect to the ambient , not merely with respect to the power set — is not removable: dropping it produces functions for which basic probability statements are simply undefined, not merely hard to compute. By contrast, the coarser function (indicating group membership) is measurable with respect to this same , since is always , , or depending on — all in . This contrast shows measurability is a genuine constraint linking how fine a function's distinctions are to how much the underlying -algebra can "see."
Scope, edge cases & common traps
| Situation | What to check | Common error |
|---|---|---|
| (power set) | Any function is automatically measurable | None — this is the "no traps" case, common in finite/discrete models |
| strictly smaller than | Must verify for every real | Checking measurability at only finitely many and declaring victory |
| Composing | must be Borel measurable, not just any function | Assuming any preserves random-variable status |
| Multiple random variables on different spaces | Sums/products only defined if on the same | Adding random variables from unrelated probability spaces |
| Distinguishing "law of " from " itself" | The law is a measure on ; is a function on | Conflating with its distribution, especially when two different 's share a law |
The mathematician behind it
Origins · 1 minAndrey Nikolaevich Kolmogorov and how this was discovered
Kolmogorov gave probability theory its modern axiomatic, measure-theoretic foundation in his 1933 monograph Grundbegriffe der Wahrscheinlichkeitsrechnung ("Foundations of the Theory of Probability"). Before this work, probability was a loose collection of combinatorial techniques without a unifying rigorous framework; Kolmogorov's insight — importing Lebesgue's measure theory wholesale — made concepts like the random variable as a measurable function, the expectation as a Lebesgue integral, and the strong law of large numbers all provable within a single consistent system. He also made foundational contributions to Markov processes, turbulence, algorithmic complexity (Kolmogorov complexity), and topology, but it is the 1933 axiomatization that underlies every rigorous statement in this article.
Is a random variable actually random?
No — despite the name, is a completely fixed, deterministic function once the experiment's outcome is known. If you roll dice and get , the sum every single time; there is no additional randomness introduced by itself. All of the unpredictability comes from not knowing in advance, which is governed entirely by the probability measure on . The word "random" refers to the fact that the input is drawn according to , and merely transports that uncertainty forward through a fixed rule into a real number.
Why do we need the Borel -algebra on instead of just the power set of ?
The Borel -algebra, generated by intervals, is rich enough to contain every set one encounters in ordinary analysis (open sets, closed sets, countable unions and intersections thereof) while still being small enough to admit a consistent, countably additive measure such as Lebesgue measure. The full power set of is provably too large: assuming the axiom of choice, it contains non-measurable sets (e.g. Vitali sets) on which no translation-invariant countably additive measure can be consistently defined. Restricting to Borel sets sidesteps this pathology entirely while losing nothing needed for probability, calculus, or statistics.
Can two different random variables have the same distribution?
Yes, and this is an important distinction to keep straight. Consider a fair coin with , and define and . Both and have the identical law — a fifty-fifty distribution on — yet they are different functions, and in fact pointwise, so they are perfectly (negatively) correlated rather than equal. Distributional statements alone never determine the pointwise relationship between two random variables; that requires knowing them as functions on the same , or knowing their joint law.
Does every function from to qualify as a random variable?
Only if it is measurable with respect to the given -algebra . When is finite or countable and is taken to be the full power set of (the typical convention in elementary discrete probability), every function automatically satisfies the measurability condition, because every subset of , and hence every preimage, is trivially in . But when is a strictly smaller -algebra — modeling limited information, as in the counterexample above — some functions fail to be measurable and are therefore not valid random variables on that space.
How does this definition connect to discrete random variables and CDFs?
This measurable-function definition is the common foundation from which both major branches of the theory grow. When the range of is finite or countable, one typically studies through its probability mass function , the subject of Discrete Random Variables. When may take a continuum of values, or when one wants a single unified tool that works for any random variable, one studies the function , the cumulative distribution function — whose existence and well-definedness for every real is precisely guaranteed by the measurability condition proved in the theorem above.
Why does the proof use --style "good sets" reasoning instead of just checking a formula?
Because Borel sets in general have no simple closed-form description — they are built by countably many unions, intersections, and complements starting from intervals, and can be extraordinarily complicated. The good-sets technique sidesteps needing an explicit description: instead of checking measurability for each Borel set individually, one shows the collection of sets with the measurability property is itself a -algebra containing the generating intervals. Minimality of the Borel -algebra as "the smallest such collection" then forces every Borel set into that collection automatically. This is a standard, reusable proof pattern throughout measure theory and probability.
Is measurability something I need to check by hand every time I define a random variable?
In practice, almost never, once you know the standard building blocks. Constants, indicator functions of events in , sums, products, limits, and continuous or monotone functions of random variables are all automatically measurable — this is the content of the corollary above and its extensions. Explicit verification "from scratch" (as in the worked examples) is mainly a pedagogical exercise to internalize why the property holds; working probabilists build new random variables from old ones using these closure properties rather than re-checking preimages every time.