Probability Theory Fundamentals › Random Variables

Michael BrenndoerferOctober 19, 20257 min read
Quantitative FinanceAll chapters
Part 1 of 15Mathematical Foundations
Chapter 2Probability Theory Fundamentals › Random Variables
Reading section 3 of 15 · Random Variables · 7 minSection 3 of 15 · 7 min

Book contents

Section 3 of 15 · 7 min read

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.

Random Variable

A real-valued random variable XX is a measurable function from a probability space to the real numbers: X:(Ω,F)→(R,B)X:(\Omega,\mathcal{F})\to(\mathbb{R},\mathcal{B}). Here B\mathcal{B} is the Borel sigma-algebra on R\mathbb{R}, generated by open intervals. In practical terms, measurability ensures that statements such as {X≤x}\{X\leq x\} 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 XX be the daily return of a stock," we mean XX is a function that, for each possible market scenario ω\omega, produces a number representing that day's return. Before the market closes, XX is random because we do not know which ω\omega will occur. After closing, we observe a specific realization x=0.023x = 0.023 (a 2.3% return). The distinction between XX and its realized value xx 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.

Probability Mass Function

For a discrete random variable XX, the probability mass function is pX(x)=P(X=x)p_X(x) = P(X = x), giving the probability that XX equals each specific value xx.

The PMF answers the most direct question we can ask about a discrete random variable: "What's the probability that XX 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 XX in pX(x)p_X(x) 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:

In[3]:
Code
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)
Out[4]:
Console
P(Upgraded) = 0.15
P(Unchanged) = 0.70
P(Downgraded) = 0.15

Sum of probabilities: 1.00
Out[5]:
Visualization
Bar chart showing probabilities for Upgraded (15%), Unchanged (70%), and Downgraded (15%) credit states.
Probability mass function for credit rating transitions. Each bar height represents the probability of that outcome, and the heights sum to 1.

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.

Probability Density Function

For an absolutely continuous random variable XX, the probability density function (PDF) fX(x)f_X(x) satisfies FX(x)=∫−∞xfX(u) duF_X(x)=\int_{-\infty}^{x}f_X(u)\,du. For a≤ba\leq b, P(a<X<b)=∫abfX(x) dxP(a<X<b)=\int_a^b f_X(x)\,dx; 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.

Cumulative Distribution Function

The cumulative distribution function (CDF) of a random variable XX is:

FX(x)=P(X≤x)F_X(x) = P(X \leq x)

where:

  • FX(x)F_X(x): CDF evaluated at xx, giving a probability between 0 and 1
  • P(X≤x)P(X \leq x): probability that XX takes a value less than or equal to xx
  • As x→−∞x \to -\infty, FX(x)→0F_X(x) \to 0 (impossible to be below all values)
  • As x→+∞x \to +\infty, FX(x)→1F_X(x) \to 1 (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 x→−∞x \to -\infty and 1 as x→+∞x \to +\infty. These properties make it useful for computing interval probabilities: for a≤ba\leq b, P(a<X≤b)=FX(b)−FX(a)P(a < X \leq b) = F_X(b) - F_X(a).

The CDF starts near 0 for very negative values and approaches 1 for large values. If the distribution is absolutely continuous, FX(x)=∫−∞xfX(u) duF_X(x)=\int_{-\infty}^{x}f_X(u)\,du and fX=FX′f_X=F_X' almost everywhere. A continuous CDF need not have a density, so this derivative relationship requires the stronger absolute-continuity condition.

Out[6]:
Visualization
Line plot of the standard normal PDF with a vertical line at x = 1 and the area for x ≤ 1 shaded.
Standard normal PDF with shaded area from x = -4 to x = 1, approximating P(X ≤ 1) while omitting the small left tail below -4.
Line plot of the standard normal CDF with vertical and horizontal reference lines marking F(1).
Standard normal CDF with the point F(1) marked.