From Independent Inputs to a Martingale
A function of independent observations need not be a sum. It might be a maximum, a product, or a statistic built from many interacting inputs. The bounded-difference condition handles such functions by asking how much the output can change when just one input is replaced. The proof then reveals the inputs one at a time and tracks the successive changes in conditional expectation.
Those successive changes form a Doob martingale. Although its increments are generally not independent, the bounded-difference condition controls their conditional ranges. Hoeffding’s lemma can be applied conditionally at each step, and iterating the resulting moment-generating-function bounds gives McDiarmid’s inequality.
The conditional-expectation definition gives \(M_0=E[Z]\) and \(M_n=Z\) almost surely. Also, \(E[D_i\mid\mathcal{F}_{i-1}]=0\). Thus the increments satisfy \(Z-E[Z]=\sum_{i=1}^n D_i\). The key task is to bound the range of \(D_i\), conditional on the inputs already revealed.
Bounded Differences and Conditional Ranges
Here is the link between this condition and the martingale increments. Given the first \(i-1\) inputs and a candidate value \(x_i\) for the next one, average \(g\) over the remaining inputs:
where \(\mu_j\) is the distribution of \(X_j\); for \(i=n\), this is just \(g(x_1,\ldots,x_n)\). The integral exists because \(g\) is bounded and measurable. Independence ensures that, given the first \(i\) inputs, the unrevealed inputs have their original product distribution. Consequently \(M_i=h_i(X_1,\ldots,X_i)\) almost surely.
If \(x_i\) and \(x_i'\) are two possible values of the \(i\)th input, the vectors inside the integral differ only in coordinate \(i\). The bounded-difference condition therefore implies
So, with the past fixed, \(M_i\) ranges over an interval of length at most \(c_i\) as \(X_i\) varies. Subtracting \(M_{i-1}\), which is fixed given that past, shifts this interval but does not change its length. Thus \(D_i\), conditionally on \(\mathcal{F}_{i-1}\), lies in an interval of length at most \(c_i\), and its conditional mean is zero.
McDiarmid’s Inequality: The Doob-Martingale Proof
We use Hoeffding’s lemma in its centered form: if a random variable \(W\) lies almost surely in an interval of length \(c\), then, for every real \(\lambda\),
The same bound holds conditionally when the interval and mean are interpreted given a sigma-field. Applying it to \(D_i\) conditional on \(\mathcal{F}_{i-1}\) gives
Since \(Z-E[Z]=\sum_{i=1}^nD_i\), condition on \(\mathcal{F}_{n-1}\) and apply the conditional Hoeffding bound to \(D_n\). Repeating this step for \(D_{n-1},\ldots,D_1\) gives \(E[e^{\lambda(Z-E[Z])}]\leq\exp(\lambda^2C/8)\).
For \(\lambda>0\), \(P(Z-E[Z]\geq t)\leq e^{-\lambda t}E[e^{\lambda(Z-E[Z])}]\leq\exp(-\lambda t+\lambda^2C/8)\).
The exponent is minimized at \(\lambda=4t/C\), giving the upper-tail bound. Apply the same argument to \(-Z\) for the lower tail and add the two probabilities.
For completeness, the moment-generating-function iteration in Step 1 follows directly from conditional expectation. If \(S_{i-1}=\sum_{j=1}^{i-1}D_j\), then \(S_{i-1}\) is \(\mathcal{F}_{i-1}\)-measurable, so
Iterating from \(i=1\) to \(n\) yields the stated bound. In the tail calculation, substituting \(\lambda=4t/C\) gives \(-\lambda t+\lambda^2C/8=-2t^2/C\). If \(C=0\), every coordinate has zero allowed change, so \(g\) is constant on its product domain and the centered deviation is zero; the tail probability is then zero for \(t>0\). This completes the proof. \(\square\)
Worked Applications
Worked Example: A Bernoulli Sample Proportion
Let \(X_1,\ldots,X_{100}\) be independent Bernoulli random variables with success probability \(1/2\), and let \(Z=100^{-1}\sum_{i=1}^{100}X_i\). Replacing one input changes the sum by at most \(1\), so it changes \(Z\) by at most \(c_i=1/100\). Therefore
\(C=100(1/100)^2=1/100\), and \(E[Z]=1/2\). For a deviation of \(t=0.1\), McDiarmid’s inequality gives
For the upper tail alone, the bound is \(e^{-2}\approx 0.1353\). This example recovers a familiar independent-sum concentration bound, now expressed through the successive conditional expectations of the sample proportion.
Worked Example: An Empirical CDF at a Fixed Point
Let \(X_1,\ldots,X_{40}\) be independent Uniform\((0,1)\) observations. At the fixed point \(a=0.3\), the empirical CDF is \(F_{40}(a)=40^{-1}\sum_{i=1}^{40}\mathbf{1}\{X_i\leq a\}\). Each indicator has mean \(0.3\), so \(E[F_{40}(a)]=0.3\). Replacing one observation changes at most one indicator and hence changes \(F_{40}(a)\) by at most \(1/40\). Thus
\(C=40(1/40)^2=1/40\). For \(t=0.15\), the two-sided bound is
The argument applies to this fixed point without requiring the statistic to be a sum of the original observations themselves: it is enough that it is a function of independent inputs with bounded changes.
Worked Example: A Product of Two Bernoulli Variables
Let \(X_1,X_2\) be independent Bernoulli\((1/2)\) variables and set \(Z=X_1X_2\). The expectation is \(E[Z]=1/4\). Replacing either input changes the product by at most \(1\), so take \(c_1=c_2=1\) and \(C=2\). The one-sided inequality at \(t=0.5\) gives
The event on the left is exactly \(\{X_1=X_2=1\}\), because \(Z\) is either \(0\) or \(1\), and only \(Z=1\) has \(Z-1/4\geq 0.5\). Its actual probability is \(1/4\), confirming the bound. The Doob martingale makes the successive revelation explicit: \(M_0=1/4\), \(M_1=X_1/2\), and \(M_2=X_1X_2\). Hence \(D_1=X_1/2-1/4\), while \(D_2=X_1X_2-X_1/2\). Given \(X_1=0\), \(D_2=0\); given \(X_1=1\), \(D_2=X_2-1/2\), which has conditional mean zero.
Why the Martingale View Matters
The proof works because each increment is centered conditionally on the past and has a controlled conditional range. Independence is used to ensure that, after revealing the first \(i\) inputs, the unrevealed inputs still follow their original product distribution. That lets us average over the future and carry the one-coordinate sensitivity bound into the conditional-expectation martingale.
The martingale increments are not generally independent. The proof does not need them to be: it bounds each increment’s conditional moment-generating function and iterates those bounds. This is why the method covers nonlinear functions of independent inputs, rather than only sums of independent random variables.
Common Pitfall
- Using the wrong interval length. If \(D_i\) has conditional mean zero and lies in an interval of length \(c_i\), Hoeffding’s lemma uses \(c_i\), not \(2c_i\). Centering shifts the interval but does not double its length.
- Assuming the increments are independent. They need not be. The valid step is the conditional moment-generating-function bound given \(\mathcal{F}_{i-1}\), followed by iterated conditional expectation.
- Applying the result to an unverified function. The bound requires checking that replacing input \(i\) changes the function by at most \(c_i\), uniformly over the other inputs.
Check Your Understanding
Try these questions using the conditional-range argument and the theorem.
- Why does conditioning on \(\mathcal{F}_{i-1}\) leave the unrevealed inputs with their original distributions?
- If \(D_i\) lies conditionally in an interval of length \(c_i\), what is the corresponding conditional moment-generating-function bound?
- For \(Z=n^{-1}\sum_{i=1}^n X_i\), where changing one \(X_i\) changes the sum by at most \(1\), identify \(c_i\) and \(\sum_i c_i^2\).
- Why does the proof not require the Doob martingale increments to be independent?
- What happens to the tail probability bound when every \(c_i=0\)?