Course contentsShow
← Mathematics
Lesson 2822 of 3,12156. Probability — Random VariablesFree lesson

Definition of a Random Variable

Understanding random variables as functions that map outcomes to real numbers.

Definition of a Random Variable

What You'll Learn

You'll learn what a random variable actually is: a special function that converts the outcomes of random experiments into numbers we can work with mathematically.

The Core Idea

A random variable is not a "variable" in the algebraic sense—it's actually a function. Specifically, it's a function that takes outcomes from a sample space and maps them to real numbers.

Think of it this way: when you flip a coin, the outcome is "heads" or "tails"—not inherently numerical. But if we want to do calculations, analyze averages, or use mathematical tools, we need numbers. A random variable does exactly this conversion.

Formal Definition

If SS is a sample space from a random experiment, a random variable XX is a function:

X:S→RX: S \rightarrow \mathbb{R}

This means XX assigns a real number to each possible outcome in the sample space.

Simple Example

Consider rolling a standard die. The sample space is S={1,2,3,4,5,6}S = \{1, 2, 3, 4, 5, 6\}.

We could define a random variable XX as "the number showing on the die." Here, X(1)=1X(1) = 1, X(2)=2X(2) = 2, and so on.

Or we could define YY as "1 if the roll is even, 0 if odd." Then Y(2)=1Y(2) = 1, Y(3)=0Y(3) = 0, etc.

Why This Matters

Random variables bridge the gap between abstract outcomes (heads/tails, card suits, medical test results) and numerical analysis. They let us ask quantitative questions like "What's the average value?" or "What's the probability that X>5X > 5?"

Notice we write probabilities involving random variables as P(X=k)P(X = k) or P(X≤k)P(X \leq k)—we're really asking about the probability of the set of outcomes that map to those values.

Key Takeaway: A random variable is a function that assigns a real number to each outcome in a sample space, transforming qualitative results into quantitative data we can analyze mathematically.