Probability Theory Fundamentals › Random Variables
Quantitative FinanceAll chapters Probability Theory Fundamentals › Random VariablesOne section · Sections in this chapter3 / 15 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
While sample spaces and events provide the conceptual foundation, we typically work with random variables that map outcomes to numbers. This mapping enables mathematical operations like addition, multiplication, and the computation of averages. The transition from abstract outcomes to numerical values makes probability theory quantitative; it lets us apply calculus, linear algebra, and optimization to uncertainty.
A real-valued random variable is a measurable function from a probability space to the real numbers: . Here is the Borel sigma-algebra on , generated by open intervals. In practical terms, measurability ensures that statements such as are events whose probabilities are defined. We use capital letters for random variables and lowercase letters for their realized values.
The definition of a random variable as a function might initially seem abstract, but it captures a natural idea: we take the raw outcomes of a random experiment and translate them into numbers that we can analyze mathematically. The word "variable" reflects that the numerical value varies depending on which outcome occurs. The word "random" indicates that we don't know in advance which outcome will occur.
When we say "let be the daily return of a stock," we mean is a function that, for each possible market scenario , produces a number representing that day's return. Before the market closes, is random because we do not know which will occur. After closing, we observe a specific realization (a 2.3% return). The distinction between and its realized value determines which tools apply. Before observation, we work with probabilities and expectations; after observation, we work with data.
Discrete Random Variables
A discrete random variable takes values from a countable set, such as integers or a finite list. Discrete random variables arise when outcomes fall into distinct categories or when we count occurrences of events. The probability mass function (PMF) specifies the probability of each possible value, giving us a complete description of how probability is distributed across the possible outcomes.
For a discrete random variable , the probability mass function is , giving the probability that equals each specific value .
The PMF answers the most direct question we can ask about a discrete random variable: "What's the probability that takes this particular value?" By specifying these probabilities for every possible value, the PMF provides complete information about the random variable's behavior. The subscript in reminds us which random variable we're describing, since different random variables have different PMFs.
Consider a simplified credit rating model where a bond can be in one of three states at year-end:
import numpy as np
# Credit rating transitions: Upgraded, Unchanged, Downgraded
states = ["Upgraded", "Unchanged", "Downgraded"]
probabilities = np.array([0.15, 0.70, 0.15])
# Verify normalization of these specified nonnegative probabilities
assert np.isclose(probabilities.sum(), 1.0)P(Upgraded) = 0.15 P(Unchanged) = 0.70 P(Downgraded) = 0.15 Sum of probabilities: 1.00

The probabilities sum to 1 because exactly one outcome must occur: this bond will be upgraded, unchanged, or downgraded. The Kolmogorov axioms require the probabilities of this exhaustive list of mutually exclusive outcomes to sum to 1.
Continuous Random Variables
Financial quantities such as returns, prices, and interest rates are often approximated with continuous random variables, even though observed market values may lie on discrete ticks and empirical distributions may contain atoms. A continuous distribution assigns probability zero to each individual point; this property does not require every intermediate real value to belong to its support. When the distribution is absolutely continuous, a probability density function gives interval probabilities by integration.
For an absolutely continuous random variable , the probability density function (PDF) satisfies . For , ; endpoint choices are equivalent because individual points have probability zero.
The PDF represents a fundamentally different concept than the PMF. Rather than giving the probability of exact values (which is zero for continuous variables), the PDF describes how probability is spread across the continuum of possible values. Higher density means probability is more concentrated in that region, while lower density means probability is more dispersed. The integral formula captures this: to find the probability of landing in an interval, we accumulate (integrate) the density across that interval.
The density itself is not a probability; it can exceed 1 for concentrated distributions. Only when we integrate over an interval do we obtain a probability between 0 and 1. Think of density as probability per unit length: a density of 2 at a point does not mean probability 2.
The Cumulative Distribution Function
Both discrete and continuous random variables have cumulative distribution functions, giving a unified way to describe probability distributions. The CDF answers the running question "what's the probability of being less than or equal to this value?" as we move along the number line.
The cumulative distribution function (CDF) of a random variable is:
where:
- : CDF evaluated at , giving a probability between 0 and 1
- : probability that takes a value less than or equal to
- As , (impossible to be below all values)
- As , (certain to be below infinity)
The CDF provides a universal framework for discrete and continuous random variables. It is nondecreasing and right-continuous, with limits 0 as and 1 as . These properties make it useful for computing interval probabilities: for , .
The CDF starts near 0 for very negative values and approaches 1 for large values. If the distribution is absolutely continuous, and almost everywhere. A continuous CDF need not have a density, so this derivative relationship requires the stronger absolute-continuity condition.

