# nLab random variable

Contents

### Context

#### Measure and probability theory

measure theory

probability theory

# Contents

## Idea

A random variable, or stochastic variable, is a quantity that is subject to ‘random’ variation.

## Definition

The formalization of this idea in modern probability theory (Kolmogorov 33, III) is to take a random variable to be a measurable function $f$ on a probability space $(X,\mu)$ (e.g. Grigoryan 08, 3.2, Dembo 12, 1.2.1).

One thinks of $X$ as the space of all possible configurations (all the “possible worlds” with respect to the idealized situation under consideration), thinks of the measure $\mu(U)$ of any subset of it as the probability that one of the configurations $x \in U \subset X$ is randomly realized, and thinks of $f(x)$ as the value of the given random variable in the situation of that configuration.

Accordingly for instance the expectation value of the random variable $f$ is the integral

$\langle f \rangle \coloneqq \int_X f \cdot \mu$

of $f$ against the probability measure, i.e. the average value of the random variable over all possible configuration, weighted by their probability.

## Properties

### Relation to type theoretic constructions

There is at least some similarity of the concept of random variables to usage of the function monad (“reader monad”) in the context of monads in computer science.

In Verdier 14 it says:

The intuition behind the Reader monad, for a mathematician, is perhaps stochastic variables. A stochastic variable is a function from a probability space to some other space. So we see a stochastic variable as a monadic value.

you could interpret this by regarding random variables as reader monad computations.

See also (Toronto-McCarthy 10b, slide 24). Toronto-McCarthy 10a, 2.2, Toronto 14 call the function monad the random variable idiom.

### Random variables and Dedekind reals

Given a measure space $(X,\Sigma,\mu)$, a random variable is also often defined as an equivalence class of measurable real-valued functions on $X$ where two such functions are identified when they differ only on a subset of measure zero.

In this context, it has been observed by P. Deligne1 that the po-set of measurable subsets $\Sigma$ can be equipped with a suitable Grothendieck topology.

In the resulting Grothendieck topos $Meas(X,\Sigma,\mu)$ the object of Dedekind real numbers $R_D$ corresponds to the sheaf of random variables on $X$ in this sense.

A Dedekind real in a topos $Sh(X)$ of sheaves on a topological space is just a continuous real-valued function on $X$. This suggests the view that the sheaf-theoretic perspective on $(X,\Sigma,\mu)$ sweeps the measure-theoretic details under the rug and brings out the conceptual essence of a random variable as simply a real-valued ‘function’ or ‘variable real number’ on $X$ and goes in the same direction as the connection to the function monad mentioned in the previous section.

The details of this example, due to D. Scott, are described in (Johnstone 1977, p.213).

## References

The modern formal concept originates around

• Andrey Kolmogorov, Grundbegriffe der Wahrscheinlichkeitsrechnung, Ergebnisse der Mathematik und Ihrer Grenzgebiete, Springer Berlin Heidelberg 1933.

Surveys and lecture notes include

• Alexander Grigoryan, Measure theory and probability, 2008. (pdf)

• Amir Dembo, Probability theory, 2012. (pdf)