Random Variables and Distributions

⚡ Key Takeaways

A random variable is a measurable function assigning numbers to outcomes of a random experiment; its distribution describes how probability is spread over those numbers. Key result: every random variable is fully characterized by its cumulative distribution function (CDF), and integrable functions of it have well-defined expectations. Applies wherever uncertainty is quantified — statistics, physics, finance, machine learning. Foundational since Kolmogorov's 1933 axiomatization.

💡 The Core Insight

A random variable separates the mechanism of randomness (the sample space Ω\Omega and its measure) from the numerical observable we care about. Once we have the distribution of XX, the original Ω\Omega can be forgotten entirely. All probabilistic questions about XX — its mean, variance, the chance it exceeds a threshold — depend only on the distribution, not on the underlying experiment. This is why a "fair die" and a "spinner landing in six equal sectors" are interchangeable: same distribution, same probabilistic content.

Formal Statement

DefinitionProbability Space

A probability space is a triple (Ω,F,P)(\Omega, \mathcal{F}, P) where:

  • Ω\Omega is the sample space (set of all outcomes),
  • F\mathcal{F} is a σ\sigma-algebra of subsets of Ω\Omega (the events), closed under complement and countable union,
  • P:F→[0,1]P:\mathcal{F}\to[0,1] is a probability measure with P(Ω)=1P(\Omega)=1 and countable additivity.
1
P ⁣(⋃i=1∞Ai)=∑i=1∞P(Ai),for disjoint Ai∈F.\quad P\!\left(\bigcup_{i=1}^{\infty} A_i\right) = \sum_{i=1}^{\infty} P(A_i), \quad \text{for disjoint } A_i \in \mathcal{F}.

Derivation hint: This is the countable additivity axiom itself; disjointness ensures no outcome is double-counted.

DefinitionRandom Variable

A random variable is a function X:Ω→RX:\Omega\to\mathbb{R} that is measurable: for every x∈Rx\in\mathbb{R},

2
{ω∈Ω:X(ω)≤x}∈F.\quad \{\omega\in\Omega : X(\omega)\le x\} \in \mathcal{F}.

Derivation hint: We require preimages of (−∞,x](-\infty,x] to be events so that P(X≤x)P(X\le x) is defined; these sets generate the Borel σ\sigma-algebra, so all Borel preimages become measurable. Here X(ω)X(\omega) is the numerical value observed when outcome ω\omega occurs. The measurability condition guarantees every "interesting" set {X∈B}\{X \in B\} for Borel BB is an event.

DefinitionCumulative Distribution Function

The CDF of XX is

3
FX(x)=P(X≤x)=P({ω:X(ω)≤x}).\quad F_X(x) = P(X\le x) = P\big(\{\omega: X(\omega)\le x\}\big).

Derivation hint: Compose the measure PP with the preimage from [2]; well-definedness is exactly the measurability requirement. Every CDF satisfies: (i) non-decreasing, (ii) right-continuous, (iii) lim⁡x→−∞FX(x)=0\lim_{x\to-\infty}F_X(x)=0 and lim⁡x→+∞FX(x)=1\lim_{x\to+\infty}F_X(x)=1.

TheoremCharacterization of Distributions

A function F:R→[0,1]F:\mathbb{R}\to[0,1] is the CDF of some random variable if and only if it is non-decreasing, right-continuous, and has limits 00 at −∞-\infty and 11 at +∞+\infty. The distribution (the induced measure PX(B)=P(X∈B)P_X(B)=P(X\in B) on Borel sets) is uniquely determined by FF.

DefinitionDiscrete and Continuous Types
  • Discrete: XX takes values in a countable set; described by a probability mass function (PMF) pX(x)=P(X=x)p_X(x)=P(X=x), with ∑xpX(x)=1\sum_x p_X(x)=1.
  • Continuous (absolutely continuous): FXF_X has a probability density function (PDF) fX≥0f_X\ge 0 with
4
FX(x)=∫−∞xfX(t) dt,∫−∞∞fX(t) dt=1.\quad F_X(x) = \int_{-\infty}^{x} f_X(t)\,dt, \qquad \int_{-\infty}^{\infty} f_X(t)\,dt = 1.

Derivation hint: FXF_X absolutely continuous ⇒\Rightarrow by Lebesgue's differentiation theorem fX=FX′f_X = F_X' exists a.e. and integrates back to FXF_X. For continuous XX, P(X=x)=0P(X=x)=0 for each point; probability lives in intervals: P(a<X≤b)=FX(b)−FX(a)P(a<X\le b)=F_X(b)-F_X(a).

DefinitionExpectation and Variance

The expectation (mean) of XX, when it exists, is

5
E[X]=∫ΩX dP=∫−∞∞x dFX(x)={∑xx pX(x)discrete∫−∞∞x fX(x) dxcontinuous\quad \mathbb{E}[X] = \int_{\Omega} X\,dP = \int_{-\infty}^{\infty} x\,dF_X(x) = \begin{cases}\sum_x x\,p_X(x) & \text{discrete}\\[4pt] \int_{-\infty}^{\infty} x\,f_X(x)\,dx & \text{continuous}\end{cases}

Derivation hint: The middle form is a Lebesgue–Stieltjes integral against FXF_X; it specializes to a sum or ordinary integral depending on whether FXF_X jumps or is smooth. The variance measures spread:

6
Var⁡(X)=E[(X−E[X])2]=E[X2]−(E[X])2.\quad \operatorname{Var}(X) = \mathbb{E}\big[(X-\mathbb{E}[X])^2\big] = \mathbb{E}[X^2] - (\mathbb{E}[X])^2.

Derivation hint: Expand (X−μ)2=X2−2μX+μ2(X-\mu)^2 = X^2 - 2\mu X + \mu^2 and use linearity with E[X]=μ\mathbb{E}[X]=\mu constant.

Why It Holds / Derivation

ProofLaw of the Unconscious Statistician (LOTUS)

Claim: For a measurable g:R→Rg:\mathbb{R}\to\mathbb{R}, E[g(X)]=∫−∞∞g(x) dFX(x)\mathbb{E}[g(X)] = \int_{-\infty}^{\infty} g(x)\,dF_X(x) — i.e. we can integrate against the distribution of XX without knowing Ω\Omega. 1. By definition E[g(X)]=∫Ωg(X(ω)) dP(ω)\mathbb{E}[g(X)] = \int_\Omega g(X(\omega))\,dP(\omega), an integral over the abstract space. 2. The random variable XX pushes PP forward to a measure PXP_X on R\mathbb{R} via PX(B)=P(X−1(B))P_X(B)=P(X^{-1}(B)). 3. Change of variables for pushforward measures: for any measurable h≥0h\ge 0,

∫Ωh(X(ω)) dP(ω)=∫Rh(x) dPX(x).\int_\Omega h(X(\omega))\,dP(\omega) = \int_{\mathbb{R}} h(x)\,dP_X(x).

This holds first for indicators h=1Bh=\mathbf{1}_B (where it is exactly the definition of PXP_X), then for simple functions by linearity, then for general h≥0h\ge 0 by monotone convergence, then for signed hh by splitting into positive and negative parts. 4. Setting h=gh=g and recognizing PXP_X as the measure with CDF FXF_X gives

E[g(X)]=∫Rg(x) dPX(x)=∫−∞∞g(x) dFX(x).■\mathbb{E}[g(X)] = \int_{\mathbb{R}} g(x)\,dP_X(x) = \int_{-\infty}^\infty g(x)\,dF_X(x). \qquad \blacksquare

The phrase "unconscious statistician" reflects that practitioners use this formula instinctively, often unaware that a measure-theoretic theorem justifies it.

∎
AK
Andrey Kolmogorov
1903–1987

Kolmogorov's 1933 monograph Grundbegriffe der Wahrscheinlichkeitsrechnung placed probability on measure-theoretic foundations, defining a random variable precisely as a measurable function on a probability space. Before him, probability lacked a rigorous axiomatic basis and was riddled with paradoxes (Bertrand's paradox, ambiguous "geometric probability"). Kolmogorov's framework unified discrete and continuous probability under one roof, made conditional expectation rigorous, and connected probability to analysis, enabling the modern theories of stochastic processes, ergodic theory, and information.

Building Intuition

🧠 Intuition

Think of the sample space Ω\Omega as a bag of all possible "states of the world," each with a probability weight. A random variable is a measuring instrument: you reach into the bag, pull out a state ω\omega, and read off a number X(ω)X(\omega). The distribution is the histogram you'd build by repeating this enormously many times. The CDF FX(x)F_X(x) answers "what fraction of the weight sits at or below xx?" — it sweeps from 0 (far left) to 1 (far right). A jump in FXF_X means a lump of probability sits exactly at that point (discrete atom). A smooth rise means probability is smeared out (density). The steepness of the rise is exactly the density fXf_X: where FXF_X climbs fast, values are likely. Expectation is the balance point of the histogram — where it would teeter on a knife-edge. Variance is the average squared distance from that balance point: small variance means a tall thin pile near the mean; large variance means a wide flat spread.

Figure
CDF and PDF of a continuous random variable: the density is the slope of the CDF
CDF F(x) and its slope = PDF f(x) 1 0 F(x) slope=f(x) x f(x) P(a<X<b)=∫f

Worked Examples

ExampleDiscrete: Expected value of a biased die

Given: A four-sided die with PMF p(1)=0.1, p(2)=0.2, p(3)=0.3, p(4)=0.4p(1)=0.1,\ p(2)=0.2,\ p(3)=0.3,\ p(4)=0.4.

Find: E[X]\mathbb{E}[X] and Var⁡(X)\operatorname{Var}(X).

Steps: 1. Check normalization: 0.1+0.2+0.3+0.4=1.00.1+0.2+0.3+0.4 = 1.0 ✓ 2. Mean via [5]:

E[X]=1(0.1)+2(0.2)+3(0.3)+4(0.4)=0.1+0.4+0.9+1.6=3.0.\mathbb{E}[X] = 1(0.1)+2(0.2)+3(0.3)+4(0.4) = 0.1+0.4+0.9+1.6 = 3.0.

3. Second moment:

E[X2]=1(0.1)+4(0.2)+9(0.3)+16(0.4)=0.1+0.8+2.7+6.4=10.0.\mathbb{E}[X^2] = 1(0.1)+4(0.2)+9(0.3)+16(0.4) = 0.1+0.8+2.7+6.4 = 10.0.

4. Variance via [6]: Var⁡(X)=10.0−3.02=10.0−9.0=1.0\operatorname{Var}(X)=10.0 - 3.0^2 = 10.0 - 9.0 = 1.0.

Answer: E[X]=3.0,Var⁡(X)=1.0,σ=1.0\boxed{\mathbb{E}[X]=3.0,\quad \operatorname{Var}(X)=1.0,\quad \sigma=1.0} (dimensionless pip-count).

ExampleContinuous: Exponential waiting time

Given: X∼Exponential(λ)X\sim\text{Exponential}(\lambda) with density f(x)=λe−λxf(x)=\lambda e^{-\lambda x} for x≥0x\ge 0, λ=2 hr−1\lambda = 2\ \text{hr}^{-1} (e.g. customer arrivals).

Find: FXF_X, E[X]\mathbb{E}[X], and P(X>1 hr)P(X>1\text{ hr}).

Steps: 1. CDF via [4]: FX(x)=∫0x2e−2t dt=1−e−2xF_X(x)=\int_0^x 2e^{-2t}\,dt = 1 - e^{-2x} for x≥0x\ge 0. 2. Mean via [5] (integration by parts):

E[X]=∫0∞x⋅2e−2x dx=1λ=12=0.5 hr.\mathbb{E}[X]=\int_0^\infty x\cdot 2e^{-2x}\,dx = \frac{1}{\lambda} = \frac{1}{2} = 0.5\ \text{hr}.

3. Tail probability: P(X>1)=1−FX(1)=e−2(1)=e−2≈0.1353P(X>1) = 1 - F_X(1) = e^{-2(1)} = e^{-2} \approx 0.1353.

Answer: E[X]=0.5 hr,P(X>1 hr)≈0.135\boxed{\mathbb{E}[X]=0.5\ \text{hr},\quad P(X>1\ \text{hr}) \approx 0.135}.

Common Misconceptions

⚠️ Common mistake

A density is not a probability. For a continuous random variable, fX(x)f_X(x) can exceed 1 (e.g. a Uniform(0,0.5)(0,0.5) density equals 2 everywhere on its support). Only integrals of fXf_X over intervals are probabilities. Likewise, P(X=x)=0P(X=x)=0 for continuous XX does not mean the value xx is impossible — it means it has zero measure, a subtle distinction. Impossible events have probability 0, but probability-0 events need not be impossible.

⚠️ Common mistake

Expectation may not exist. Not every random variable has a finite (or even defined) mean. The integral in [5] requires E[∣X∣]<∞\mathbb{E}[|X|]<\infty. When this fails, statements like "the average of XX" are meaningless, and the Law of Large Numbers does not apply in its usual form.

CounterexampleCauchy distribution: no mean

Let XX have the standard Cauchy density f(x)=1π(1+x2)f(x)=\dfrac{1}{\pi(1+x^2)}. Then

∫−∞∞∣x∣ 1π(1+x2) dx=2π∫0∞x1+x2 dx=1π[ln⁡(1+x2)]0∞=∞.\int_{-\infty}^{\infty} |x|\,\frac{1}{\pi(1+x^2)}\,dx = \frac{2}{\pi}\int_0^\infty \frac{x}{1+x^2}\,dx = \frac{1}{\pi}\big[\ln(1+x^2)\big]_0^\infty = \infty.

So E[∣X∣]=∞\mathbb{E}[|X|]=\infty and E[X]\mathbb{E}[X] is undefined. Sample averages of Cauchy data do not converge to any number — they keep fluctuating with the same Cauchy distribution. This dramatically refutes the intuition that "averaging always stabilizes."

Connections

connection

Random variables are the atoms from which the entire probabilistic edifice is built. The CDF connects to Cumulative Distribution Functions and Lebesgue–Stieltjes integration. Sums of independent random variables lead to Convolution of Distributions and the Central Limit Theorem. Conditional structure between several random variables is formalized in Joint Distributions and Independence, while the long-run behavior of averages appears in the Law of Large Numbers. The transform machinery — Moment Generating Functions and characteristic functions — uses LOTUS [3]–[5] to encode distributions analytically.

Real-World Applications

🔬 Where this appears

Historical Development

⏳ History
- 1654 — Pascal and Fermat exchange letters on the problem of points, computing expected values of gambling outcomes — the implicit birth of expectation.
- 1713 — Jacob Bernoulli's Ars Conjectandi proves the (weak) Law of Large Numbers for binomial trials, the first limit theorem for a random variable's average.
- 1733–1812 — De Moivre and Laplace develop the Normal approximation to the binomial, an early Central Limit Theorem.
- 1809 — Gauss introduces the Normal distribution in the theory of measurement errors.
- 1900s — Borel and Lebesgue develop measure theory and the Lebesgue integral, the analytic tools probability needed.
- 1909 — Borel's strong law for binary digits foreshadows almost-sure convergence.
- 1933 — Kolmogorov's Grundbegriffe axiomatizes probability: random variable = measurable function, distribution = pushforward measure.
- 1937 — Cramér and Lévy systematize characteristic functions and distribution theory.
- 1950s onward — Doob, Itô, and others extend the framework to stochastic processes, turning random variables into the building blocks of modern probability.

Subtleties & Limits

open-problem

Several deep subtleties surround even this elementary topic. (1) Non-measurable functions: with the Axiom of Choice one can construct sets (Vitali sets) and functions on [0,1][0,1] that are not measurable, hence not random variables — these have no well-defined probability, exposing the role of set-theoretic foundations. (2) Singular continuous distributions: there exist CDFs (e.g. the Cantor function) that are continuous yet have no density and no atoms — they are neither discrete nor absolutely continuous, defying the textbook dichotomy. (3) Existence of moments: characterizing which transforms (moment problem) uniquely determine a distribution from its moments is subtle — the lognormal distribution is famously not determined by its moments. (4) Infinite-dimensional analogues: defining "random functions" or measures on function spaces (Gaussian processes, Brownian motion) requires substantial extra machinery (Kolmogorov extension theorem) and motivates ongoing research in stochastic analysis.

See Also

Cumulative Distribution Functions · Moment Generating Functions · Convolution of Distributions · Joint Distributions and Independence · Central Limit Theorem · Law of Large Numbers · Measure Theory Basics · Conditional Expectation