Purpose
A reference for concentration arguments, so they do not have to be re-derived ad hoc. It fixes definitions for expectation, variance, covariance, and conditional expectation, then builds the inequality chain Markov, Chebyshev, Chernoff, Hoeffding, each one a strictly stronger use of information about the random variable. The payoff is quantitative: how many samples you need before an empirical average can be trusted, which is the question underneath A/B tests, offline recommender metrics, and benchmark noise.
Random variables and expectation
A random variable is a function from outcomes to numbers; we describe it by its distribution. Expectation is the probability-weighted average (Pishro-Nik ch. 6):
The single most used fact is linearity: with no independence assumption. Independence is only needed for products: if then .
Variance measures spread, covariance measures co-movement:
Variance is not linear: , and , which collapses to a plain sum for independent (or merely uncorrelated) variables. That collapse is the reason averaging works: for iid with mean and variance , the empirical mean has
Conditional expectation is the best guess of given , itself a random variable, and the tower property lets you compute expectations by conditioning on whatever makes the problem factor (Pishro-Nik §6.3-6.4). The ML framing in Cornell CS 4780’s notation note is a direct application: data are iid draws from an unknown , the test error is an expectation over , and everything you compute from a sample is an estimator of some expectation.
The inequality chain
Each inequality below uses one more piece of structure and buys an exponentially better tail.
The ladder: pay more structure, get a better tail
Bound Requires Tail decay Markov , a mean Chebyshev a variance , and for averages Chernoff a moment generating function , exponential in Hoeffding bounded range , explicit constants Every rung is Markov applied to a transformed variable: Chebyshev is Markov on , Chernoff is Markov on with optimized. Climb only as high as your assumptions allow, a heavy-tailed variable with no MGF stops at Chebyshev, but for bounded iid samples go straight to Hoeffding and read off the sample size.
Markov (needs: nonnegativity and a mean). For and :
Proof in one line: . The bound decays only like , but it is the engine for everything else.
Chebyshev (needs: a variance). Apply Markov to the nonnegative variable with threshold :
Combined with this already proves the weak law of large numbers: the empirical mean converges to in probability. The decay in is only polynomial, .
Chernoff (needs: a moment generating function). Apply Markov to , then optimize the free parameter :
Because the MGF of a sum of independent variables factors into a product, the exponent scales linearly in and the tail decays exponentially. For a sum of independent Bernoullis with mean , the multiplicative form is .
Hoeffding (needs: bounded ranges). For independent (Aldous’s handout):
For iid and the empirical mean, this specializes to the form worth memorizing:
Sample sizes, A/B tests, and measurement noise
Invert the Hoeffding bound. To estimate a -bounded mean within with probability , set and solve:
The shape of this formula explains a lot of practice. Precision is expensive, grows as , so halving the error bar quadruples the sample size. Confidence is cheap, sits inside a log, so going from 95% to 99.9% confidence costs a small constant factor. Concretely, and needs samples. An A/B test comparing click-through rates is estimating two such means, and detecting a difference of a fraction of a percent forces the price. The same arithmetic bounds how many queries an offline recommender evaluation needs before a metric delta is signal rather than sampling noise, and how many benchmark iterations to run before comparing two systems, the concern in the OS benchmarks notes. Hoeffding assumes independent samples; correlated benchmark iterations (warm caches, interference) violate that and make the bound optimistic.
Simulation check
Hoeffding is a worst-case bound, and a simulation shows both that it holds and how much slack it has:
import numpy as np
rng = np.random.default_rng(0)
n, eps, trials = 500, 0.05, 200_000
X = rng.random((trials, n)) # iid Uniform[0,1], mu = 0.5
dev = np.abs(X.mean(axis=1) - 0.5)
empirical = (dev >= eps).mean()
hoeffding = 2 * np.exp(-2 * n * eps**2)
print(empirical, hoeffding) # 8e-05 vs 0.1642The measured tail probability is against a Hoeffding bound of 0.164, three orders of magnitude of slack for uniform variables. The gap is expected: Hoeffding only uses the range and must cover the worst distribution with that range (Bernoulli at the endpoints), while Uniform[0,1] has variance , a third of Bernoulli’s . A quick sanity check against the CLT explains the measured number: the empirical mean has standard deviation , so is a 3.9-sigma deviation, and the two-sided normal tail at 3.9 sigma is about , matching the simulation. Variance-aware bounds like Bernstein’s capture this; the ones here are the standard first tools.
Sources
- Pishro-Nik, Introduction to Probability, Statistics, and Random Processes, chapters 6-7
- Aldous, Hoeffding’s inequality, course handout
- Cornell CS 4780 (2018), lecture note 2, ML setup and notation