Random variables and expectation §
A random variable is a measurable function from a sample space to a numerical space. Expectation, variance, and higher moments summarize its distribution into single numbers. Concentration inequalities bound the probability of large deviations. These tools are the computational core of probability: they turn a measure into quantities that can be compared, optimized, and bounded.
Authoritative sources
Measurable functions as random variables §
A random variable is a measurable map such that for every Borel set .
The pushforward measure on is the distribution of (see Distributions).
Details
The measurability requirement ensures that events of the form are in the sigma-algebra, so they have a well-defined probability. For a finite or countable sample space every function is measurable; the condition only becomes restrictive for uncountable spaces. The general notion of a measurable map between measure spaces is developed in Measurable functions.
The sigma-algebra generated by is . Two random variables are independent iff and are independent sigma-algebras (see Conditional probability).
Worked example (pushforward of a finite space). Flip two fair coins: with each, and let = number of heads. The pushforward assigns (only ), (), (only ). All the probability questions about — its mean, its tails — now live on the real line, where they can be computed with the tools below. This is exactly the distribution the Distributions page calls Binomial(2, 1/2).
Example problem. Let be the constant random variable on any sample space. What is , and what is the pushforward measure ?
Solution
is if and otherwise, so — the trivial sigma-algebra: a constant random variable carries no information. The pushforward is the Dirac measure on : all mass at the point . Its expectation is and its variance is , as the formulas below confirm.
Expectation §
The expectation (mean) of an integrable random variable is
For a discrete : . For a continuous with density : .
Linearity: for any constants (no independence needed).
Details
The expectation is the Lebesgue integral of with respect to the probability measure . It exists (is finite) iff . The integral is defined on the measure space ; see Measure theory and the Lebesgue integral for the general framework.
The transformation rule (law of the unconscious statistician). Expectations are almost never computed on ; one pushes forward to the real line first. For any measurable :
depending on whether the law of is atomic or has density . This is the bridge to the Distributions page: every practical expectation is an integral against the distribution, not against . When is differentiable and one only needs approximately, the delta method replaces by its first-order Taylor expansion around : .
Key properties:
- Monotonicity: a.s.
- Jensen’s inequality: for convex ,
- Tower property:
Worked example. For a fair die, . Using the transformation rule with : . Jensen is visible here: , with the gap being exactly the variance. The transformation rule also carries a warning: for and , the integral diverges, so even though is smooth — finiteness must always be checked.
Authoritative sources
Example problem. Let . Compute and using the transformation rule.
Solution
The density is on , so :
- .
- .
Note that neither computation ever mentioned the sample space — the pushforward to did all the work.
Variance and covariance §
The correlation coefficient is .
Details
Variance measures spread around the mean. For independent : (the cross term vanishes). Without independence, . Variance is homogeneous of degree 2: .
Zero covariance does not imply independence. Discrete example: let be uniform on and . Then , yet is a deterministic function of , so the two are maximally dependent. Independence implies zero covariance, but not conversely — covariance only detects linear dependence.
Worked example. For the fair die: and , so
Example problem. Using the die’s variance , compute without recomputing any expectation.
Solution
Shifts do not change spread and scaling squares: . The constant 3 contributes nothing because — a constant has no spread around its own mean.
Moment generating function §
The moment generating function (MGF) of is
where is the CDF. If is finite in a neighborhood of 0, then , and uniquely determines the distribution of (by analytic continuation: is holomorphic on that neighborhood, and by the identity theorem two MGFs agreeing there agree everywhere, hence the distributions coincide).
Details
Why the MGF and not the moment sequence? Moments do not always determine a distribution: this is the Stieltjes/Hamburger moment problem. Classic example: the log-normal distributions with density (for suitable parameter pairs) share all their moments yet are different laws. So knowing every moment is not enough in general. What saves the day is analyticity: when is finite on an open interval around 0, it is a holomorphic function there, the identity theorem for holomorphic functions propagates its values from that interval to the whole complex plane, and the distribution is pinned down. When even that fails (heavy tails), one falls back on the characteristic function, for which the inversion theorem always holds.
Cumulants. The cumulant generating function is ; its derivatives at 0 give the cumulants. The first two cumulants are the mean and variance. The third and fourth cumulants, suitably standardized, are the skewness (asymmetry of the distribution) and the excess kurtosis (tail heaviness relative to a normal) — the standard descriptors beyond mean and variance.
Sums. For independent : . This multiplicative property is the workhorse behind the Central Limit Theorem (see Limit theorems).
Worked example. Let (density on ). Then
Differentiating: (the mean) and , so . Note the MGF only exists for — a neighborhood of 0, which is all the uniqueness argument needs.
For variables where the MGF does not exist at all (e.g. Cauchy), the characteristic function always exists (it is bounded by 1) and serves the same role; the inversion theorem applies to it.
Authoritative sources Authoritative sources
Solution
By independence, . Reading off the coefficients of : , , — the Binomial(2, ) law. This is the MGF proof that sums of independent Bernoullis are binomial, and it scales verbatim to terms.
Concentration inequalities §
Markov’s inequality. For and :
Chebyshev’s inequality. For any random variable with finite variance:
Hoeffding’s inequality. For independent bounded :
Details
These inequalities bound tail probabilities using only moments or boundedness, without knowing the full distribution. Each stronger hypothesis buys a faster decay, as the plot above shows.
- Markov: uses only the first moment. Proof: .
- Chebyshev: applies Markov to . Gives polynomial decay .
- Hoeffding: uses the boundedness and independence to get exponential decay. It is the key tool in learning theory and the analysis of randomized algorithms.
Worked example. Roll a fair die times; , , support width . Bound :
- Chebyshev: .
- Hoeffding (two-sided version): .
Hoeffding is about 40× sharper here. The comparison flips near the mean (small ), where Chebyshev’s can beat Hoeffding’s — each bound wins in its own regime, and the plot above shows why: polynomial vs exponential decay.
For sub-Gaussian variables (e.g. normal), Hoeffding-type bounds hold with a variance proxy. For sub-exponential variables, the tail is rather than .
These inequalities are the probabilistic backbone of the law of large numbers (see Limit theorems) and of statistical estimation (see Statistical inference).
Authoritative sources
Example problem. A sensor reads a value in with unknown mean . You average independent readings. Give a bound (valid with no distributional assumptions beyond boundedness) on .
Solution
Hoeffding with , , , :
No variance estimate is needed — boundedness alone suffices. (Chebyshev cannot even be applied here without estimating , which is exactly the situation Hoeffding was designed for.)
The simulation below runs the law of large numbers live: each trial draws up to 400 i.i.d. samples and tracks the running sample mean, while the empirical tail probability (estimated over many trials) is compared against the Chebyshev and Hoeffding bounds. Increase the number of trials and watch the empirical curve settle below both bounds, exactly as the inequalities guarantee.
Quiz §
Quiz: the sample mean of i.i.d. variables
Let be i.i.d. with and , and let .
- Compute and .
- Use Chebyshev to bound .
- What does the bound say as , and which theorem sharpens it?
How to solve it
Step 1 — expectation, by linearity. Linearity needs no independence:
The sample mean is unbiased.
Step 2 — variance, using independence. For independent variables the cross-covariance terms vanish:
Step 3 — Chebyshev. Apply Chebyshev to , whose mean is and standard deviation is :
Step 4 — read off the limit. For fixed the bound tends to 0 as : the sample mean converges in probability to — this is precisely the (weak) law of large numbers, proved here with nothing but linearity, independence, and Chebyshev. The Central Limit Theorem (see Limit theorems) sharpens the statement: , replacing the polynomial bound with an accurate normal tail.