Create your own
Lesson illustration

Random Variables: Formal Definition and Intuitive Meaning

Hello! Welcome back to our course on the measure-theoretic foundations of probability.

Introduction

In our last lesson, we assembled the three core components of a modern probability model: the sample space , the σ-algebra of events , and the probability measure . This triple, , provides a rigorous foundation for describing a random experiment and the likelihood of its various outcomes.

However, in statistics, econometrics, and finance, we rarely work with the abstract outcomes directly. Instead, we work with numerical quantities derived from them: the return on a portfolio, the number of customers who default on a loan, or the result of a regression coefficient estimate. The bridge between the abstract probability space and these numerical values is the random variable.

Today's lesson addresses the learning outcome: Describe a random variable formally as a 'measurable function' and explain what this means intuitively in terms of preserving structure. We will see that this formal definition is not a mere technicality, but a crucial requirement that makes the entire theory of probability distributions work.

From Outcomes to Numbers: The Need for a Mapping

Consider a simple experiment, like a single toss of a coin. The sample space is . If we are playing a game where we win £1 for tails and lose £1 for heads, we are implicitly using a function, let's call it , that maps outcomes to numbers:

This function is what we intuitively think of as a random variable. It's a variable whose value depends on the outcome of a random experiment.

Now, a critical question arises. If we want to calculate the probability of an event like "we win money" (i.e., ), we need to find the probability of the set of outcomes in that lead to this result. In this case, that's the set . We can then ask for .

This works smoothly in a finite setting. But what if is uncountable, like the set of all possible future price paths for a stock? Can our function be any arbitrary mapping from to ? The answer is no. We need to impose a condition to ensure that asking questions about the value of always corresponds to a valid event in that we can assign a probability to. This condition is called measurability.

The Measurability Condition

The core issue is this: for any "interesting" set of values on the real line (e.g., an interval like ), we want to be able to compute the probability . This is shorthand for:

The set is called the preimage of under , denoted .

For the probability to be well-defined, the set must be an element of our σ-algebra . If it's not, we have no way of assigning it a probability. Therefore, we must require that our function has the property that it only produces preimages that are "in" . This is the essence of a measurable function.

Probability Theory

Let's look at a formal definition of a random variable and the key condition it must satisfy, from a set of notes from Cornell University.

Read the section 'Random Variables' (about halfway down the first page). Focus on the definition and, in particular, the condition imposed when the codomain is a topological space like ℝ: the function must be 'measurable'.

As the text states, for a real-valued random variable, we require that is a measurable set (an event) for every open set . As we will see, this condition is sufficient to ensure that the preimages of all "interesting" sets (not just open sets) are also measurable.

To build a deeper intuition for why this specific condition is so natural, it's helpful to see how it arises when trying to construct a more powerful theory of integration (the Lebesgue integral), which is a topic we'll explore next.

Lecture 9: Lebesgue Measurable Functions

This segment from an MIT OpenCourseWare lecture on measure theory provides an excellent motivation for the concept of a measurable function. It approaches it from the viewpoint of defining an integral.

Watch from 2:59 to 11:55. The lecturer contrasts Riemann integration (partitioning the domain, or x-axis) with the idea behind Lebesgue integration (partitioning the codomain, or y-axis). The key insight is that to calculate the area by partitioning the codomain, you must be able to find the 'size' (i.e., the measure) of the parts of the domain that map into each slice of the codomain. This requires the preimages to be measurable sets.

The video provides a powerful intuition: the measurability requirement is precisely what's needed to connect the measure on the domain () to values in the codomain ().

Formal Definition and "Structure Preservation"

We can now state the formal definition of a random variable.

254A, Notes 0: A review of probability theory - Terry Tao

With the motivation for measurability in place, let's turn to the formal definition of a random variable from Terry Tao's influential notes on probability theory.

Read 'Definition 3 (Random variable)' in Section 2. Note how it precisely defines a random variable as a measurable map between two measurable spaces.

As Tao defines it, a random variable is a measurable map from a probability space to another measurable space .

  • The domain, , is our familiar sample space and σ-algebra of events.
  • The codomain, , is the space of values the variable can take. For a real-valued random variable, this is , where is the Borel σ-algebra on the real numbers—the σ-algebra generated by all open intervals.

The condition for to be measurable is that for any set , its preimage must be in .

The "Structure Preserving" Intuition

This is where the idea of "preserving structure" comes in. The "structure" on a space in this context is its σ-algebra—the collection of sets we deem measurable.

  • The structure on our codomain is the Borel σ-algebra , which contains all the sets of numbers we could want to ask probability questions about (intervals, single points, unions of intervals, etc.).
  • The structure on our domain is the event space .

A measurable function preserves this structure by ensuring that any measurable set you pick from the codomain's structure () maps back to a measurable set in the domain's structure (). It creates a reliable link between the two structures.

This is perfectly analogous to the concept of a continuous function in topology. A function between two topological spaces is continuous if the preimage of any open set is an open set. Continuity preserves topological structure. In the same way, a measurable function preserves measurable structure.

A key theorem shows that if the preimage property holds for the simple sets that generate the σ-algebra (like open intervals for ), it automatically holds for all sets in the σ-algebra.

Lecture 9: Lebesgue Measurable Functions

This follow-up clip from the same MIT lecture demonstrates how the measurability property propagates from a simple class of sets (intervals) to the entire Borel σ-algebra. This is the technical heart of the 'structure preservation' idea.

Watch from 28:14 to 33:09. The theorem shows that if a function is measurable, the inverse image of any Borel set is measurable. This confirms that our definition is powerful enough to handle any 'reasonable' set of values.

The Payoff: Defining the Distribution of a Random Variable

The entire purpose of this formal machinery is to allow us to do one crucial thing: define the probability distribution of the random variable.

Because we know that for any Borel set , the preimage is a valid event in , we can define a new probability measure, , on the space . This measure is the distribution of .

It is defined as:

This elegant equation is the linchpin connecting the abstract probability measure on to the concrete probability distributions on that you have worked with throughout your studies in statistics and econometrics. When you talk about a random variable being "normally distributed," you are referring to its distribution measure . The formal definition of a random variable as a measurable function is what guarantees that is always well-defined.

Probability Theory

Let's return to the Cornell notes to see this final connection made explicit.

Read the text under 'Definition: Distribution of a Random Variable'. Notice how the distribution P_X is defined using the original probability measure P and the preimage X⁻¹(T). The text explicitly states this works because X is a measurable function.

A Concrete Example

Let's revisit our coin-toss game in this formal light.

  • Probability Space: where , , and .
  • Codomain: .
  • Random Variable: with and .

Is a measurable function? We must check that for any Borel set , the preimage is in .

  • Let . Then , which is in .
  • Let . Then , which is in .
  • Let . Then , which is in .
  • Let . Then , which is in .

Since our is the power set of , any preimage will be in , so is trivially measurable.

Now we can find its distribution, :

  • For any Borel set not containing 1 or -1, .

This is the familiar probability mass function for this simple random variable, now grounded in measure theory.

Understanding Measure Theory and the Lebesgue Integral

This short clip provides another clear summary of a random variable as a measurable function, using the coin-flipping example.

Watch from 15:15 to 16:01. It directly defines a random variable as a measurable function from the sample space to the real numbers and illustrates it with the coin-flipping game.

Conclusion

This lesson has formalized one of the most fundamental concepts in statistics. Let's summarize the key takeaways:

  • A random variable is not just any function from a sample space to the real numbers . It must be a measurable function.
  • A function is measurable if the preimage of any measurable set in the codomain (any Borel set in ) is a measurable set in the domain (an event in ).
  • This "structure-preserving" property is the crucial link that allows us to use the probability measure on the abstract space to define a probability distribution on the concrete space .
  • The distribution is defined by the formula , which is only well-defined because is measurable.

You now have the complete chain of logic: from the foundational probability space , through the measurable function , to the probability distribution that is the object of study in statistics and econometrics.

Preview of the Next Lesson:
The concept of a measurable function was motivated by the desire to build a more powerful theory of integration. In our next lesson, we will directly compare the familiar Riemann integral with the Lebesgue integral, which is built on measure theory. We will see conceptually how the Lebesgue integral's approach of partitioning the codomain makes it far more powerful and general, forming the basis for the definition of expectation in modern probability theory.

Can't find a good explanation? Sign up and we'll make it for you

Sign up