Blog · updated 26 Oct 2026 · 15 min read

Concentration inequalities: how far can an average stray?

Markov, Chebyshev, Chernoff and Hoeffding from one picture, with step-by-step proofs, interactive figures, and the places they decide real numbers: sample sizes, generalisation bounds, random features and high-dimensional geometry.

Contents
  1. 1. The one idea behind all of them
  2. 2. Markov: knowing only the mean
  3. 3. Chebyshev: knowing the variance
  4. 4. Chernoff: using every moment at once
  5. 5. Hoeffding: bounded variables are sub-Gaussian
  6. 6. Where these numbers are used
  7. How big must a test set be?
  8. Why a model chosen on training data still generalises
  9. Random features approximate a kernel
  10. In high dimensions, Gaussians live on a shell
  11. 7. Beyond Hoeffding
  12. Questions
  13. References

Almost every number in machine learning is an average: a test accuracy, a Monte Carlo estimate, a minibatch gradient, a kernel approximated with random features. Each comes with the same two questions. How far from the truth can it be, and how many samples make that unlikely? Concentration inequalities answer both, without knowing the distribution.

Below, each sample is the mean of nn fair coin flips. The left panel shows its distribution, with the outcomes more than ε\varepsilon from 12\tfrac12 highlighted. The right panel shows the probability of such a miss as nn grows, on a log scale: the exact value, and two bounds that hold for any variables bounded in [0,1][0, 1].

On a log scale the exact tail is a straight line falling at a constant rate: it decays exponentially in nn. Hoeffding’s bound is parallel to it, which is why it is useful. Chebyshev’s bound bends: it decays only like 1/n1/n, and by n=1000n = 1000 it is wrong by many orders of magnitude. The difference between those two shapes is the subject of this post.

1. The one idea behind all of them

Each inequality below is the same move with a different function.

Lemma 1 (Bounding an indicator)

Let AA be an event defined by XX, and let g≥0g \ge 0 with g(x)≥1g(x) \ge 1 whenever x∈Ax \in A. Then   P(X∈A)≤E[g(X)]\;\mathbb{P}(X \in A) \le \mathbb{E}[g(X)].

Proof

Step 1. Write the probability as an expectation. P(X∈A)=E[1{X∈A}]\mathbb{P}(X \in A) = \mathbb{E}[\mathbb{1}\{X \in A\}].

Step 2. Compare pointwise. On AA the indicator is 1≤g(x)1 \le g(x); off AA it is 0≤g(x)0 \le g(x). So 1{x∈A}≤g(x)\mathbb{1}\{x \in A\} \le g(x) for every xx.

Step 3. Take expectations. Expectation preserves pointwise inequalities: E[1{X∈A}]≤E[g(X)]\mathbb{E}[\mathbb{1}\{X \in A\}] \le \mathbb{E}[g(X)].

So a tail bound is a choice of a function lying above a step. The closer it hugs the step where the distribution has mass, the tighter the bound. Below, XX is the number of heads in 20 fair flips and the event is X≥aX \ge a. Markov uses a line, Chebyshev a parabola, Chernoff an exponential whose steepness tt you choose.

The line and the parabola stay well above zero across the bulk of the distribution, where the probability mass sits, and pay for it. The exponential can be made almost zero on the bulk and still reach 11 at the threshold. Push aa towards 20: Markov barely moves, Chebyshev improves, Chernoff keeps pace with the truth.

2. Markov: knowing only the mean

Theorem 1 (Markov’s inequality)

If X≥0X \ge 0 and a>0a > 0, then   P(X≥a)≤E[X]a\;\mathbb{P}(X \ge a) \le \dfrac{\mathbb{E}[X]}{a}.

Proof

Step 1. Choose gg. Let g(x)=x/ag(x) = x/a. It is non-negative because X≥0X \ge 0, and g(x)≥1g(x) \ge 1 whenever x≥ax \ge a.

Step 2. Apply Lemma 1. P(X≥a)≤E[X/a]=E[X]/a\mathbb{P}(X \ge a) \le \mathbb{E}[X/a] = \mathbb{E}[X]/a.

Example 1 (Markov cannot be improved without more information)

Let X=aX = a with probability pp and X=0X = 0 otherwise. Then E[X]=pa\mathbb{E}[X] = pa and P(X≥a)=p=E[X]/a\mathbb{P}(X \ge a) = p = \mathbb{E}[X]/a: equality. Any distribution with all its tail mass exactly at aa makes Markov tight, so a better bound needs more than the mean.

Corollary 1 (Bounded above instead of below)

If X≤UX \le U and a<Ua < U, then   P(X≤a)≤U−E[X]U−a\;\mathbb{P}(X \le a) \le \dfrac{U - \mathbb{E}[X]}{U - a}.

Proof

Step 1. Flip. Y=U−X≥0Y = U - X \ge 0, and X≤aX \le a exactly when Y≥U−aY \ge U - a.

Step 2. Apply Theorem 1 to YY. P(Y≥U−a)≤E[Y]/(U−a)=(U−E[X])/(U−a)\mathbb{P}(Y \ge U - a) \le \mathbb{E}[Y]/(U - a) = (U - \mathbb{E}[X])/(U - a).

For example, if a classifier’s accuracy, averaged over a family of tasks, is 0.90.9, then (since accuracy is at most 11) at most 1−0.91−0.5=20%\tfrac{1 - 0.9}{1 - 0.5} = 20\% of those tasks can have accuracy below 0.50.5.

3. Chebyshev: knowing the variance

Theorem 2 (Chebyshev’s inequality)

If Var⁡[X]=σ2<∞\operatorname{Var}[X] = \sigma^2 < \infty and ε>0\varepsilon > 0, then   P(∣X−E[X]∣≥ε)≤σ2ε2\;\mathbb{P}(\lvert X - \mathbb{E}[X]\rvert \ge \varepsilon) \le \dfrac{\sigma^2}{\varepsilon^2}.

Proof

Step 1. Choose gg. g(x)=(x−E[X])2/ε2≥0g(x) = (x - \mathbb{E}[X])^2/\varepsilon^2 \ge 0, and g(x)≥1g(x) \ge 1 whenever ∣x−E[X]∣≥ε\lvert x - \mathbb{E}[X]\rvert \ge \varepsilon.

Step 2. Apply Lemma 1. P(∣X−EX∣≥ε)≤E[(X−EX)2]/ε2=σ2/ε2\mathbb{P}(\lvert X - \mathbb{E}X\rvert \ge \varepsilon) \le \mathbb{E}[(X - \mathbb{E}X)^2]/\varepsilon^2 = \sigma^2/\varepsilon^2.

Applied to an average, Chebyshev already proves that averages work.

Proposition 1 (Weak law of large numbers, with a sample size)

Let X1,…,XnX_1, \dots, X_n be independent with mean μ\mu and variance σ2\sigma^2, and Xˉ=1n∑iXi\bar X = \tfrac1n\sum_iX_i. Then P(∣Xˉ−μ∣≥ε)≤σ2nε2\mathbb{P}(\lvert\bar X - \mu\rvert \ge \varepsilon) \le \dfrac{\sigma^2}{n\varepsilon^2}, so n≥σ2δε2n \ge \dfrac{\sigma^2}{\delta\varepsilon^2} samples give P(∣Xˉ−μ∣≥ε)≤δ\mathbb{P}(\lvert\bar X - \mu\rvert \ge \varepsilon) \le \delta.

Proof

Step 1. Mean of the average. By linearity, E[Xˉ]=1n∑iμ=μ\mathbb{E}[\bar X] = \tfrac1n\sum_i\mu = \mu.

Step 2. Variance of a sum of independent variables. Independence makes every covariance Cov⁡[Xi,Xj]\operatorname{Cov}[X_i, X_j] with i≠ji \ne j vanish, so Var⁡[∑iXi]=∑iVar⁡[Xi]=nσ2\operatorname{Var}[\sum_iX_i] = \sum_i\operatorname{Var}[X_i] = n\sigma^2.

Step 3. Scale. Var⁡[Xˉ]=1n2⋅nσ2=σ2/n\operatorname{Var}[\bar X] = \tfrac{1}{n^2}\cdot n\sigma^2 = \sigma^2/n.

Step 4. Apply Theorem 2 to Xˉ\bar X, then solve σ2/(nε2)≤δ\sigma^2/(n\varepsilon^2) \le \delta for nn.

The weakness is the 1/δ1/\delta. Asking for ten times more confidence costs ten times more samples. The figure at the top shows why this is pessimistic: the true tail falls exponentially. To see that, the bound must use more than two moments.

4. Chernoff: using every moment at once

Theorem 3 (Chernoff bound)

For any XX and aa,   P(X≥a)≤inf⁡t>0 e−ta E[etX]\;\mathbb{P}(X \ge a) \le \inf_{t > 0}\,e^{-ta}\,\mathbb{E}[e^{tX}].

Proof

Step 1. Choose gg. For any t>0t > 0, g(x)=et(x−a)>0g(x) = e^{t(x - a)} > 0, and g(x)≥1g(x) \ge 1 whenever x≥ax \ge a, because t(x−a)≥0t(x - a) \ge 0 there.

Step 2. Apply Lemma 1. P(X≥a)≤E[et(X−a)]=e−ta E[etX]\mathbb{P}(X \ge a) \le \mathbb{E}[e^{t(X - a)}] = e^{-ta}\,\mathbb{E}[e^{tX}].

Step 3. Optimise. Step 2 holds for every t>0t > 0, so it holds for the infimum.

M(t)=E[etX]M(t) = \mathbb{E}[e^{tX}] is the moment generating function, ∑ktkE[Xk]/k!\sum_k t^k\mathbb{E}[X^k]/k!: one function that packs every moment, weighted by tt. Two properties make it the right tool for averages.

Lemma 2 (MGFs of independent sums multiply)

If X1,…,XnX_1, \dots, X_n are independent,   E[et∑iXi]=∏iE[etXi]\;\mathbb{E}\big[e^{t\sum_iX_i}\big] = \prod_i\mathbb{E}[e^{tX_i}].

Proof

Step 1. et∑iXi=∏ietXie^{t\sum_iX_i} = \prod_ie^{tX_i}.

Step 2. The factors are functions of independent variables, so they are independent, and the expectation of a product of independent variables is the product of the expectations.

Example 2 (The Gaussian tail, by Chernoff)

For X∼N(0,σ2)X \sim \mathcal{N}(0, \sigma^2), the MGF is E[etX]=eσ2t2/2\mathbb{E}[e^{tX}] = e^{\sigma^2t^2/2} (complete the square in the integral; see Gaussian identities, Proposition 3, Step 1).

Step 1. The bound for fixed tt. P(X≥a)≤e−ta+σ2t2/2\mathbb{P}(X \ge a) \le e^{-ta + \sigma^2t^2/2}.

Step 2. Minimise the exponent. ddt(−ta+σ2t2/2)=−a+σ2t=0\tfrac{d}{dt}\big(-ta + \sigma^2t^2/2\big) = -a + \sigma^2t = 0 at t∗=a/σ2t^* = a/\sigma^2.

Step 3. Substitute. −a2/σ2+a2/(2σ2)=−a2/(2σ2)-a^2/\sigma^2 + a^2/(2\sigma^2) = -a^2/(2\sigma^2), so P(X≥a)≤e−a2/(2σ2)\mathbb{P}(X \ge a) \le e^{-a^2/(2\sigma^2)}.

The exact tail is e−a2/(2σ2)e^{-a^2/(2\sigma^2)} times a factor of order σ/a\sigma/a, so Chernoff captures the exponential rate exactly and loses only a polynomial factor.

Definition 1 (Sub-Gaussian variable)

XX with mean μ\mu is sub-Gaussian with variance proxy s2s^2 if E[et(X−μ)]≤es2t2/2\mathbb{E}[e^{t(X - \mu)}] \le e^{s^2t^2/2} for all t∈Rt \in \mathbb{R}. By the example, such an XX has Gaussian-type tails: P(X−μ≥a)≤e−a2/(2s2)\mathbb{P}(X - \mu \ge a) \le e^{-a^2/(2s^2)}.

5. Hoeffding: bounded variables are sub-Gaussian

Bounded variables are the common case: accuracies, losses clipped to [0,1][0, 1], indicators, features with bounded range. The key fact is that boundedness alone gives a Gaussian-type MGF.

Lemma 3 (Hoeffding’s lemma)

If E[X]=0\mathbb{E}[X] = 0 and a≤X≤ba \le X \le b, then   E[etX]≤et2(b−a)2/8\;\mathbb{E}[e^{tX}] \le e^{t^2(b - a)^2/8} for all tt. That is, XX is sub-Gaussian with s2=(b−a)2/4s^2 = (b - a)^2/4.

Proof

Step 1. Convexity. On [a,b][a, b], the convex function etxe^{tx} lies below its chord:

etx≤b−xb−a eta+x−ab−a etb.e^{tx} \le \frac{b - x}{b - a}\,e^{ta} + \frac{x - a}{b - a}\,e^{tb}.

Step 2. Take expectations, using E[X]=0\mathbb{E}[X] = 0.

E[etX]≤bb−a eta−ab−a etb.\mathbb{E}[e^{tX}] \le \frac{b}{b - a}\,e^{ta} - \frac{a}{b - a}\,e^{tb}.

Step 3. Rewrite as one exponential. Let θ=−a/(b−a)∈[0,1]\theta = -a/(b - a) \in [0, 1] (note a≤0≤ba \le 0 \le b because the mean is 00) and u=t(b−a)u = t(b - a). Then ta=−θuta = -\theta u, and the right side of Step 2 equals eϕ(u)e^{\phi(u)} with

ϕ(u)=−θu+log⁡(1−θ+θeu).\phi(u) = -\theta u + \log\big(1 - \theta + \theta e^u\big).

Step 4. Value and slope at zero. ϕ(0)=log⁡1=0\phi(0) = \log 1 = 0. Differentiating, ϕ′(u)=−θ+θeu1−θ+θeu\phi'(u) = -\theta + \dfrac{\theta e^u}{1 - \theta + \theta e^u}, so ϕ′(0)=−θ+θ=0\phi'(0) = -\theta + \theta = 0.

Step 5. Curvature is at most 14\tfrac14. Write q=θeu1−θ+θeu∈[0,1]q = \dfrac{\theta e^u}{1 - \theta + \theta e^u} \in [0, 1]. Differentiating ϕ′\phi' once more gives ϕ′′(u)=q(1−q)\phi''(u) = q(1 - q), and q(1−q)≤14q(1 - q) \le \tfrac14 for every q∈[0,1]q \in [0, 1] (its maximum is at q=12q = \tfrac12).

Step 6. Taylor’s theorem with remainder. For some ξ\xi between 00 and uu, ϕ(u)=ϕ(0)+ϕ′(0) u+12ϕ′′(ξ) u2≤18u2=18t2(b−a)2\phi(u) = \phi(0) + \phi'(0)\,u + \tfrac12\phi''(\xi)\,u^2 \le \tfrac18u^2 = \tfrac18t^2(b - a)^2.

Theorem 4 (Hoeffding’s inequality)

Let X1,…,XnX_1, \dots, X_n be independent with ai≤Xi≤bia_i \le X_i \le b_i, and S=∑iXiS = \sum_iX_i. For s>0s > 0,

P(S−E[S]≥s)≤exp⁡ ⁣(−2s2∑i(bi−ai)2).\mathbb{P}\big(S - \mathbb{E}[S] \ge s\big) \le \exp\!\Big(-\frac{2s^2}{\sum_i(b_i - a_i)^2}\Big).

For the mean of nn variables in [0,1][0, 1]:   P(∣Xˉ−μ∣≥ε)≤2e−2nε2\;\mathbb{P}(\lvert\bar X - \mu\rvert \ge \varepsilon) \le 2e^{-2n\varepsilon^2}.

Proof

Step 1. Chernoff (Theorem 3) for the centred sum: P(S−ES≥s)≤e−ts E[et(S−ES)]\mathbb{P}(S - \mathbb{E}S \ge s) \le e^{-ts}\,\mathbb{E}\big[e^{t(S - \mathbb{E}S)}\big].

Step 2. Factorise (Lemma 2), since S−ES=∑i(Xi−EXi)S - \mathbb{E}S = \sum_i(X_i - \mathbb{E}X_i) is a sum of independent terms.

Step 3. Bound each factor with Hoeffding’s lemma: Xi−EXiX_i - \mathbb{E}X_i has mean 00 and lies in an interval of length bi−aib_i - a_i. So

P(S−ES≥s)≤exp⁡ ⁣(−ts+t28∑i(bi−ai)2).\mathbb{P}(S - \mathbb{E}S \ge s) \le \exp\!\Big(-ts + \frac{t^2}{8}\sum_i(b_i - a_i)^2\Big).

Step 4. Optimise tt. Writing c=∑i(bi−ai)2c = \sum_i(b_i - a_i)^2, the exponent −ts+t2c/8-ts + t^2c/8 is minimised at t=4s/ct = 4s/c, where it equals −4s2/c+2s2/c=−2s2/c-4s^2/c + 2s^2/c = -2s^2/c.

Step 5. The mean. With bi−ai=1b_i - a_i = 1, c=nc = n; the event Xˉ−μ≥ε\bar X - \mu \ge \varepsilon is S−ES≥nεS - \mathbb{E}S \ge n\varepsilon, giving e−2nε2e^{-2n\varepsilon^2}. The lower tail is the same bound applied to −Xi-X_i; adding both tails gives the factor 22.

Solving 2e−2nε2≤δ2e^{-2n\varepsilon^2} \le \delta gives the sample size that every estimate in machine learning quietly relies on:

n≥log⁡(2/δ)2ε2.n \ge \frac{\log(2/\delta)}{2\varepsilon^2}.

The dependence on the confidence is now logarithmic. For ε=0.05\varepsilon = 0.05 and variables in [0,1][0, 1] (so σ2≤14\sigma^2 \le \tfrac14 in Chebyshev):

confidence 1−δ1 - \deltaChebyshev: n≥14δε2n \ge \tfrac{1}{4\delta\varepsilon^2}Hoeffding: n≥log⁡(2/δ)2ε2n \ge \tfrac{\log(2/\delta)}{2\varepsilon^2}
95%2 000738
99%10 0001 060
99.9%100 0001 521

Each extra “9” of confidence multiplies Chebyshev’s requirement by ten, but adds only a few hundred samples to Hoeffding’s.

6. Where these numbers are used

How big must a test set be?

A classifier’s test accuracy is the mean of nn indicators. By Hoeffding, with n=1060n = 1060 test examples the measured accuracy is within 55 points of the true accuracy with probability at least 99%99\%, whatever the classifier. To claim ±1\pm 1 point at the same confidence takes 2525 times more, n≥26 492n \ge 26\,492: halving the error bar always costs four times the data.

Why a model chosen on training data still generalises

Pick the hypothesis with the lowest training error from a finite class H\mathcal{H}. For each fixed hh, Hoeffding controls the gap between its training error R^(h)\hat R(h) and true error R(h)R(h); the danger is that we chose hh after seeing the data. One more tool handles that.

Lemma 4 (Union bound)

For any events A1,…,AmA_1, \dots, A_m,   P(⋃jAj)≤∑jP(Aj)\;\mathbb{P}\big(\bigcup_jA_j\big) \le \sum_j\mathbb{P}(A_j).

Proof

Step 1. 1{⋃jAj}≤∑j1{Aj}\mathbb{1}\{\bigcup_jA_j\} \le \sum_j\mathbb{1}\{A_j\} pointwise: the left side is 11 only if at least one term on the right is 11.

Step 2. Take expectations.

Proposition 2 (Generalisation bound for a finite class)

For a loss in [0,1][0, 1] and nn independent training examples, with probability at least 1−δ1 - \delta, simultaneously for every h∈Hh \in \mathcal{H},

∣R(h)−R^(h)∣≤log⁡(2∣H∣/δ)2n.\lvert R(h) - \hat R(h)\rvert \le \sqrt{\frac{\log(2\lvert\mathcal{H}\rvert/\delta)}{2n}} .
Proof

Step 1. One hypothesis. For a fixed hh, R^(h)\hat R(h) is a mean of nn independent losses in [0,1][0, 1] with mean R(h)R(h). By Theorem 4, P(∣R(h)−R^(h)∣≥ε)≤2e−2nε2\mathbb{P}(\lvert R(h) - \hat R(h)\rvert \ge \varepsilon) \le 2e^{-2n\varepsilon^2}.

Step 2. All hypotheses at once. The event “some hh has a gap ≥ε\ge \varepsilon” is the union over hh. By Lemma 4 its probability is at most 2∣H∣e−2nε22\lvert\mathcal{H}\rvert e^{-2n\varepsilon^2}.

Step 3. Solve for ε\varepsilon. Setting 2∣H∣e−2nε2=δ2\lvert\mathcal{H}\rvert e^{-2n\varepsilon^2} = \delta gives the stated ε\varepsilon. Because the bound holds for every hh simultaneously, it holds for whichever hh the learning algorithm picked.

log⁡∣H∣\log\lvert\mathcal{H}\rvert is the number of nats needed to name a hypothesis. The bound says: the gap grows only with the log of how many models you tried, which is why trying a thousand hyperparameter settings costs little, and trying all functions costs everything. Replacing log⁡∣H∣\log\lvert\mathcal{H}\rvert by a capacity measure (VC dimension, Rademacher complexity) extends the argument to infinite classes.

Random features approximate a kernel

Random Fourier features approximate a stationary kernel by an average: k^(x,x′)=1D∑j=1Dzj(x) zj(x′)\hat k(\boldsymbol{x}, \boldsymbol{x}') = \tfrac1D\sum_{j=1}^Dz_j(\boldsymbol{x})\,z_j(\boldsymbol{x}') with zj(x)=2cos⁡(ωj⊤x+bj)z_j(\boldsymbol{x}) = \sqrt2\cos(\boldsymbol{\omega}_j^\top\boldsymbol{x} + b_j), ωj\boldsymbol{\omega}_j drawn from the kernel’s spectral measure (Bochner’s theorem, GP Theorem 1) and bjb_j uniform on [0,2π][0, 2\pi].

Proposition 3 (How many random features)

For each fixed pair x,x′\boldsymbol{x}, \boldsymbol{x}',   P(∣k^(x,x′)−k(x,x′)∣≥ε)≤2e−Dε2/8\;\mathbb{P}\big(\lvert\hat k(\boldsymbol{x}, \boldsymbol{x}') - k(\boldsymbol{x}, \boldsymbol{x}')\rvert \ge \varepsilon\big) \le 2e^{-D\varepsilon^2/8}.

Proof

Step 1. Each term is unbiased. Using 2cos⁡αcos⁡β=cos⁡(α−β)+cos⁡(α+β)2\cos\alpha\cos\beta = \cos(\alpha - \beta) + \cos(\alpha + \beta), the term is cos⁡(ω⊤(x−x′))+cos⁡(ω⊤(x+x′)+2b)\cos(\boldsymbol{\omega}^\top(\boldsymbol{x} - \boldsymbol{x}')) + \cos(\boldsymbol{\omega}^\top(\boldsymbol{x} + \boldsymbol{x}') + 2b). The second part averages to 00 over uniform bb; the first averages to k(x,x′)k(\boldsymbol{x}, \boldsymbol{x}') over ω\boldsymbol{\omega} by Bochner’s theorem.

Step 2. Each term is bounded. zj(x)zj(x′)=2cos⁡(⋅)cos⁡(⋅)∈[−2,2]z_j(\boldsymbol{x})z_j(\boldsymbol{x}') = 2\cos(\cdot)\cos(\cdot) \in [-2, 2], an interval of length 44.

Step 3. Hoeffding for the mean of DD independent terms in an interval of length 44: the bound of Theorem 4 with ∑i(bi−ai)2=16D\sum_i(b_i - a_i)^2 = 16D and s=Dεs = D\varepsilon gives e−2D2ε2/(16D)=e−Dε2/8e^{-2D^2\varepsilon^2/(16D)} = e^{-D\varepsilon^2/8} per tail.

So D=8log⁡(2/δ)/ε2D = 8\log(2/\delta)/\varepsilon^2 features reach accuracy ε\varepsilon at a given pair: about 42004200 for ε=0.1\varepsilon = 0.1 at 99%99\% confidence. The wavelet post builds on these features.

In high dimensions, Gaussians live on a shell

Draw z∼N(0,Id)\boldsymbol{z} \sim \mathcal{N}(\mathbf{0}, \mathbf{I}_d). The density is largest at the origin, yet as dd grows almost no samples are near it. Move the slider.

Proposition 4 (Norms concentrate)

For z∼N(0,Id)\boldsymbol{z} \sim \mathcal{N}(\mathbf{0}, \mathbf{I}_d) and 0<ε≤10 < \varepsilon \le 1,   P(∣1d∥z∥2−1∣≥ε)≤2e−dε2/8\;\mathbb{P}\Big(\big\lvert\tfrac1d\lVert\boldsymbol{z}\rVert^2 - 1\big\rvert \ge \varepsilon\Big) \le 2e^{-d\varepsilon^2/8}.

Proof

Step 1. One coordinate’s MGF. For z∼N(0,1)z \sim \mathcal{N}(0, 1) and t<12t < \tfrac12, completing the square in the Gaussian integral gives E[etz2]=(1−2t)−1/2\mathbb{E}[e^{tz^2}] = (1 - 2t)^{-1/2}. So the centred variable w=z2−1w = z^2 - 1 has log⁡E[etw]=−t−12log⁡(1−2t)\log\mathbb{E}[e^{tw}] = -t - \tfrac12\log(1 - 2t).

Step 2. Bound it for 0≤t≤140 \le t \le \tfrac14. Expand −12log⁡(1−2t)=∑k≥1(2t)k/(2k)-\tfrac12\log(1 - 2t) = \sum_{k\ge1}(2t)^k/(2k). The k=1k = 1 term cancels −t-t, and 1/(2k)≤141/(2k) \le \tfrac14 for k≥2k \ge 2, so

−t−12log⁡(1−2t)≤14∑k≥2(2t)k=t21−2t≤2t2.-t - \tfrac12\log(1 - 2t) \le \tfrac14\sum_{k\ge2}(2t)^k = \frac{t^2}{1 - 2t} \le 2t^2 .

Step 3. Upper tail by Chernoff. The dd coordinates are independent, so by Lemma 2 and Step 2,

P(∑iwi≥dε)≤e−tdε+2dt2.\mathbb{P}\Big(\sum_i w_i \ge d\varepsilon\Big) \le e^{-td\varepsilon + 2dt^2}.

Choose t=ε/4≤14t = \varepsilon/4 \le \tfrac14: the exponent is −dε2/4+dε2/8=−dε2/8-d\varepsilon^2/4 + d\varepsilon^2/8 = -d\varepsilon^2/8.

Step 4. Lower tail. For t≥0t \ge 0, log⁡E[e−tw]=t−12log⁡(1+2t)≤t2\log\mathbb{E}[e^{-tw}] = t - \tfrac12\log(1 + 2t) \le t^2, using log⁡(1+2t)≥2t−2t2\log(1 + 2t) \ge 2t - 2t^2. Chernoff with t=ε/2t = \varepsilon/2 gives e−dε2/4≤e−dε2/8e^{-d\varepsilon^2/4} \le e^{-d\varepsilon^2/8}.

Step 5. Add the two tails.

So ∥z∥≈d\lVert\boldsymbol{z}\rVert \approx \sqrt d with fluctuations of order one: in d=1000d = 1000 dimensions, essentially every sample lies within 10%10\% of the sphere of radius 1000\sqrt{1000}. This is why random vectors in high dimensions are nearly orthogonal, why the Johnson–Lindenstrauss lemma can compress dimension while preserving distances, and why the noise in a diffusion model is a thin shell, not a ball.

7. Beyond Hoeffding

Hoeffding uses only the range. Two refinements are worth knowing by name; their proofs follow the same Chernoff pattern.

  • Bernstein’s inequality uses the variance too. If the XiX_i are independent with mean 00, ∣Xi∣≤c\lvert X_i\rvert \le c and ∑iVar⁡[Xi]=v\sum_i\operatorname{Var}[X_i] = v, then P(∑iXi≥s)≤exp⁡ ⁣(−s22(v+cs/3))\mathbb{P}(\sum_iX_i \ge s) \le \exp\!\big(-\tfrac{s^2}{2(v + cs/3)}\big). When the variance is much smaller than the range suggests (rare events), it is far tighter.
  • McDiarmid’s inequality replaces the sum by any function f(X1,…,Xn)f(X_1, \dots, X_n) that changes by at most cic_i when only XiX_i changes: P(f−Ef≥s)≤exp⁡ ⁣(−2s2/∑ici2)\mathbb{P}(f - \mathbb{E}f \ge s) \le \exp\!\big(-2s^2/\sum_ic_i^2\big). With ff a sum it is Hoeffding; with ff a supremum over hypotheses it is the start of Rademacher complexity.
  • Matrix concentration (Tropp, 2015) extends these bounds to sums of random matrices, which is what controls random-feature and sketching approximations of whole Gram matrices rather than single entries.

Questions

Question 1

In the indicator figure, why does Markov’s bound barely improve as aa moves towards 20, while Chernoff’s tracks the truth?

Answer

Markov’s function x/ax/a is a line through the origin; at x=μ=10x = \mu = 10 it still equals 10/a≥1210/a \ge \tfrac12, so most of the probability mass contributes heavily. Chernoff’s et(x−a)e^{t(x - a)} is exponentially small on the bulk for large tt, so only mass near the tail contributes.

Question 2

Chebyshev needs 1/δ1/\delta samples, Hoeffding only log⁡(1/δ)\log(1/\delta). Is Chebyshev ever the better choice?

Answer

Yes, when the variables are unbounded and only a variance is known (heavy-tailed data, where the MGF may not exist and Chernoff-type bounds fail), or when the variance is far below the square of the range, at moderate δ\delta.

Question 3

You tune 50 hyperparameter settings and report the best validation accuracy, measured on n=2000n = 2000 examples. How much optimism should you expect at 95% confidence?

Answer

By Proposition 2 with ∣H∣=50\lvert\mathcal{H}\rvert = 50: log⁡(2⋅50/0.05)/(2⋅2000)=7.6/4000≈0.044\sqrt{\log(2\cdot 50/0.05)/(2\cdot 2000)} = \sqrt{7.6/4000} \approx 0.044, about 4.4 points. A fresh test set removes it.

References

  • S. Boucheron, G. Lugosi, P. Massart. Concentration Inequalities: A Nonasymptotic Theory of Independence. Oxford University Press, 2013.
  • R. Vershynin. High-Dimensional Probability. Cambridge University Press, 2018.
  • M. J. Wainwright. High-Dimensional Statistics: A Non-Asymptotic Viewpoint. Cambridge University Press, 2019.
  • W. Hoeffding. Probability inequalities for sums of bounded random variables. Journal of the American Statistical Association, 1963.
  • H. Chernoff. A measure of asymptotic efficiency for tests of a hypothesis based on the sum of observations. Annals of Mathematical Statistics, 1952.
  • A. Rahimi, B. Recht. Random features for large-scale kernel machines. NeurIPS 2007.
  • J. A. Tropp. An Introduction to Matrix Concentration Inequalities. Foundations and Trends in Machine Learning, 2015.