Module contents
Lesson 21 of 24Advanced 105 min

Concentration of functions of many variables: McDiarmid and Gaussian concentration

Concentration is not confined to sums: any function of many independent variables that does not depend too much on any one concentrates. Prove McDiarmid using the Doob martingale and Azuma–Hoeffding, bound variance using Efron–Stein and state dimension-independent Gaussian concentration of Lipschitz functions. These tools underpin Rademacher bounds and differential privacy.

After this lesson you can

  • Decompose f(X₁, …, Xₙ) - 𝔼f into Doob martingale differences and bound them.
  • Prove Azuma–Hoeffding and McDiarmid and calculate bounded-difference constants in examples.
  • Bound variances of complex functions with Efron–Stein.
  • Apply Gaussian concentration of Lipschitz functions and explain its dimension independence.
  • Recognize when worst-case constants render the bound useless.

Before you start

Motivation: a supremum behaving like a mean

You train a classifier by choosing, within class H\Hyp, the one making fewest errors on nn independent examples. What matters is not its empirical error R^(h)\hat R(h) but true error R(h)R(h); because hh was chosen by looking at data, controlling the difference for a fixed hh is insufficient: it must be controlled for all at once,

Z=sup⁡h∈H(R(h)−R^(h)).Z = \sup_{h \in \Hyp}\big(R(h) - \hat R(h)\big).

The previous lesson solved this for finite classes with Hoeffding’s inequality and the union bound, paying log⁡∣H∣\log\abs{\Hyp}. For an infinite class (all lines in the plane, all networks of a given size), that route closes. And ZZ is not a sum of independent variables: it is the supremum of infinitely many sums, all mutually dependent. None of the existing tools applies.

But ZZ has an obvious property. If loss lies in [0,1][0, 1] and you change one example, each R^(h)\hat R(h) moves by at most 1/n1/n, so the supremum also moves by at most 1/n1/n. That property alone, without knowing anything else about H\Hyp, suffices to show

P(Z≥EZ+t)≤e−2nt2:\Pr\big(Z \ge \E Z + t\big) \le e^{-2nt^2}:

ZZ fluctuates around its mean exactly like the mean of nn variables in [0,1][0, 1]. Calculating EZ\E Z is another problem (Rademacher complexity), but knowing ZZ stays near it makes that calculation useful.

The general idea is that concentration is not a property of sums, but of functions of many independent variables that do not depend too much on any one of them. Empty boxes when balls are thrown at random, the chromatic number of a random graph, longest increasing subsequence length of a permutation, a text’s vocabulary size, or a Gaussian vector’s norm: none is a sum, and all concentrate. There are three tools, all proved here:

  • McDiarmid: if changing variable ii moves ff by at most cic_i, then ff has Gaussian tails with variance proxy ∑ici2/4\sum_i c_i^2/4. The proof reveals variables one by one (Doob martingale) and applies Hoeffding’s lemma at each step.
  • Efron–Stein: a variance bound in the same spirit, measuring how much ff typically moves when one variable changes, rather than in the worst case.
  • Gaussian concentration: if ff is LL-Lipschitz and its argument a Gaussian vector, ff has Gaussian tails at scale LL regardless of dimension.

The bounded-differences property

This is a property of the function, without probability. Calculating constants is almost always a one-line argument:

  • Mean. f(x)=1n∑ixif(x) = \frac1n\sum_i x_i with xi∈[a,b]x_i \in [a, b]: ci=(b−a)/nc_i = (b - a)/n.
  • Empty boxes. Throw nn balls into mm boxes (the hash-table balls-into-bins model); xix_i is ball ii’s box and ff counts empty boxes. Moving one ball can only empty its old box (+1+1) or occupy a new one (−1-1), and if both happen they cancel: ci=1c_i = 1.
  • Empirical-process suprema. f(x)=sup⁡h∈H∣1n∑iℓ(h,xi)−R(h)∣f(x) = \sup_{h \in \Hyp}\abs{\frac1n\sum_i \ell(h, x_i) - R(h)} with ℓ∈[0,1]\ell \in [0, 1]: changing xix_i moves each average at most 1/n1/n, and a supremum of functions moving at most 1/n1/n moves at most 1/n1/n. Thus ci=1/nc_i = 1/n for any class. Kolmogorov–Smirnov statistic Dn=sup⁡t∣Fn(t)−F(t)∣D_n = \sup_t\abs{F_n(t) - F(t)} is the case H={1[x≤t]}\Hyp = \{\ind[x \le t]\}.
  • Maximum. f(x)=max⁡ixif(x) = \max_i x_i with xi∈[0,1]x_i \in [0, 1]: ci=1c_i = 1 (if xi=1x_i = 1 is the maximum and the others are 0, changing it to 0 moves ff from 1 to 0).
  • Longest increasing subsequence. Ln(x)L_n(x) is the longest increasing subsequence length of x1,…,xnx_1, \dots, x_n. Changing one value can add or remove that element from the best subsequence, no more: ci=1c_i = 1.
  • Chromatic number. In random graph G(n,1/2)G(n, 1/2), variable XiX_i is the set of edges between vertex ii and vertices 1,…,i−11, \dots, i-1 (vertex exposure). The XiX_i are independent and changing XiX_i alters only edges touching vertex ii; recoloring that vertex with a new color repairs any coloring: ci=1c_i = 1.

The next figure compares actual spread with what bounded differences permits for six functions. Orange bands show McDiarmid’s inequality, proved in two sections; for now it suffices that its 95% half-width is ∑ici2log⁡(2/δ)/2\sqrt{\sum_i c_i^2\log(2/\delta)/2} with δ=0.05\delta = 0.05.

InteractiveBounded-differences explorer
Histogram of ff in 1000 replicates with n=1 000n = 1\,000
simulating…
  • simulated histogram
  • 2.5% and 97.5% quantiles
  • McDiarmid 95% band
  • outside the possible range of f
Three dispersion scales (logarithmic axis)
0.010.1110simulating…
Always Var⁡f≤vES≤12∑ici2\sqrt{\Var f} \le \sqrt{v_{\mathrm{ES}}} \le \tfrac12\sqrt{\sum_i c_i^2}. Parenthesized factors show the excess over the actual standard deviation.
1 000
Axis scale
Z=#{empty boxes},ci=1,∑ici2=1000Z = \#\{\text{empty boxes}\},\qquad c_i = 1,\quad \textstyle\sum_i c_i^2 = 1 000
Simulated mean of fsimulating…
Actual 95% half-width…
McDiarmid 95% half-width42.9
McDiarmid / real…
Replicates outside the McDiarmid band…
Moving a ball empties at most one box and fills at most one other: ci=1c_i = 1. McDiarmid is within a factor of 2 of actual width: the worst case is close to typical, and Efron–Stein barely improves it because resampling a ball changes ZZ almost half the time.
One thousand replicates of f(X1,…,Xn)f(X_1, \dots, X_n) with independent XiX_i. Left: histogram with McDiarmid’s guaranteed 95% band (orange) and empirical 2.5% and 97.5% quantiles (blue); gray marks impossible values. Right: three spread scales on a logarithmic axis: actual standard deviation, square root of the Efron–Stein bound, and McDiarmid scale 12∑ici2\tfrac12\sqrt{\sum_i c_i^2}. Start with empty boxes: the band is within a factor of 2 of actual. Switch to maximum of uniforms and raise nn: how does the factor grow? Look at the longest increasing subsequence: which bound resembles reality?

Two observations. For empty boxes, the mean, and Kolmogorov–Smirnov statistic, McDiarmid gets the scale right (factor 2 or 3 regardless of nn): in these examples changing a variable moves ff almost as much as cic_i permits, with appreciable probability. For the maximum of uniforms and the increasing subsequence, the factor grows without bound with nn. Changing the maximum of nn uniforms can move it almost 1, but only if you touch the maximum coordinate, with probability 1/n1/n; even then typical change is order 1/n1/n. The bound sees none of this: only worst case. Efron–Stein will revisit it.

The Doob martingale: revealing variables one by one

To prove Hoeffding we multiplied summands’ moment-generating functions. A general function has no summands, so we must manufacture them. The idea is to reveal X1,X2,…,XnX_1, X_2, \dots, X_n one by one and update the best prediction of ff.

Three properties make it work. Endpoints are as they should be: Z0=EfZ_0 = \E f because nothing is known, and Zn=fZ_n = f because everything is known. The difference to control is therefore a telescoping sum,

f(X)−Ef(X)=Zn−Z0=∑k=1nDk.f(X) - \E f(X) = Z_n - Z_0 = \sum_{k=1}^n D_k.

And each difference has zero mean given the past: by the tower property of conditional expectation, E[Zk∣Fk−1]=E[E[f∣Fk]∣Fk−1]=Zk−1\E[Z_k \given \mathcal{F}_{k-1}] = \E[\E[f \given \mathcal{F}_k] \given \mathcal{F}_{k-1}] = Z_{k-1}, meaning E[Dk∣Fk−1]=0\E[D_k \given \mathcal{F}_{k-1}] = 0. The DkD_k are not independent (step magnitude can depend on earlier revelations), but cannot be predicted: they are martingale differences. This is exactly what the Chernoff argument needs, as shown shortly.

It remains to show steps are small. Independence enters here.

Proof

Define gk(x1,…,xk)=Ef(x1,…,xk,Xk+1,…,Xn)g_k(x_1, \dots, x_k) = \E f(x_1, \dots, x_k, X_{k+1}, \dots, X_n): the average of ff over as-yet-unrevealed variables, with revealed ones fixed. Since (Xk+1,…,Xn)(X_{k+1}, \dots, X_n) is independent of (X1,…,Xk)(X_1, \dots, X_k), Fubini’s theorem gives Zk=gk(X1,…,Xk)Z_k = g_k(X_1, \dots, X_k) almost surely; and since XkX_k is also independent of (X1,…,Xk−1)(X_1, \dots, X_{k-1}), Zk−1=∫gk(X1,…,Xk−1,x)  ⁣dPXk(x)Z_{k-1} = \int g_k(X_1, \dots, X_{k-1}, x)\,\dd P_{X_k}(x). Define

Ak=inf⁡xgk(X1,…,Xk−1,x)−Zk−1,Bk=sup⁡xgk(X1,…,Xk−1,x)−Zk−1.A_k = \inf_x g_k(X_1, \dots, X_{k-1}, x) - Z_{k-1}, \qquad B_k = \sup_x g_k(X_1, \dots, X_{k-1}, x) - Z_{k-1}.

Both depend only on X1,…,Xk−1X_1, \dots, X_{k-1} and enclose Dk=gk(X1,…,Xk)−Zk−1D_k = g_k(X_1, \dots, X_k) - Z_{k-1}. Their difference is

Bk−Ak=sup⁡x,x′E[f(…,x,Xk+1,… )−f(…,x′,Xk+1,… )]≤ck,B_k - A_k = \sup_{x, x'} \E\big[f(\dots, x, X_{k+1}, \dots) - f(\dots, x', X_{k+1}, \dots)\big] \le c_k,

because the integrand is at most ckc_k pointwise. (If the Xk\mathcal{X}_k are uncountable, infimum and supremum must be measurable; for example, it suffices for ff to be continuous.)

∎

Notice what the theorem says and does not say. It does not say ∣Dk∣≤ck/2\abs{D_k} \le c_k/2: interval [Ak,Bk][A_k, B_k] need not be centered at 0. It says something better for our purpose: before revealing XkX_k, we already know which interval of length ckc_k the step will land in. Independence is used twice: without it, revealing XkX_k would also change future variables’ law, and the step could be much larger than ckc_k.

The next figure plots the Doob martingale of three functions with n=30n = 30 for 100 repetitions of the experiment.

InteractiveRevealing variables one by one
Revealed: 30 balls in 30 boxes (highlighted path)
30 of 30 balls revealed · empty boxes: 8
Doob martingale Zk=E[f∣X1,…,Xk]Z_k = \E[f \mid X_1, \dots, X_k], from Ef\E f to ff
  • paths of ZkZ_k
  • highlighted path
  • conditional range of ZkZ_k: Zk−1+[Ak,Bk]Z_{k-1} + [A_k, B_k], length ≤ck\le c_k
  • Azuma 95% band
  • histogram of ZkZ_k (right)
Function f
k = 30
Ef=Z0\E f = Z_010.85
ZkZ_k of the highlighted path8
Actual spread of ZkZ_k (100 paths)1.61
Azuma scale 12∑j≤kcj2\tfrac12\sqrt{\sum_{j \le k} c_j^2}2.74
Largest conditional range Bk−AkB_k - A_k at step kk1 ≤ cₖ = 1
Largest actual jump ∣Dk∣\abs{D_k} at step kk0.733
Each ball enters an occupied or empty box: ZkZ_k has only two possible values, separated by (1−1/n)n−k≤1(1 - 1/n)^{n-k} \le 1. Initially the range is narrow because many balls remain to dilute each effect.
Each trajectory is Zk=E[f∣X1,…,Xk]Z_k = \E[f \given X_1, \dots, X_k] for one experiment: it begins at Ef\E f and ends at ff. Above: revelations in the highlighted trajectory. The orange vertical segment is Zk−1+[Ak,Bk]Z_{k-1} + [A_k, B_k], where ZkZ_k will land, known before revealing XkX_k; dashed curves are the 95% Azuma–Hoeffding band; right: histogram of ZkZ_k. Play the empty-box animation: when does the fan widen most? Switch to maximum and observe the orange segment: what happens once a value near 1 appears?

For empty boxes the fan widens increasingly quickly, because last steps are longest, reaching width on the order of half the Azuma band. For the maximum the contrast is extreme: conditional range is enormous while the revealed maximum is low (the next value could be 1), and shrinks almost to nothing once a high value appears. The possible size of each step is ck=1c_k = 1; the actual size is almost always tiny.

The Azuma–Hoeffding inequality

Now apply the Chernoff method to sum ∑kDk\sum_k D_k. The missing piece is a conditional version of Hoeffding’s lemma: independence is unnecessary, only that each step has zero mean and known range given the past.

Proof

Step 1: conditional Hoeffding lemma. Fix λ∈R\lambda \in \R and an kk; write D,A,BD, A, B for Dk,Ak,BkD_k, A_k, B_k. On event {A<B}\{A < B\}, convexity of x↦eλxx \mapsto e^{\lambda x} gives pointwise,

eλD≤B−DB−A eλA+D−AB−A eλBe^{\lambda D} \le \frac{B - D}{B - A}\,e^{\lambda A} + \frac{D - A}{B - A}\,e^{\lambda B}

(at {A=B}\{A = B\} it is D=0D = 0 and everything is trivial). Since AA and BB are Fk−1\mathcal{F}_{k-1}-measurable, they leave the conditional expectation, and with E[D∣Fk−1]=0\E[D \given \mathcal{F}_{k-1}] = 0,

E[eλD∣Fk−1]≤BeλA−AeλBB−A≤eλ2(B−A)2/8≤eλ2ck2/8.\E[e^{\lambda D} \given \mathcal{F}_{k-1}] \le \frac{B e^{\lambda A} - A e^{\lambda B}}{B - A} \le e^{\lambda^2(B - A)^2/8} \le e^{\lambda^2c_k^2/8}.

The second inequality is exactly the calculation in the proof of Hoeffding’s lemma by convexity (the previous lesson’s exercise), performed for fixed numbers A<0<BA < 0 < B; here it applies pointwise to values taken by AA and BB. (A≤0≤BA \le 0 \le B follows from E[D∣Fk−1]=0\E[D \given \mathcal{F}_{k-1}] = 0.)

Step 2: iterate with the tower. Let Sk=D1+⋯+DkS_k = D_1 + \cdots + D_k. Since Sn−1S_{n-1} is Fn−1\mathcal{F}_{n-1}-measurable,

EeλSn=E[eλSn−1 E[eλDn∣Fn−1]]≤eλ2cn2/8 EeλSn−1≤⋯≤exp⁡(λ28∑kck2).\E e^{\lambda S_n} = \E\Big[e^{\lambda S_{n-1}}\,\E\big[e^{\lambda D_n} \given \mathcal{F}_{n-1}\big]\Big] \le e^{\lambda^2c_n^2/8}\,\E e^{\lambda S_{n-1}} \le \cdots \le \exp\Big(\frac{\lambda^2}{8}\sum_k c_k^2\Big).

Step 3: Chernoff. P(Sn≥t)≤e−λt+λ2∑kck2/8\Pr(S_n \ge t) \le e^{-\lambda t + \lambda^2\sum_k c_k^2/8}, minimized at λ=4t/∑kck2\lambda = 4t/\sum_k c_k^2, equals e−2t2/∑kck2e^{-2t^2/\sum_k c_k^2}. The lower tail is the upper tail of −Dk-D_k, which satisfies the same assumptions with interval [−Bk,−Ak][-B_k, -A_k].

∎

Step 2 is the heart of the method. With independent variables, EeλSn=∏kEeλDk\E e^{\lambda S_n} = \prod_k \E e^{\lambda D_k}; with martingale differences that product is false, but the tower allows “peeling” one factor at a time because each step’s conditional bound is a constant independent of the past. If ckc_k depended on what was revealed, the argument would break.

Azuma–Hoeffding holds for any martingale, not just Doob’s: a player’s capital when wagering at most ckc_k in round kk according to past observations, accumulated online-algorithm error, or a policy’s sum of centered rewards under adaptation. In all these cases steps are dependent but unpredictable, and that suffices.

McDiarmid’s inequality

Putting the two pieces together gives the central result.

Proof

Write f−Ef=∑kDkf - \E f = \sum_k D_k using the Doob martingale. By the conditional-range theorem each DkD_k lies in an interval of length ckc_k with Fk−1\mathcal{F}_{k-1}-measurable endpoints. Apply Azuma–Hoeffding. The proxy statement is step 2 of its proof, and the δ\delta form follows by equating the bound to δ\delta.

∎

If ff is the mean of variables in [a,b][a, b], ci=(b−a)/nc_i = (b-a)/n and ∑ici2=(b−a)2/n\sum_i c_i^2 = (b-a)^2/n: McDiarmid is Hoeffding. Everything else is new.

The same constant appears in differential privacy under another name. If each xix_i is one person’s record, max⁡ici\max_i c_i is the global sensitivity of ff: how much the answer can change when one person is replaced by another. The Laplace mechanism calibrates noise to it. A function with small differences is both stable (concentrates) and easy to privatize.

Efron–Stein: measuring the typical case

The first figure showed McDiarmid can be off by factors growing without bound. For the maximum of nn uniforms, the bound gives fluctuation scale 12n\tfrac12\sqrt n while the actual scale is 1/n1/n: error grows as n3/2n^{3/2}. The problem is cic_i is a supremum over all configurations. Efron–Stein replaces that supremum with an average.

Notation: X=(X1,…,Xn)X = (X_1, \dots, X_n) independent, X′X' an independent copy of XX, and X(i)=(X1,…,Xi′,…,Xn)X^{(i)} = (X_1, \dots, X_i', \dots, X_n) the vector with coordinate ii resampled. Write f=f(X)f = f(X), f(i)=f(X(i))f^{(i)} = f(X^{(i)}), and E(i)\E^{(i)} for expectation over XiX_i alone with the others fixed: E(i)f=∫f(X1,…,x,…,Xn) ⁣dPXi(x)\E^{(i)} f = \int f(X_1, \dots, x, \dots, X_n)\dd P_{X_i}(x). Similarly Var⁡(i)f=E(i)[(f−E(i)f)2]\Var^{(i)} f = \E^{(i)}\big[(f - \E^{(i)} f)^2\big] is the variance left when only XiX_i moves.

Proof

Orthogonality. With the Doob martingale, f−Ef=∑kDkf - \E f = \sum_k D_k, and for j<kj < k, since DjD_j is Fk−1\mathcal{F}_{k-1}-measurable, E[DjDk]=E[Dj E[Dk∣Fk−1]]=0\E[D_jD_k] = \E\big[D_j\,\E[D_k \given \mathcal{F}_{k-1}]\big] = 0. Martingale differences are orthogonal in L2L^2, so

Var⁡f=E(∑kDk)2=∑kEDk2.\Var f = \E\Big(\sum_k D_k\Big)^2 = \sum_k \E D_k^2.

Each step. Variable E(k)f\E^{(k)} f does not depend on XkX_k. Conditioning on Fk\mathcal{F}_k also integrates Xk+1,…,XnX_{k+1}, \dots, X_n, so by independence E[E(k)f∣Fk]\E[\E^{(k)}f \given \mathcal{F}_k] integrates Xk,…,XnX_k, \dots, X_n while holding X1,…,Xk−1X_1, \dots, X_{k-1} fixed: it is Zk−1Z_{k-1}. Therefore

Dk=E[f∣Fk]−E[E(k)f∣Fk]=E[f−E(k)f∣Fk],D_k = \E[f \given \mathcal{F}_k] - \E[\E^{(k)}f \given \mathcal{F}_k] = \E\big[f - \E^{(k)}f \given \mathcal{F}_k\big],

and by conditional Jensen, Dk2≤E[(f−E(k)f)2∣Fk]D_k^2 \le \E[(f - \E^{(k)}f)^2 \given \mathcal{F}_k]. Taking expectations gives EDk2≤E[(f−E(k)f)2]=E[Var⁡(k)f]\E D_k^2 \le \E[(f - \E^{(k)}f)^2] = \E[\Var^{(k)}f].

The other two forms. Fix coordinates other than ii: ff and f(i)f^{(i)} are independent copies of the same variable (a function of XiX_i and Xi′X_i' respectively), and independent copies U,U′U, U' satisfy E(U−U′)2=2Var⁡U\E(U - U')^2 = 2\Var U. Thus 12E(f−f(i))2=EVar⁡(i)f\tfrac12\E(f - f^{(i)})^2 = \E\Var^{(i)}f. Finally, exchanging XiX_i and Xi′X_i' does not change the joint law and changes f−f(i)f - f^{(i)}’s sign, so E(f−f(i))+2=E(f−f(i))−2\E(f - f^{(i)})_+^2 = \E(f - f^{(i)})_-^2, and each is half of E(f−f(i))2\E(f - f^{(i)})^2.

∎

The form with f−f(i)f - f^{(i)} is the calculable one: resample a coordinate and see how much ff changes. Unlike cic_i, the worst possible change, this uses mean squared change. And the positive-part form allows structure to be used: only changes that decrease ff count.

Three consequences:

  • Always improves McDiarmid. If ff has bounded differences, with other coordinates fixed ff lies in an interval of length cic_i, and variance in an interval of length cc is at most c2/4c^2/4. Thus Var⁡f≤vES≤∑ici2/4\Var f \le v_{\mathrm{ES}} \le \sum_i c_i^2/4, McDiarmid’s proxy. This is the ordering of the first figure’s three bars.
  • Exact for sums. If f=∑igi(Xi)f = \sum_i g_i(X_i), Var⁡(i)f=Var⁡gi(Xi)\Var^{(i)}f = \Var g_i(X_i) and the inequality is equality.
  • In exchange, it controls only variance: Chebyshev gives 1/t21/t^2 tails, not exponential ones. Exponential versions exist (entropy method and self-bounding functions, in Boucheron, Lugosi, and Massart), but that is another story.

Return to the first figure and compare the aqua bar with orange for each function. The three measures of spread always have the same order; what changes is where gaps open: between truth and Efron–Stein (empty boxes), Efron–Stein and McDiarmid (maximum), both (increasing subsequence, where the second gap grows faster with nn), or neither (mean, vocabulary).

Gaussian concentration of Lipschitz functions

McDiarmid does not work for unbounded variables: if Zi∼N(0,1)Z_i \sim \Normal(0, 1), changing one coordinate can move f(Z)=∥Z∥2f(\vb{Z}) = \norm{\vb{Z}}_2 arbitrarily far, and ci=∞c_i = \infty. Even truncating coordinates to [−3,3][-3, 3], the norm would have ci=6c_i = 6 and McDiarmid would give fluctuations of order d\sqrt d, whereas actual fluctuations are order 1. Gaussian vectors admit a much stronger result, with a geometric rather than coordinatewise assumption.

Recall f:Rd→Rf : \R^d \to \R is LL-Lipschitz (with respect to Euclidean norm) if ∣f(x)−f(y)∣≤L∥x−y∥2\abs{f(\vb{x}) - f(\vb{y})} \le L\norm{\vb{x} - \vb{y}}_2 for every x,y\vb{x}, \vb{y}. If differentiable, the mean-value inequality gives equivalence to ∥∇f∥≤L\norm{\grad f} \le L everywhere.

Comparison with McDiarmid is instructive. There the bound summed sensitivities of all coordinates, ∑ici2\sum_i c_i^2; here only ∥∇f∥2=∑i(∂if)2\norm{\grad f}^2 = \sum_i (\partial_i f)^2 matters, sensitivity in the worst direction, which can be small even when ff depends on all coordinates. Euclidean norm depends on dd coordinates, but its gradient z/∥z∥\vb{z}/\norm{\vb{z}} always has norm 1.

The following two proofs are complete. Poincaré uses Efron–Stein as a tensorization tool: reducing dimension dd to dimension 1.

Proof

Poincaré in dimension 1. Let hk=Hek/k!h_k = \mathrm{He}_k/\sqrt{k!} be normalized Hermite polynomials, forming an orthonormal basis of L2(N(0,1))L^2(\Normal(0, 1)) (a classical completeness result), and write g=∑kakhkg = \sum_k a_kh_k, with Var⁡g(Z)=∑k≥1ak2\Var g(Z) = \sum_{k \ge 1}a_k^2. Since Gaussian density satisfies φ′(x)=−xφ(x)\varphi'(x) = -x\varphi(x), integration by parts gives E[g′(Z)h(Z)]=E[g(Z)(Zh(Z)−h′(Z))]\E[g'(Z)h(Z)] = \E[g(Z)(Zh(Z) - h'(Z))] for every polynomial hh (if gg is C1C^1 with gg and g′g' of polynomial growth, boundary terms vanish; the general case follows by density), and Hermite recurrence gives xhk−1(x)−hk−1′(x)=k hk(x)xh_{k-1}(x) - h_{k-1}'(x) = \sqrt k\,h_k(x). Thus E[g′(Z)hk−1(Z)]=k ak\E[g'(Z)h_{k-1}(Z)] = \sqrt k\,a_k, and by Parseval

Eg′(Z)2=∑k≥1k ak2≥∑k≥1ak2=Var⁡g(Z),\E g'(Z)^2 = \sum_{k \ge 1}k\,a_k^2 \ge \sum_{k \ge 1}a_k^2 = \Var g(Z),

with equality only if ak=0a_k = 0 for k≥2k \ge 2, meaning gg is affine.

Tensorization. By the first Efron–Stein form, Var⁡f(Z)≤∑iE[Var⁡(i)f]\Var f(\vb{Z}) \le \sum_i \E[\Var^{(i)} f]. Holding other coordinates fixed, Var⁡(i)f\Var^{(i)} f is variance of a function of one Gaussian, and one-dimensional Poincaré gives Var⁡(i)f≤E(i)(∂if)2\Var^{(i)} f \le \E^{(i)}(\partial_i f)^2. Summing gives Var⁡f(Z)≤E∑i(∂if)2=E∥∇f∥2\Var f(\vb{Z}) \le \E\sum_i(\partial_if)^2 = \E\norm{\grad f}^2.

∎

For the tail, the shortest argument (Maurey and Pisier) loses slightly in the constant but shows where dimension independence comes from: Gaussian rotational invariance.

Proof

Suppose ff differentiable with ∥∇f∥≤L\norm{\grad f} \le L (a Lipschitz function can be uniformly approximated by smoothings with the same constant, and the bound passes to the limit). Let Y\vb{Y} be an independent copy of Z\vb{Z}. By Jensen in Y\vb{Y}, eλ(f(Z)−Ef)≤EYeλ(f(Z)−f(Y))e^{\lambda(f(\vb{Z}) - \E f)} \le \E_{\vb{Y}}e^{\lambda(f(\vb{Z}) - f(\vb{Y}))}, so it suffices to bound Eeλ(f(Z)−f(Y))\E e^{\lambda(f(\vb{Z}) - f(\vb{Y}))}.

Interpolate along a circular arc: Zθ=Zsin⁡θ+Ycos⁡θ\vb{Z}_\theta = \vb{Z}\sin\theta + \vb{Y}\cos\theta for θ∈[0,π/2]\theta \in [0, \pi/2], going from Y\vb{Y} to Z\vb{Z} with velocity Zθ′=Zcos⁡θ−Ysin⁡θ\vb{Z}_\theta' = \vb{Z}\cos\theta - \vb{Y}\sin\theta. Then

f(Z)−f(Y)=∫0π/2⟨∇f(Zθ),Zθ′⟩ ⁣dθ=2π∫0π/2π2⟨∇f(Zθ),Zθ′⟩ ⁣dθ,f(\vb{Z}) - f(\vb{Y}) = \int_0^{\pi/2}\inner{\grad f(\vb{Z}_\theta)}{\vb{Z}_\theta'}\dd\theta = \frac{2}{\pi}\int_0^{\pi/2}\frac{\pi}{2}\inner{\grad f(\vb{Z}_\theta)}{\vb{Z}_\theta'}\dd\theta,

an average over θ\theta. By Jensen on that average, eλ(f(Z)−f(Y))≤2π∫0π/2exp⁡(λπ2⟨∇f(Zθ),Zθ′⟩) ⁣dθe^{\lambda(f(\vb{Z}) - f(\vb{Y}))} \le \frac{2}{\pi}\int_0^{\pi/2}\exp\big(\lambda\tfrac{\pi}{2}\inner{\grad f(\vb{Z}_\theta)}{\vb{Z}_\theta'}\big)\dd\theta. For each θ\theta, (Zθ,Zθ′)(\vb{Z}_\theta, \vb{Z}_\theta') is a rotation of (Z,Y)(\vb{Z}, \vb{Y}), so by rotational invariance they are two independent N(0,Id)\Normal(\vb{0}, \mat{I}_d). Conditioning on Zθ\vb{Z}_\theta, the inner product is N(0,∥∇f(Zθ)∥2)\Normal(0, \norm{\grad f(\vb{Z}_\theta)}^2), with variance at most L2L^2:

Eexp⁡(λπ2⟨∇f(Zθ),Zθ′⟩)≤eλ2π2L2/8.\E\exp\big(\lambda\tfrac{\pi}{2}\inner{\grad f(\vb{Z}_\theta)}{\vb{Z}_\theta'}\big) \le e^{\lambda^2\pi^2L^2/8}.

Therefore f(Z)−Ef∈SG⁡(π2L2/4)f(\vb{Z}) - \E f \in \operatorname{SG}(\pi^2L^2/4) and P(f−Ef≥t)≤e−2t2/(π2L2)\Pr(f - \E f \ge t) \le e^{-2t^2/(\pi^2L^2)}.

∎

The optimal constant e−t2/(2L2)e^{-t^2/(2L^2)} requires more machinery (the Ornstein–Uhlenbeck semigroup, or logarithmic Sobolev inequality with Herbst’s argument; chapter 5 of Boucheron, Lugosi, and Massart). But Maurey and Pisier’s proof already contains the idea: dimension appears at no step. Only rotational invariance and bounded gradient are used.

Some useful 1-Lipschitz functions and what the theorem says about each:

  • Norm. ∥Z∥2\norm{\vb{Z}}_2 fluctuates O(1)\bigO(1) around a mean near d\sqrt d. Poincaré also gives E∥Z∥2−(E∥Z∥)2≤1\E\norm{\vb{Z}}^2 - (\E\norm{\vb{Z}})^2 \le 1, so d−1≤E∥Z∥≤d\sqrt{d - 1} \le \E\norm{\vb{Z}} \le \sqrt d. This begins the next lesson’s norm concentration.
  • Maximum. max⁡iZi\max_i Z_i has gradient earg⁡max⁡\vb{e}_{\arg\max}: it is 1-Lipschitz. With the maximal inequality, giving Emax⁡iZi≤2log⁡d\E\max_i Z_i \le \sqrt{2\log d}, this yields max⁡iZi≤2log⁡d+t\max_i Z_i \le \sqrt{2\log d} + t with probability at least 1−e−t2/21 - e^{-t^2/2}.
  • Distances. For any set AA, z↦dist⁡(z,A)\vb{z} \mapsto \operatorname{dist}(\vb{z}, A) is 1-Lipschitz, so a Gaussian point’s distance to any set concentrates.
  • Matrix norms. If G\mat{G} is a matrix m×dm \times d with independent N(0,1)\Normal(0, 1) entries, G↦∥G∥op\mat{G} \mapsto \norm{\mat{G}}_{\mathrm{op}} is 1-Lipschitz with respect to Frobenius norm, the Euclidean norm of Rmd\R^{md}. The largest singular value fluctuates O(1)\bigO(1) around a mean of order m+d\sqrt m + \sqrt d; see the lesson on extreme singular values.
InteractiveDimension-free concentration
Standard deviation of f(Z)f(\vb{Z}), Z∼N(0,Id)\vb{Z} \sim \Normal(\vb{0}, \mat{I}_d), versus dd
Poincaré: √Var ≤ L = 1simulando 8·10⁶ normales…
  • ‖z‖₂
  • max zᵢ
  • orthant distance
  • median
  • ‖z‖₁
  • ‖z‖₂²
f−meanf - \text{mean} with d=1 000d = 1\,000 (400 samples, fixed window)
95 %
  • simulated histogram
  • N(0,1)\Normal(0, 1) density, that of f(z)=z1f(\vb{z}) = z_1
  • guaranteed 95% band
1 000
Mean of f…
Standard deviation of f…
Lipschitz constant in ℓ2\ell_21
Guaranteed 95% half-width, L2log⁡40L\sqrt{2\log 40}2.72
Samples outside window ±5…
Simulating…
Four hundred vectors Z∼N(0,Id)\vb{Z} \sim \Normal(\vb{0}, \mat{I}_d) for each dd between 1 and 10410^4, and six functions. Left: standard deviation versus dd on log-log axes, with the Poincaré bound for 1-Lipschitz functions. Right: histogram of f−meanf - \text{mean} in a fixed window, with the guaranteed 95% Gaussian concentration band. Drag dd for the norm: the mean rises from 0.8 to 100 and the histogram does not change. Which 1-Lipschitz functions concentrate much better than required? Choose squared norm and ℓ1\ell_1 norm: which assumptions fail?

Norm standard deviation converges to 1/2≈0.7071/\sqrt2 \approx 0.707, unchanged between d=10d = 10 and d=104d = 10^4. Maximum coordinate and median concentrate even more (around 0.30.3 and 0.0130.013 with d=104d = 10^4): the theorem is an upper bound. For them the gradient has norm 1, but is ej\vb{e}_j with index jj (maximum or median coordinate) changing between samples: each coordinate influences with small probability, which Poincaré, looking only at ∥∇f∥\norm{\grad f}, cannot see. This is superconcentration (Chatterjee). Squared norm is not Lipschitz and its standard deviation 2d\sqrt{2d} grows without bound. Norm ℓ1\ell_1 is 1-Lipschitz with respect to ∥⋅∥1\norm{\cdot}_1, but its Euclidean constant is d\sqrt d and its standard deviation grows as (1−2/π)d≈0.6d\sqrt{(1 - 2/\pi)d} \approx 0.6\sqrt d.

Is there something similar for bounded non-Gaussian variables? In part. Talagrand proved in 1995 that convex Lipschitz functions of independent variables in [0,1][0, 1] concentrate independently of dimension. Without convexity this fails: with even nn and XX uniform on cube {0,1}n\{0, 1\}^n, Euclidean distance to the (nonconvex) set A={x∈{0,1}n:∑ixi≤n/2}A = \{\vb{x} \in \{0, 1\}^n : \sum_i x_i \le n/2\} is 1-Lipschitz and at vertices equals (∑ixi−n/2)+\sqrt{(\sum_i x_i - n/2)_+} (that many ones must be switched off), fluctuating at scale n1/4n^{1/4}.

Limits of the method

All three inequalities are guarantees and fail as guarantees do: they cease to be informative. It helps to recognize when.

Worst case far from typical. McDiarmid charges each coordinate its worst possible change. If that occurs only in rare configurations, the bound is correct and useless: for maximum of uniforms, with n=1000n = 1000, the 95% band has width ±42.9\pm 42.9 for a variable living in [0,1][0, 1] and falling 95% of the time in [0.996,1][0.996, 1]. There are three exits: Efron–Stein if variance suffices; Bernstein-type variance versions of McDiarmid replacing ∑ici2\sum_i c_i^2 with the sum of conditional variances of DkD_k plus a maximum-jump term; and typical bounded differences (Warnke, 2016), allowing small constants outside a low-probability bad event.

Dependence. Bounded differences are a function property; independence belongs to variables and is used twice in the proof. If X1=X2=⋯=Xn=UX_1 = X_2 = \cdots = X_n = U with uniform UU, mean Xˉn\bar X_n has ci=1/nc_i = 1/n but equals UU and does not concentrate at all. Weak dependence admits remedies (grouping independent blocks, martingales with other filtrations), but McDiarmid does not apply unchanged.

Concentration is not localization. These bounds are all around Ef\E f, often the hard part. Sometimes it is known (empty boxes), sometimes bounded by other techniques (Rademacher, maximal), and sometimes unknown for decades (chromatic number).

The right norm. Gaussian concentration requires Lipschitz continuity in Euclidean norm. A neural network with small Lipschitz constant in ℓ∞\ell_\infty can have a huge constant in ℓ2\ell_2 in high dimension, and vice versa. Before applying the theorem check the norm used: this underlies robustness Lipschitz certificates.

Implementation from scratch

First, empty boxes: a vectorized simulator, exact mean and variance, the exact Efron–Stein bound (for each ball compare ff with its value after resampling its box), and observed tails versus McDiarmid.

[ ]Empty boxes: McDiarmid and Efron–Stein from scratchBrowser
import numpy as np

def cajas_vacias(b, m):
    """b: (réplicas, n) con la caja de cada bola. Devuelve el número de cajas vacías y los conteos."""
    reps = b.shape[0]
    cuenta = np.zeros((reps, m), dtype=np.int64)
    np.add.at(cuenta, (np.arange(reps)[:, None], b), 1)
    return (cuenta == 0).sum(axis=1), cuenta

def exactas(n, m):
    q1, q2 = (1 - 1/m)**n, (1 - 2/m)**n
    return m*q1, m*q1 + m*(m - 1)*q2 - (m*q1)**2

def efron_stein_cajas(b, cuenta, m, rng):
    """v_ES = ½ Σᵢ E(f − f⁽ⁱ⁾)², remuestreando la caja de cada bola i."""
    reps, n = b.shape
    r = np.arange(reps)[:, None]
    vacia_al_quitar = cuenta[r, b] == 1          # la bola estaba sola: su caja se vacía
    j = rng.integers(0, m, size=(reps, n))       # caja nueva
    cj = cuenta[r, j] - (j == b)                 # ocupación de la caja nueva sin la bola i
    llena_al_poner = cj == 0                     # la bola estrena caja
    dif = vacia_al_quitar.astype(int) - llena_al_poner.astype(int)
    return 0.5 * (dif**2).sum(axis=1).mean()

rng = np.random.default_rng(0)
n = m = 1000
b = rng.integers(0, m, size=(2000, n))
Z, cuenta = cajas_vacias(b, m)
E, V = exactas(n, m)
v_es = efron_stein_cajas(b, cuenta, m, rng)
print(f"n = m = {n}:  E Z = {E:.1f} (simulada {Z.mean():.1f}),  sd = {np.sqrt(V):.2f} (simulada {Z.std():.2f})")
print(f"  √v_ES = {np.sqrt(v_es):.2f}    escala de McDiarmid √(Σc²)/2 = {np.sqrt(n)/2:.2f}")
print("\n   t    P(|Z − EZ| ≥ t) simulada    McDiarmid 2exp(−2t²/n)")
for t in [10, 20, 30, 43, 60]:
    print(f"{t:4d}    {np.mean(np.abs(Z - E) >= t):10.4f}               {min(1, 2*np.exp(-2*t**2/n)):.4f}")

Actual standard deviation is 9.99.9, Efron–Stein’s 15.215.2, and McDiarmid’s scale 15.815.8: for this function both bounds nearly coincide, as anticipated. In the tails, McDiarmid guarantees 5% at t=43t = 43; simulation finds no replicate that far, and at t=30t = 30 observes 0.4 %0.4\,\% versus guaranteed 33 %33\,\%. The bound is valid and conservative.

Second, a numerical check of both proofs: the empty-box Doob martingale, calculated by closed form, must end at ff, have steps within conditional range, and orthogonal differences whose squares sum to variance.

[ ]The empty-box Doob martingaleBrowser
import numpy as np

rng = np.random.default_rng(3)
n = m = 12
reps = 200_000
q = 1 - 1/m
b = rng.integers(0, m, size=(reps, n))
ocupadas = np.zeros((reps, m), dtype=bool)
Zk = np.empty((reps, n + 1))
Zk[:, 0] = m * q**n                                    # E f
for k in range(1, n + 1):
    ocupadas[np.arange(reps), b[:, k - 1]] = True
    Zk[:, k] = (m - ocupadas.sum(axis=1)) * q**(n - k)  # E[f | X_1..X_k]
D = np.diff(Zk, axis=1)
f = Zk[:, -1]
print("Z_n coincide con f:", np.array_equal(f, (~ocupadas).sum(axis=1)))
print("máx |D_k| / (1 − 1/m)^(n−k):", np.max(np.abs(D) / q**(n - np.arange(1, n + 1))).round(4), "(≤ 1)")
G = D.T @ D / reps                                     # matriz de E[D_j D_k]
print("máx |E D_j D_k| con j ≠ k:", np.abs(G - np.diag(np.diag(G))).max().round(5))
print("Var f =", f.var().round(4), "   Σ E D_k² =", np.trace(G).round(4))
print("E D_k² por paso:", np.diag(G).round(3))

Cross-products are simulation noise (order 10−310^{-3}), and ∑kEDk2\sum_k\E D_k^2 reproduces variance: the orthogonality identity from the first Efron–Stein step. Late steps contribute more variance than early ones, as in the martingale figure.

Third, longest increasing subsequence using patience sorting, which computes it in O(nlog⁡n)\bigO(n\log n): maintain minimal tails of increasing subsequences of each length, and each new value replaces the first tail at least as large as it.

[ ]Longest increasing subsequence: three scalesBrowser
import numpy as np
from bisect import bisect_left

def lis(x):
    """Longitud de la subsecuencia creciente más larga: ordenación por paciencia, O(n log n)."""
    colas = []
    for v in x:
        k = bisect_left(colas, v)
        if k == len(colas):
            colas.append(v)
        else:
            colas[k] = v
    return len(colas)

rng = np.random.default_rng(1)
print("    n    E L    sd L   √v_ES (est.)   √E L   McDiarmid √n/2")
for n in [100, 400, 1600]:
    reps = 300
    X = rng.random((reps, n))
    L = np.array([lis(x) for x in X])
    d2 = []                                   # v_ES ≈ ½ n E(f − f⁽ᴵ⁾)², con I al azar
    for x, l in zip(X, L):
        y = x.copy()
        y[rng.integers(n)] = rng.random()
        d2.append((l - lis(y))**2)
    v_es = 0.5 * n * np.mean(d2)
    print(f"{n:5d}  {L.mean():6.1f}  {L.std():6.2f}     {np.sqrt(v_es):6.2f}      {np.sqrt(L.mean()):6.2f}   {np.sqrt(n)/2:6.2f}")

Multiplying nn by 16 multiplies McDiarmid’s scale by 4 and Efron–Stein’s by slightly less than 2, as 161/4=216^{1/4} = 2 predicts. Actual standard deviation grows similarly in this range (from 1.651.65 to 3.083.08), staying about half Efron–Stein’s square root; its asymptotic law n1/6n^{1/6} appears only for much larger nn. The mean ELn\E L_n grows as 2n2\sqrt n with a negative correction of order n1/6n^{1/6}: with n=1600n = 1600 it is about 74, still far from 80.

Finally, a Gaussian vector’s norm and effective constants: for each function, the ∑ici2\sum_i c_i^2 that would make McDiarmid’s bound exact at the 99% quantile of ∣f−Ef∣\abs{f - \E f}. If much smaller than the true ∑ici2\sum_i c_i^2, the function concentrates better than worst case can show.

[ ]Gaussian concentration and effective constantsBrowser
import numpy as np

rng = np.random.default_rng(2)
print("     d    E‖Z‖     sd‖Z‖   sd‖Z‖²   P(|‖Z‖ − E| ≥ 2)   cota 2e^(−2)")
for d in [10, 100, 1000, 10000]:
    Z = rng.standard_normal((400, d))
    r = np.linalg.norm(Z, axis=1)
    print(f"{d:6d}  {r.mean():7.2f}  {r.std():7.3f}  {(r**2).std():7.1f}      {np.mean(np.abs(r - r.mean()) >= 2):.4f}          {2*np.exp(-2):.4f}")

def suma_c2_efectiva(f, delta=0.01):
    """Σc² con el que 2 exp(−2t²/Σc²) = δ en el cuantil 1 − δ observado de |f − E f|."""
    q = np.quantile(np.abs(f - f.mean()), 1 - delta)
    return 2 * q**2 / np.log(2 / delta)

n = 1000
U = rng.random((3000, n))
Z_cajas = cajas_vacias(rng.integers(0, n, (2000, n)), n)[0].astype(float)   # función de la primera celda
casos = {"media de uniformes": (U.mean(axis=1), n * (1/n)**2),
         "máximo de uniformes": (U.max(axis=1), n * 1.0),
         "cajas vacías": (Z_cajas, n * 1.0)}
print(f"\nn = {n}               Σc² efectiva   Σc² verdadera    cociente")
for nombre, (f, c2) in casos.items():
    e = suma_c2_efectiva(f)
    print(f"  {nombre:22s} {e:10.3g}     {c2:10.3g}     {c2 / e:10.3g}")

The norm’s standard deviation remains at 0.70.7 from d=10d = 10 to d=104d = 10^4, while the square’s rises from 4.6 to 138 (theoretical 2d\sqrt{2d}). Observed probability of deviating 2 units is a few thousandths versus guaranteed 27 %27\,\%: the theorem’s constant is for the worst 1-Lipschitz function (a projection), and norm is much more docile. In the effective-constants table, mean and empty boxes have ratios 5.2 and 4.4 (the bound is within a constant factor, including loss from using an exponential bound instead of the exact tail), and maximum 2⋅1082\cdot 10^8: worst case has little to do with typical.

Using libraries

There are no library functions for McDiarmid or Efron–Stein: each is one line. SciPy does have exact laws for two examples, useful for comparison with bounds. scipy.stats.kstwo is the exact law of Kolmogorov–Smirnov statistic DnD_n, and scipy.stats.chi of a Gaussian vector’s norm.

[ ]Bounds versus exact laws (SciPy)Browser
import numpy as np
from scipy import stats

def media_sd(ley, x):
    """E D y sd D a partir de la cola: E D = ∫ P(D > x) dx, E D² = ∫ 2x P(D > x) dx (trapecios)."""
    sf = ley.sf(x)
    integra = lambda y: float(((y[1:] + y[:-1]) * np.diff(x)).sum() / 2)
    m = integra(sf)
    return m, np.sqrt(integra(2 * x * sf) - m**2)

x = np.linspace(0, 1, 801)
print("Kolmogórov-Smirnov: P(D_n ≥ E D_n + t) exacta, McDiarmid e^(−2nt²) y DKW 2e^(−2n(E D_n + t)²)")
for n in [20, 100, 1000]:
    Dn = stats.kstwo(n)
    ED, sdD = media_sd(Dn, x)
    print(f"  n = {n:4d}: E D_n = {ED:.4f}, sd = {sdD:.4f}")
    for t in [0.05, 0.10]:
        print(f"     t = {t}:  exacta {Dn.sf(ED + t):.2e}   McDiarmid {np.exp(-2*n*t**2):.2e}"
              f"   DKW {2*np.exp(-2*n*(ED + t)**2):.2e}")

print("\nNorma gaussiana: P(|‖Z‖ − E‖Z‖| ≥ t) exacta frente a 2e^(−t²/2)")
for d in [1, 10, 100, 10000]:
    R = stats.chi(d)
    E = R.mean()
    filas = "   ".join(f"t={t}: {R.sf(E + t) + R.cdf(E - t):.1e} vs {2*np.exp(-t*t/2):.1e}" for t in [1, 2, 3])
    print(f"  d = {d:5d}  sd = {R.std():.4f}   {filas}")

Two observations. For Kolmogorov–Smirnov, McDiarmid is very conservative compared with the exact law and the DKW inequality specific to this case and almost exact. McDiarmid’s value is not this example but that it works the same for a supremum over any class. For Gaussian norm, exact standard deviation converges to 1/21/\sqrt2 and exact tails are two to three orders of magnitude below the bound at t=3t = 3, simultaneously in every dimension: independence of dd is real, and the theorem’s constant is loose for this function.

Common mistakes

Exercises

NumericBound for empty boxes
You throw n=10 000n = 10\,000 balls independently and randomly into 10 00010\,000 boxes. Let ZZ be the number of empty boxes. What McDiarmid bound applies to P(∣Z−EZ∣≥300)\Pr(\abs{Z - \E Z} \ge 300)?
QuizMcDiarmid for the mean
Let X1,…,XnX_1, \dots, X_n be independent in [0,1][0, 1] and f=Xˉnf = \bar X_n. What does McDiarmid give?
NumericThe chromatic-number window
For graph G(n,1/2)G(n, 1/2) with n=106n = 10^6 vertices, use vertex exposure (nn independent variables, ci=1c_i = 1) and McDiarmid to find the smallest tt such that P(∣χ(G)−Eχ(G)∣≥t)≤0.01\Pr(\abs{\chi(G) - \E\chi(G)} \ge t) \le 0.01.
QuizWhat the increasing-subsequence bounds know
Let LnL_n be the longest increasing subsequence length of n=104n = 10^4 independent uniforms (ELn≈192\E L_n \approx 192). Which statements are true?

More than one answer may be correct.

QuizWhat fluctuates O(1) in every dimension?
Let Z∼N(0,Id)\vb{Z} \sim \Normal(\vb{0}, \mat{I}_d). For which functions does Gaussian concentration guarantee O(1)\bigO(1) fluctuations independent of dd?

More than one answer may be correct.

ProofMcDiarmid’s inequality
Prove: If X1,…,XnX_1, \dots, X_n are independent and ff has bounded differences with constants cic_i, then P(f(X)−Ef(X)≥t)≤exp⁡(−2t2/∑ici2)\Pr(f(X) - \E f(X) \ge t) \le \exp(-2t^2/\sum_i c_i^2) for every t≥0t \ge 0.
0
Let Fk=σ(X1,…,Xk)\mathcal{F}_k = \sigma(X_1, \dots, X_k), Zk=E[f∣Fk]Z_k = \E[f \given \mathcal{F}_k] and Dk=Zk−Zk−1D_k = Z_k - Z_{k-1}, so f−Ef=∑kDkf - \E f = \sum_k D_k and E[Dk∣Fk−1]=0\E[D_k \given \mathcal{F}_{k-1}] = 0.

Step 1 of 4. What can be stated about each DkD_k?

ProofEfron–Stein inequality
Prove: If X1,…,XnX_1, \dots, X_n are independent and Ef(X)2<∞\E f(X)^2 < \infty, then Var⁡f≤∑iE[Var⁡(i)f]=12∑iE(f−f(i))2\Var f \le \sum_i\E[\Var^{(i)}f] = \frac12\sum_i\E(f - f^{(i)})^2.
0
Use the Doob martingale Zk=E[f∣Fk]Z_k = \E[f \given \mathcal{F}_k] and its differences DkD_k. Recall E(i)\E^{(i)} integrates only XiX_i and f(i)f^{(i)} is ff with XiX_i replaced by an independent copy Xi′X_i'.

Step 1 of 4. Why does Var⁡f=∑kEDk2\Var f = \sum_k\E D_k^2?

CodeBounded-difference constants by random search
Implement estimar_c(f, n, ensayos=2000, seed=0) for a function f:[0,1]n→Rf : [0, 1]^n \to \R receiving a NumPy array: in each trial, sample x∼Unif⁡[0,1]nx \sim \Unif[0, 1]^n and, for each ii, replace xix_i by a new y∼Unif⁡[0,1]y \sim \Unif[0, 1]; return the array of largest ∣f(x)−f(x con xi=y)∣\abs{f(x) - f(x \text{ con } x_i = y)} seen for each ii (with that coordinate replaced in ff). Also implement cota_mcdiarmid(c, t), the two-sided bound min⁡(1,2exp⁡(−2t2/∑ici2))\min\big(1, 2\exp(-2t^2/\sum_i c_i^2)\big). Use np.random.default_rng(seed).
import numpy as np

def estimar_c(f, n, ensayos=2000, seed=0):
  """Estimación de las constantes c_i de f: [0, 1]^n -> R por búsqueda aleatoria."""
  rng = np.random.default_rng(seed)
  c = np.zeros(n)
  # tu código
  return c

def cota_mcdiarmid(c, t):
  """min(1, 2 exp(-2 t^2 / suma de c_i^2))."""
  # tu código
  return 1.0
Shift+Enter to run

Summary

Key idea
A function of many independent variables that does not depend too much on any one concentrates around its mean like a sum. Revealing variables one by one (the Doob martingale) writes f−Eff - \E f as a sum of unpredictable steps with known range, and Azuma–Hoeffding yields McDiarmid: tails e−2t2/∑ici2e^{-2t^2/\sum_i c_i^2}. Efron–Stein replaces worst case cic_i by typical squared change, and for Gaussian vectors LL-Lipschitz continuity in Euclidean norm suffices for fluctuations at scale LL in any dimension.
  • Doob martingale: Zk=E[f∣X1,…,Xk]Z_k = \E[f \given X_1, \dots, X_k] goes from Ef\E f to ff; its differences have zero conditional mean and, with independence and bounded differences, conditional range of length ≤ck\le c_k known beforehand.
  • Azuma–Hoeffding: for martingale differences with predictable ranges of length ckc_k, P(∑kDk≥t)≤e−2t2/∑kck2\Pr(\sum_k D_k \ge t) \le e^{-2t^2/\sum_k c_k^2}. The tower replaces the MGF product.
  • McDiarmid: f−Ef∈SG⁡(∑ici2/4)f - \E f \in \operatorname{SG}(\sum_i c_i^2/4). For means it is Hoeffding; it gives O(n)\bigO(\sqrt n) for empty boxes and chromatic number, and O(1/n)\bigO(1/\sqrt n) for empirical-process suprema, the first step of Rademacher bounds.
  • Efron–Stein: Var⁡f≤12∑iE(f−f(i))2≤∑ici2/4\Var f \le \frac12\sum_i\E(f - f^{(i)})^2 \le \sum_i c_i^2/4. It gets the maximum’s order right and improves McDiarmid for increasing subsequences (Var⁡Ln≤ELn\Var L_n \le \E L_n), but controls only variance.
  • Gaussian concentration: ff LL-Lipschitz in ℓ2\ell_2 implies P(f(Z)−Ef≥t)≤e−t2/(2L2)\Pr(f(\vb{Z}) - \E f \ge t) \le e^{-t^2/(2L^2)} and Var⁡f(Z)≤L2\Var f(\vb{Z}) \le L^2, independent of dimension. Euclidean norm is required; ∥⋅∥1\norm{\cdot}_1 and ∥⋅∥2\norm{\cdot}^2 do not satisfy it.
  • None of the three determines Ef\E f, all require independence (or Gaussianity), and McDiarmid can be empty when worst case is far from typical.