Skip to content

Random Variables

A random variable is a function that assigns a value to each outcome of a probability experiment. The word “variable” can be misleading: once the outcome is fixed, the value is fixed. The randomness is in which outcome occurs.

The basic form is

X:Ω→R,X:\Omega\to\mathbb R,

where (Ω,F,P)(\Omega,\mathcal F,\mathbb P) is a probability space.

In quantum mechanics, measurement outcomes are described by ordinary probability distributions once the state and measurement have been specified. The observable operator is the quantum object that generates those distributions; the associated outcome value is the classical random variable for that measurement context.

Let (Ω,F,P)(\Omega,\mathcal F,\mathbb P) be a probability space. A real-valued random variable is a measurable function

X:Ω→R.X:\Omega\to\mathbb R.

Measurable means that, for every allowed set of values Δ⊆R\Delta\subseteq\mathbb R,

{ω∈Ω:X(ω)∈Δ}∈F.\{\omega\in\Omega:X(\omega)\in\Delta\} \in \mathcal F.

This condition guarantees that probabilities such as

P(X∈Δ)\mathbb P(X\in\Delta)

are defined.

For elementary discrete examples, measurability is automatic. For continuous examples, it is the reason one uses intervals and Borel sets rather than arbitrary pathological subsets.

The distribution of XX is the probability measure on values induced by XX:

PX(Δ)=P(X∈Δ).\mathbb P_X(\Delta) = \mathbb P(X\in\Delta).

This induced distribution is also called the law of XX.

Two different random variables on different sample spaces can have the same distribution. For many calculations, the distribution is enough. For questions about correlations between several variables, the underlying joint construction matters.

A discrete random variable takes values in a finite or countable set. If the possible values are xix_i, then the distribution is recorded by probabilities

pi=P(X=xi),∑ipi=1.p_i = \mathbb P(X=x_i), \qquad \sum_i p_i=1.

Example: a spin-like two-outcome variable taking values +1+1 and −1-1 can have

P(X=+1)=q,P(X=−1)=1−q.\mathbb P(X=+1)=q, \qquad \mathbb P(X=-1)=1-q.

Its expectation value is

E[X]=q−(1−q)=2q−1.\mathbb E[X] = q-(1-q) = 2q-1.

The distribution is the list of values and probabilities, not just the set of possible values.

A continuous random variable may have a probability density f(x)f(x) such that

P(X∈[a,b])=∫abf(x) dx.\mathbb P(X\in[a,b]) = \int_a^b f(x)\,dx.

The density satisfies

f(x)≥0,∫−∞∞f(x) dx=1.f(x)\ge0, \qquad \int_{-\infty}^{\infty}f(x)\,dx=1.

The probability of an interval is an area under the density. The value f(x0)f(x_0) at one point is not the probability of the exact value x0x_0. The density rules are collected in Probability Densities.

For a normalized position wavefunction, the position measurement has density

f(x)=∣ψ(x)∣2.f(x)=\lvert\psi(x)\rvert^2.

Thus

P(X∈[a,b])=∫ab∣ψ(x)∣2 dx.\mathbb P(X\in[a,b]) = \int_a^b \lvert\psi(x)\rvert^2\,dx.

The quantum page for this setting is Born Rule for Continuous Spectra.

Every real-valued random variable has a cumulative distribution function, or CDF:

FX(x)=P(X≤x).F_X(x) = \mathbb P(X\le x).

For a discrete variable, the CDF jumps at allowed values. For a continuous variable with density ff,

FX(x)=∫−∞xf(t) dt.F_X(x) = \int_{-\infty}^{x} f(t)\,dt.

The CDF is often the most robust way to describe a distribution because it works for discrete, continuous, and mixed cases.

If XX is a random variable and g:R→Rg:\mathbb R\to\mathbb R is a suitable function, then

Y=g(X)Y=g(X)

is another random variable:

Y(ω)=g(X(ω)).Y(\omega) = g(X(\omega)).

Examples include:

  • X2X^2 for squared measurement values;
  • 1A\mathbf 1_A for the indicator of an event;
  • energy as a function of momentum for a classical free particle.

Changing variables in a density requires a Jacobian. Forgetting that Jacobian is one of the most common errors when moving between variables.

Several random variables X,Y,…X,Y,\ldots on the same probability space define a joint random variable

(X,Y):Ω→R2.(X,Y):\Omega\to\mathbb R^2.

The joint distribution assigns probabilities to events such as

{X∈Δ, Y∈Γ}.\{X\in\Delta,\ Y\in\Gamma\}.

Joint distributions are needed for covariance, correlation, conditional probability, and independence. The phrase “on the same probability space” is important: it says the values are being assigned to the same underlying outcome. For the spread and correlation vocabulary, see Variance and Covariance. For conditioning, see Conditional Probability.

This is exactly where quantum mechanics requires care. Not every pair of quantum observables can be treated as simultaneously defined classical random variables; see Classical Probability versus Quantum Probability.

Quantum Observables versus Random Variables

Section titled “Quantum Observables versus Random Variables”

In classical probability, a physical quantity is often modeled directly as a random variable. In quantum mechanics, an observable is represented by a self-adjoint operator, and a state plus a measurement rule induces a probability distribution over outcomes.

For a discrete projective measurement,

A=∑aaPa,A=\sum_a aP_a,

the outcome variable takes values aa with probabilities

P(A=a)=⟨ψ∣Pa∣ψ⟩\mathbb P(A=a) = \langle\psi\vert P_a\lvert\psi\rangle

for a pure state. For a density operator,

P(A=a)=Tr⁡(ρPa).\mathbb P(A=a) = \operatorname{Tr}(\rho P_a).

Once these probabilities are assigned, the measurement outcome can be treated as an ordinary random variable for that experiment. But the operator AA itself is not merely a classical random variable hiding on a universal sample space.

For commuting observables, one can often form a joint projective measurement and a joint distribution. For noncommuting observables, there is generally no single joint distribution that reproduces all measurement statistics without extra structure or altered measurement definitions.

Let a two-outcome measurement have projectors P+P_+ and P−P_-, with possible reported values +1+1 and −1-1. In state ∣ψ⟩\lvert\psi\rangle, define

q=⟨ψ∣P+∣ψ⟩.q = \langle\psi\vert P_+\lvert\psi\rangle.

Then the measurement outcome random variable XX has

P(X=+1)=q,P(X=−1)=1−q.\mathbb P(X=+1)=q, \qquad \mathbb P(X=-1)=1-q.

The expectation value is

E[X]=q−(1−q)=2q−1.\mathbb E[X] = q-(1-q) = 2q-1.

If the observable operator is

A=P+−P−,A=P_+-P_-,

then this same average is

⟨ψ∣A∣ψ⟩.\langle\psi\vert A\lvert\psi\rangle.

For a normalized wavefunction ψ(x)\psi(x), the position outcome is a continuous random variable with density

f(x)=∣ψ(x)∣2.f(x)=\lvert\psi(x)\rvert^2.

The probability of a region Δ\Delta is

P(X∈Δ)=∫Δ∣ψ(x)∣2 dx.\mathbb P(X\in\Delta) = \int_\Delta \lvert\psi(x)\rvert^2\,dx.

The outcome is random; the wavefunction is not itself a random variable. The wavefunction determines the distribution of the position random variable for this measurement.

  • Confusing a random variable with its distribution.
  • Treating a density value f(x)f(x) as the probability of the exact value xx.
  • Forgetting that two variables need a joint probability space before covariance or conditional probability is meaningful.
  • Assuming a quantum observable is automatically a classical random variable before specifying a measurement context.
  • Assigning joint probabilities to noncommuting observables without checking whether a joint measurement exists.
  • Forgetting Jacobians when changing variables.
  • W. Feller, An Introduction to Probability Theory and Its Applications, Volume I, 3rd ed., Wiley, 1968.
  • P. Billingsley, Probability and Measure, 3rd ed., Wiley, 1995.
  • R. Durrett, Probability: Theory and Examples, 5th ed., Cambridge University Press, 2019.
  • R. Shankar, Principles of Quantum Mechanics, 2nd ed., Springer, 1994.
  • A. Peres, Quantum Theory: Concepts and Methods, Kluwer, 1995.
  1. Let Ω={1,2,3,4,5,6}\Omega=\{1,2,3,4,5,6\} for a fair die and X(ω)=ω2X(\omega)=\omega^2. What are the possible values of XX?
Solution

The values are

1,4,9,16,25,36.1,4,9,16,25,36.

Each occurs with probability 1/61/6.

  1. Let Y=1Y=1 for even die outcomes and Y=0Y=0 for odd outcomes. Find E[Y]\mathbb E[Y] for a fair die.
Solution

There are three even outcomes out of six, so

P(Y=1)=12,P(Y=0)=12.\mathbb P(Y=1)=\frac12, \qquad \mathbb P(Y=0)=\frac12.

Therefore

E[Y]=1⋅12+0⋅12=12.\mathbb E[Y] = 1\cdot\frac12 +0\cdot\frac12 = \frac12.
  1. If a continuous random variable has density f(x)f(x), what is P(X=x0)\mathbb P(X=x_0) for an ordinary continuous density?
Solution

For an ordinary density with no point mass,

P(X=x0)=∫x0x0f(x) dx=0.\mathbb P(X=x_0) = \int_{x_0}^{x_0} f(x)\,dx = 0.

The density value f(x0)f(x_0) is not a point probability.

  1. A projective measurement has values a1,a2a_1,a_2 and projectors P1,P2P_1,P_2. In a pure state ∣ψ⟩\lvert\psi\rangle, write the distribution of the outcome random variable.
Solution

The outcome random variable takes values a1a_1 and a2a_2 with probabilities

P(X=a1)=⟨ψ∣P1∣ψ⟩,P(X=a2)=⟨ψ∣P2∣ψ⟩.\mathbb P(X=a_1) = \langle\psi\vert P_1\lvert\psi\rangle, \qquad \mathbb P(X=a_2) = \langle\psi\vert P_2\lvert\psi\rangle.
  1. Why does knowing the separate distributions of XX and YY not determine their covariance?
Solution

Covariance depends on the joint distribution of (X,Y)(X,Y), not only on the marginal distributions of XX and YY separately. Different joint distributions can have the same marginals but different correlations.