Skip to content

Random variables: a number for each outcome

Textbook

A random variable $X:\Omega\to\mathbb R$ is a function assigning a number to each outcome of a probability experiment. In a finite model, any such rule is admissible. Uppercase $X$ denotes the rule before observation; lowercase $x$ may denote a realized value.

The probability of a value adds the weights of every outcome mapped to it: $P(X=x)=\sum_{\omega:\,X(\omega)=x}p_\omega$. Different outcomes can therefore contribute to the same value. The distribution describes probabilities of the variable’s values.

The notation $X\sim D$ says that $X$ has distribution $D$. Here $\sim$ is neither approximate equality nor asymptotic equivalence. For a fair coin, assigning 1 to heads and 0 to tails gives $P(X=1)=P(X=0)=1/2$.

On general probability spaces, the function must also be measurable: events about its values falling into admissible sets must have probabilities. In this finite example this requirement is automatic.

The event $X\in S$ consists of all outcomes whose numerical images lie in $S$. In a finite model, their probabilities add without double counting because the function gives each outcome exactly one value. Consequently, probabilities of all distinct values of $X$ sum to 1. There may be fewer values than outcomes. An observed value then need not identify the original outcome, even though the forward mapping is completely specified.

Definitions and notation: Mathematics for Computer Science; Mathematics for Machine Learning.

Related concepts: Event probability in a finite model.

In plain language

A recording rule can assign 1 to an even die face and 0 to an odd one. The roll is random, while the fixed rule does not invent answers to suit its mood. Three different faces produce the same 1, so outcome probabilities combine into a distribution of recorded numbers. This translator can lose detail: 1 identifies an even face without recovering its number or introducing extra randomness.

Example

The constructed variable $X$ is 1 on even faces of a fair die and 0 otherwise. The example shows its mapping and distribution.

Random variables: a number for each outcome

Outcomes

Before applying the rule there are six equally likely faces.

Step 1 of 4: Outcomes

Read all steps
  1. Outcomes

    Before applying the rule there are six equally likely faces.

    Faces
    123456
  2. Rule application

    Every face receives a numerical value.

    Faces
    123456
    Values of X
    01current01current01current
  3. Matching outcomes

    Value 1 collects faces 2, 4, and 6.

    Faces for X = 1
    2included4included6included
  4. Distribution

    The two possible values have equal probability.

    Values
    01
    Probabilities
    1/2included1/2included

When collecting the preimage, value one receives three contributions of $1/6$, not one contribution because it appears once in the values table. Zero similarly collects faces 1, 3, and 5. The final probabilities sum to one, checking that no outcome disappeared. With unequal face probabilities, their weights would have to be added instead: counting faces works here specifically because the die is fair.

The outcome, the function of the outcome, and its observed number play different roles in one model.

The original text of this free article is published under CC BY-NC-ND 4.0.

Previous / next

Previous
Statistical independence
Next
Expected value: the mean of a distribution
  • Natural Numbers: Counting Discrete Objects

    Which values count discrete objects, and why the zero convention must be stated.

    Read article
    Math
  • Integers: Counting on Both Sides of Zero

    Positive and negative integers, zero, and the limits of integer division.

    Read article
    Math
  • Rational Numbers: Ratios of Integers

    Numbers as ratios of integers: equivalent fractions and the nonzero denominator requirement.

    Read article
    Math