Random variable

Definition

A random variable is a measurable function:

X:(Ω,Σ)(C,B(C)),

or

X:(Ω,Σ)(Rn,B(Rn)),

where (Ω,Σ) is a measurable space and B() is the corresponding Borel σ-algebra.
If (Ω,Σ,P) is a probabilistic space, we call X a random variable on P.

Remarks:

  1. Boundedness: The condition supωΩ|X(ω)|< is often added (e.g., for uniform integrability).
  2. A random variable which only takes the values 0 or 1 encodes the same data as an event (more precisely, it is the indicator function χE of a unique event, which takes the value 1 on E and 0 on its complement). More generally, we can construct events from random variables: for any Borel subset ER the preimage X1(E) is an event (the event that X lies in E), often written XE, and so we can consider its probability P(XE).

Probability distribution

Every random variable on a probabilistic space,

X:(Ω,Σ,P)(Rn,B(Rn)),

induces a probability measure μX on (Rn,B(Rn)) by means of the pushforward measure

μX(A)=P(X1(A)).

It is called the distribution of X. There is a relationship between famous probability distributions on R and the Lebesgue measure, fundamental to modern probability theory. Most common continuous distributions, like the Normal, Exponential, and Uniform distributions, are defined by "weighting" the Lebesgue measure with a function. These are called absolutely continuous distributions. The key notion is that of probability density function.

Category theory viewpoint

From a categorical perspective, a random variable

X:(Ω,F,P)(R,B)

is simply a morphism in the category of measurable spaces Meas. Now observe that:

Thus:

In this sense, random variables are not just “values” in R, but morphisms encoding how R is accessed through probabilistic structure. This viewpoint is directly inspired by Yoneda’s lemma, which tells us that an object is completely determined by all its generalized elements (i.e. by all morphisms into it). See category of sets#Generalized elements in other categories.