1. The Need for Concentration Bounds
In theoretical computer science, machine learning generalization theory, and distributed systems, we frequently face the question: What is the probability that a random metric deviates significantly from its expected value?
While the Central Limit Theorem describes asymptotic behavior as $n \to \infty$, it provides no non-asymptotic guarantees for finite samples $n$. Concentration inequalities provide rigorous, non-asymptotic upper bounds on tail probabilities:
$$P(|X - E[X]| \ge \epsilon) \le \delta$$
text
2. Markov's Inequality
Markov's inequality is the parent of almost all concentration inequalities. It requires only that the random variable is non-negative and has a finite mean.
Theorem
Let $X$ be a non-negative random variable ($X \ge 0$) with finite mean $E[X]$. For any constant $a > 0$:
$$P(X \ge a) \le \frac{E[X]}{a}$$
Mathematical Proof:
Define the indicator variable $I_{X \ge a} = 1$ if $X \ge a$, and $0$ otherwise.
Notice that for all values of $X \ge 0$:
$$X \ge a \cdot I_{X \ge a}$$
- If $X < a$: Left side is $\ge 0$, right side is $0$. Inequality holds.
- If $X \ge a$: Left side is $\ge a$, right side is $a \cdot 1 = a$. Inequality holds.
Taking expectations on both sides:
$$E[X] \ge E[a \cdot I_{X \ge a}] = a \cdot E[I_{X \ge a}] = a \cdot P(X \ge a)$$
Dividing both sides by $a$:
$$P(X \ge a) \le \frac{E[X]}{a} \quad \blacksquare$$
Intuition & Limitations:
If average cloud bill is $$1,000$, what is the probability the bill exceeds $$5,000$?
$$P(X \ge 5000) \le \frac{1000}{5000} = 0.20 \quad (20%)$$
At most $20%$ of users can spend more than $5 \times$ the average. Markov's bound decays only linearly ($1/a$), making it relatively loose.
3. Chebyshev's Inequality
Chebyshev incorporates variance information to achieve quadratic decay ($1/a^2$).
Theorem
Let $X$ be any random variable with mean $\mu = E[X]$ and finite variance $\sigma^2 = \text{Var}(X)$. For any $k > 0$:
$$P(|X - \mu| \ge k\sigma) \le \frac{1}{k^2}$$
Equivalently, for any deviation $\epsilon > 0$:
$$P(|X - \mu| \ge \epsilon) \le \frac{\text{Var}(X)}{\epsilon^2}$$
Mathematical Proof:
The event $|X - \mu| \ge \epsilon$ is identical to $(X - \mu)^2 \ge \epsilon^2$.
Notice that $(X - \mu)^2$ is a non-negative random variable with expectation $E[(X - \mu)^2] = \text{Var}(X)$.
Applying Markov's inequality directly to $(X - \mu)^2$:
$$P((X - \mu)^2 \ge \epsilon^2) \le \frac{E[(X - \mu)^2]}{\epsilon^2} = \frac{\text{Var}(X)}{\epsilon^2} \quad \blacksquare$$
Engineering Consequence:
For any arbitrary distribution (regardless of shape or skew):
- At least $75%$ of values lie within $2\sigma$ ($k=2 \implies P \le 1/4$).
- At least $88.8%$ of values lie within $3\sigma$ ($k=3 \implies P \le 1/9$).
- At least $96%$ of values lie within $5\sigma$ ($k=5 \implies P \le 1/25$).
4. The Chernoff Bound Method
Can we achieve exponential decay? Yes, by applying Markov's inequality to the exponential transform $e^{tX}$.
The Generic Chernoff Technique
For any $t > 0$, the event $X \ge a$ is equivalent to $e^{tX} \ge e^{ta}$.
Since $e^{tX} > 0$, we apply Markov's inequality:
$$P(X \ge a) = P(e^{tX} \ge e^{ta}) \le \frac{E[e^{tX}]}{e^{ta}} = e^{-ta} M_X(t)$$
Since this inequality holds for every choice of $t > 0$, we choose the optimal $t$ that minimizes the right-hand side:
$$P(X \ge a) \le \inf_{t > 0} \left[ e^{-ta} M_X(t) \right]$$
Chernoff Bounds for Sums of Independent Bernoulli Variables
Let $X_1, X_2, \dots, X_n$ be independent Bernoulli random variables with $P(X_i = 1) = p_i$.
Let $S_n = \sum_{i=1}^n X_i$, and $\mu = E[S_n] = \sum_{i=1}^n p_i$.
For any $\delta > 0$:
$$P(S_n \ge (1 + \delta)\mu) \le \left( \frac{e^\delta}{(1 + \delta)^{1 + \delta}} \right)^\mu \le \exp\left( -\frac{\mu \delta^2}{2 + \delta} \right) \le \exp\left( -\frac{\mu \delta^2}{3} \right)$$
For the lower tail ($0 < \delta < 1$):
$$P(S_n \le (1 - \delta)\mu) \le \exp\left( -\frac{\mu \delta^2}{2} \right)$$
text
5. Hoeffding's Inequality
Hoeffding's inequality generalizes Chernoff bounds to any independent random variables bounded in arbitrary real intervals.
Theorem (Hoeffding)
Let $X_1, X_2, \dots, X_n$ be independent random variables such that $X_i \in [a_i, b_i]$ with probability $1$. Let $\bar{X} = \frac{1}{n} \sum_{i=1}^n X_i$. For any $\epsilon > 0$:
$$P(\bar{X} - E[\bar{X}] \ge \epsilon) \le \exp\left( -\frac{2 n^2 \epsilon^2}{\sum_{i=1}^n (b_i - a_i)^2} \right)$$
For identical ranges $[a, b]$ with range width $R = b - a$:
$$P(|\bar{X} - E[\bar{X}]| \ge \epsilon) \le 2 \exp\left( -\frac{2 n \epsilon^2}{R^2} \right)$$
6. Machine Learning Application: PAC Learning Sample Complexity
In PAC Learning (Probably Approximately Correct), we want to guarantee with high probability ($1 - \delta$) that a trained machine learning model's empirical training error $\hat{R}(h)$ differs from its true test error $R(h)$ by at most $\epsilon$:
$$P(\exists h \in \mathcal{H} : |R(h) - \hat{R}(h)| \ge \epsilon) \le \delta$$
Derivation:
- For a single hypothesis $h$, training losses are independent bounded variables $L_i \in [0, 1]$. By Hoeffding's inequality: $$P(|R(h) - \hat{R}(h)| \ge \epsilon) \le 2 e^{-2n\epsilon^2}$$
- For a finite hypothesis class $\mathcal{H}$ of size $|\mathcal{H}|$, applying Boole's union bound: $$P(\exists h \in \mathcal{H} : |R(h) - \hat{R}(h)| \ge \epsilon) \le \sum_{h \in \mathcal{H}} 2 e^{-2n\epsilon^2} = 2|\mathcal{H}| e^{-2n\epsilon^2}$$
- Setting the error probability to at most $\delta$: $$2|\mathcal{H}| e^{-2n\epsilon^2} \le \delta \implies e^{-2n\epsilon^2} \le \frac{\delta}{2|\mathcal{H}|}$$ Taking natural logs and solving for $n$: $$-2n\epsilon^2 \le \ln\left(\frac{\delta}{2|\mathcal{H}|}\right) \implies n \ge \frac{1}{2\epsilon^2} \ln\left( \frac{2|\mathcal{H}|}{\delta} \right)$$
This foundational theorem proves that the number of training samples required scales only logarithmically with the model's complexity $|\mathcal{H}|$.
7. Comparative Hierarchy of Concentration Bounds
| Bound | Required Knowledge | Underlying Assumptions | Decay Rate | Use Case |
|---|---|---|---|---|
| Markov | $E[X]$ only | $X \ge 0$ | $O(1/\epsilon)$ | Zero variance info available |
| Chebyshev | $E[X], \text{Var}(X)$ | Finite variance | $O(1/\epsilon^2)$ | Distribution shape unknown |
| Chernoff | MGF $M_X(t)$ | Independent random variables | $\exp(-c \epsilon^2)$ | Sums of independent Bernoulli / indicators |
| Hoeffding | Bound intervals $[a_i, b_i]$ | Independent bounded variables | $\exp(-2n\epsilon^2)$ | Generalization theory, PAC learning |
8. Python Implementation: Empirical Comparison of Bounds
python
9. Key Takeaways
- Markov is Universal but Loose: $P(X \ge a) \le E[X]/a$ requires only non-negativity, decaying as $O(1/a)$.
- Chebyshev Exploits Variance: Bounding $|X - \mu| \ge \epsilon$ by $\text{Var}(X)/\epsilon^2$ achieves quadratic decay.
- Chernoff & Hoeffding Provide Exponential Tightness: Sums of independent bounded variables decay exponentially fast ($\exp(-c n \epsilon^2)$), enabling modern PAC learning and randomized algorithmic guarantees.