Concepts / Random Variables

Random Variables

D is the distribution; z ∼ D describes sampling from it.

  • Programming

From Distribution to Sample

Random-variable notation becomes easier when you read it from the distribution outward. Start with D: it names a probability distribution over a set Z. Then read z ∼ D as a sampling statement: z is obtained by sampling according to D. The symbol z does not identify one permanently fixed value. It represents a value whose source is the distribution D.

samplingsamplingsamplingDdistribution over Zz₁probability under Dz₂probability under Dz₃probability under D
How does a distribution D produce a sampled value z, and what does it mean for each possible z to have a corresponding probability?

The main reading rule is: D describes the distribution, and z ∼ D describes the relationship between the variable z and that distribution.

Reading D and z ∼ D

Imagine that D describes how values are selected from a set Z. Writing z ∼ D tells you to regard z as a value obtained by sampling from D. It does not select one permanently fixed value in advance. Instead, it establishes a sampling convention that later expressions can use.

Following the Sampling Convention

Suppose D is a distribution over a set Z, and write z ∼ D. What does a later expression involving z mean?

1. Identify D: D is the distribution that governs how values are selected from Z.

2. Interpret z ∼ D: The variable z is regarded as a value sampled according to D.

3. Use z later: A later function, event, or expectation involving z is evaluated with respect to that sampling convention.

The notation does not describe a fixed value of z. It describes where z comes from and which distribution governs reasoning about it.

Two Questions About a Sample

Once z is understood as sampled from D, later notation can ask different kinds of questions. Expected-value notation summarizes a real-valued function of the sampled variable. Probability notation for an event summarizes how often a Boolean condition is true.

summarizesmeasuresE_{z ∼ D}[f(z)]expected value of areal-valued functionreal valuesummary of f(z)Pr_{z ∼ D}[f(z)]probability that a Booleancondition is trueprobabilitychance the condition istrue
What is the difference between averaging a numeric random variable, such as E[z], and measuring the chance of an event, such as Pr[z ∈ A]?
NotationWhat it describesWhat to ask
E_{z ∼ D}[f(z)]The expected value of a real-valued function of zWhat value does f(z) summarize on average under D?
Pr_{z ∼ D}[f(z)]The probability that a Boolean condition is trueHow often is the condition f(z) true under D?

Separating an Average from an Event

Read the difference between E_{z ∼ D}[f(z)] and Pr_{z ∼ D}[f(z)].

Expected value: In E_{z ∼ D}[f(z)], f is treated as a real-valued function. The notation summarizes the expected value of the result of applying f to a sample from D.

Event probability: In Pr_{z ∼ D}[f(z)], f is treated as a Boolean condition. The notation summarizes the probability that the condition is true for a sample from D.

Context shorthand: When the dependence on z and its distribution is already clear, E[f] may be used as shorter notation for the same expected quantity.

Expected-value notation averages a real-valued result; probability notation measures the chance that a condition holds.

Building D^m

A single sampled variable is not the only object that can have a distribution. If m points are sampled from D, the resulting object is an m-component tuple written as (z₁, …, zₘ). The notation D^m refers to the probability over the larger space Z^m induced by this sampling process.

draw 1draw 2draw mcombinecombinecombineinducesDdistribution over Zz₁sampled from D(z₁, …, zₘ)point in Z^mD^mprobability over Z^mz₂sampled independently fromDzₘsampled independently fromD
What does D^m represent, and how do m separate independent draws from D become a sample tuple?

Interpreting D^m

Suppose m points are sampled from D independently. What object is described by D^m?

1. Make individual draws: Each component zᵢ is sampled from D.

2. Form the tuple: The individual samples are collected as (z₁, …, zₘ), an m-component point in Z^m.

3. Identify the induced distribution: D^m describes the probability over these m-component tuples that is induced by the independent sampling process.

D governs individual samples from Z, while D^m governs the larger space Z^m of m-component sample tuples.

Common Reading Errors

  • Treating z ∼ D as if it named one permanently fixed value.

    The notation tells you that z is regarded as a value obtained by sampling from D.

    Fix: Keep the distribution context active whenever you interpret a later expression involving z.

  • Confusing an expected value with an event probability.

    Expected value summarizes a real-valued function, whereas probability notation summarizes when a Boolean condition is true.

    Fix: Check whether the expression is averaging a numeric result or measuring the chance that a condition holds.

  • Interpreting D^m as another individual sample from D.

    D^m describes a probability over m-component tuples in Z^m produced by independent sampling.

    Fix: Expand the notation mentally as separate samples z₁ through zₘ collected into the tuple (z₁, …, zₘ).

  • Ignoring the distribution subscript in an expectation.

    The subscript identifies the distribution governing the variable inside the brackets.

    Fix: Use the subscript to identify which sampling process determines the expected value, unless the context already makes it clear.

Practice the Notation

MEDIUM

For each expression, identify whether it describes a sampled variable, an expected value, an event probability, or a distribution over tuples: z ∼ D; E_{z ∼ D}[f(z)]; Pr_{z ∼ D}[f(z)]; D^m.

Hints
  • Start by identifying the role of D.
  • For the expressions with brackets, ask whether the inside describes a real-valued function or a Boolean condition.
  • For D^m, look for the larger space and the tuple produced by repeated sampling.

Practice Answer

Classify z ∼ D, E_{z ∼ D}[f(z)], Pr_{z ∼ D}[f(z)], and D^m.

z ∼ D: This states that z is sampled according to D.

E_{z ∼ D}[f(z)]: This is an expected-value expression for a real-valued function of a sample from D.

Pr_{z ∼ D}[f(z)]: This is an event-probability expression for the condition f(z) being true under the sampling convention.

D^m: This is the induced probability over m-component tuples in Z^m formed from independent samples from D.

The notation changes meaning according to whether it establishes sampling, summarizes numeric values, measures a Boolean event, or describes repeated sampling over tuples.

Key Takeaways

  1. D is a probability distribution over a set Z.
  2. z ∼ D says that z is sampled according to D; it does not identify one permanently fixed value.
  3. E_{z ∼ D}[f(z)] summarizes the expected value of a real-valued function of the sampled variable.
  4. Pr_{z ∼ D}[f(z)] summarizes the probability that a Boolean condition is true.
  5. D^m describes the induced probability over m-component tuples in Z^m formed by independent sampling from D.

Key Takeaways

  • Read D first: it names the distribution over the set Z.
  • Read z ∼ D as a sampling relationship between z and D.
  • Separate expected-value notation from event-probability notation by asking whether the expression summarizes a real-valued result or a Boolean condition.
  • Interpret D^m as the probability over m-component tuples induced by independent samples from D.