advanced30 min studyLesson 695 in Mathematics

Bounded differences and McDiarmid's inequality

Control a nonlinear function of independent inputs through deterministic coordinate sensitivities and recognize when dependence defeats the argument.

On this page

What you’ll understand

  • State bounded differences on the product input space with deterministic constants.
  • Explain how independence controls Doob martingale increments.
  • Apply McDiarmid to an occupancy statistic and diagnose a dependent counterexample.

A statistic need not be a sum to concentrate. If changing any single independent input can only change its value a little, revealing the inputs one at a time creates a controlled martingale. McDiarmid's inequality turns those coordinate sensitivities into an exponential tail around the statistic's own expectation. The product structure is essential: a small sensitivity to each formal coordinate does not imply concentration when one hidden variable determines every input.

Sensitivity is a uniform replacement bound

Let independent random elements X₁ through X_n take values in specified measurable spaces, and let f be a measurable integrable real function on their product. Suppose replacing coordinate i while holding all others fixed changes f by at most a deterministic c_i. The condition is uniform over the product domain, or over fixed full-measure coordinate supports where the argument remains valid. It is not merely a bound on derivatives observed at the sampled inputs. Discrete data, strings, or category labels require no differential structure.

McDiarmid bounds the upper deviation f(X)−Ef(X) by exp(−2t²/Σc_i²), with the same lower-tail bound and a factor two for an absolute deviation. The zero-total-sensitivity case is deterministic on the relevant product support. The center is the expectation of f, which may differ from the population quantity one wants to estimate. For a biased estimator this inequality controls fluctuation around its own mean, not its bias; a separate calculation is needed to connect that mean with an external target.

sup⁡x,xi′∣f(x)−f(x1,…,xi′,…,xn)∣≤ci⟹P{f(X)−Ef(X)≥t}≤exp⁡ ⁣(−2t2∑ici2)\sup_{x,x_i'}|f(x)-f(x_1,\ldots,x_i',\ldots,x_n)|\le c_i\quad\Longrightarrow\quad\mathbb P\{f(X)-\mathbb Ef(X)\ge t\}\le\exp\!\left(-\frac{2t^2}{\sum_i c_i^2}\right)
The supremum holds with all other coordinates fixed. Inputs are independent, f is measurable and integrable, and Σcᵢ²>0.↔ Scroll wide equations horizontally.

The martingale proof uses independence conditionally

Reveal coordinates in order and define M_i as the conditional expectation of f given the first i inputs. The difference M_i−M_(i−1) has conditional mean zero. For a fixed past, the conditional expectation over the unrevealed independent inputs is a function of the new coordinate whose range has width at most c_i. Subtracting its conditional mean preserves that width. Conditional Hoeffding's lemma then bounds the mgf of each difference, and successive conditioning gives the exponential bound for the final sum.

This is stronger than merely proving the absolute difference is at most c_i and inserting it into a symmetric range of width 2c_i, which would lose a factor four in the exponent. The proof controls the actual conditional range width. It also explains why independence cannot be discarded: with dependent inputs, revealing one coordinate may change the conditional law of all unrevealed coordinates. The conditional expectation can then move much more than the effect of one formal replacement in f's argument.

Mi=E[f(X)∣X1,…,Xi],log⁡E[eλ(Mi−Mi−1)∣X1,…,Xi−1]≤λ2ci28M_i=\mathbb E[f(X)\mid X_1,\ldots,X_i],\qquad\log\mathbb E[e^{\lambda(M_i-M_{i-1})}\mid X_1,\ldots,X_{i-1}]\le\frac{\lambda^2c_i^2}{8}
Independence transfers the coordinate replacement bound into a conditional range-width bound for the Doob difference.↔ Scroll wide equations horizontally.

Nonlinear examples and dependent failures

Consider the number of distinct categories in an independent sample from a countable alphabet. Replacing one observation can remove at most one old category and introduce at most one new one, but the net number changes by at most one. Dividing by n gives sensitivity 1/n. This statistic is nonlinear, and its expected value depends on the category distribution; nevertheless its fluctuation satisfies the same scale as a bounded sample average. No identical-distribution assumption is needed for the sensitivity argument itself.

For a counterexample, let every X_i equal the same Bernoulli variable B and take f to be their average. As a formal product-space function it has sensitivity 1/n, yet f(X)=B has no improvement with n. Independent-copy concentration would falsely predict exponentially decreasing error. Conditioning can recover a valid theorem only if it establishes the necessary conditional increment ranges or some other appropriate dependence structure. The phrase conditionally independent must specify the conditioning information, and conditional fluctuation around a random conditional mean does not automatically control fluctuation around the unconditional mean.

Distinct categories in fifty observations

Let X₁,…,X₅₀ be independent observations in a countable alphabet. Let f be the number of distinct observed categories divided by fifty. Bound P(f−Ef≥0.2).

  1. Changing one observation changes the distinct count by at most one: if a unique old category disappears and a new one appears, those changes cancel in the count rather than adding to two. Hence every sensitivity is c_i=1/50.

  2. The squared-sensitivity total is 50·(1/50)²=1/50. At t=0.2, the McDiarmid exponent is −2·0.2²/(1/50)=−4.

  3. Therefore the upper deviation probability is at most exp(−4)≈0.0183156. A two-sided deviation has bound 2exp(−4). Neither statement computes Ef or identifies it with a fixed fraction of the alphabet.

The result

The one-sided fluctuation bound is exp(−4), independent of the alphabet size and the individual category laws, provided the fifty observations are independent.

Explore the model

Interactive lab

Interactive lab · sampling

An independent special case and a dependent warning

Pause and Reset, then set p = 0.3 and n = 100. The sample mean is a function with sensitivities 1/100; predict the event K/n≥0.5 is bounded by exp(−8). Inspect the exact upper-tail bars. Reset and set both p = 0.3 and n = 1: the mean now is a single Bernoulli variable. A hundred identical copies of that one variable would still have this two-point mean law, not the n=100 law. The instrument always assumes independent trials and does not simulate the dependent-copy example.

An independent special case and a dependent warningExact binomial masses for the mean of n independent Bernoulli trials, compared with normal mass between adjacent half-count boundaries; normal tails outside the finite support remain outside the bars. Playback highlights outcomes, not random samples. The Berry–Esseen bound applies to standardized CDFs, not individual bars or continuity-corrected errors. At p = 0 or 1, normal comparison and that bound are disabled. Normal-CDF evaluation uses a numerical approximation with absolute error below 7.5×10⁻⁸ (at most 1.5×10⁻⁷ per interval, before rounding). Current readings: Mean sample proportion: 0.5; Sample-mean variance: 0.0125; Uniform CDF error bound: ≤ 0.1062. All parameters are adjustable with the labeled controls below.Exact distribution of the mean of 20 independent Bernoulli variables with success probability 0.5; playback highlights outcome 0.00.250.50.75100.0580.1150.1730.23Sample mean · k / nProbability massNormal bin masses are an approximationk = 0 · exact probability = 9.54e-7
Exact binomial massNormal interval massHighlighted outcome / mean
Mean sample proportion
0.5
Sample-mean variance
0.0125
Uniform CDF error bound
≤ 0.1062
t = 0 s

Exact binomial masses for the mean of n independent Bernoulli trials, compared with normal mass between adjacent half-count boundaries; normal tails outside the finite support remain outside the bars. Playback highlights outcomes, not random samples. The Berry–Esseen bound applies to standardized CDFs, not individual bars or continuity-corrected errors. At p = 0 or 1, normal comparison and that bound are disabled. Normal-CDF evaluation uses a numerical approximation with absolute error below 7.5×10⁻⁸ (at most 1.5×10⁻⁷ per interval, before rounding). Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forSmall coordinate sensitivity yields the stated concentration only with the required independence or a separately justified conditional argument.

Check your understanding

All n inputs equal one Bernoulli variable B, and f is their average. Why can independent-input McDiarmid not be applied using cᵢ=1/n?

Try it yourself

Let independent X₁,…,X₈ lie in [0,1]. Give the upper-tail bound at t=1/4 for their weighted average with weights 1/6 on the first four and 1/12 on the last four. Compare with equal weights.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

The weights sum to one and are the coordinate sensitivities. Add their squares, not their absolute values, in the exponent.

Compare with the solution

The squared-sensitivity total is 4/36+4/144=5/364/36+4/144=5/36. McDiarmid gives exp⁡[−2(1/4)2/(5/36)]=e−0.9≈0.406570\exp[-2(1/4)^2/(5/36)]=e^{-0.9}\approx0.406570. Equal weights 1/8 give total 1/8 and bound e−1≈0.367879e^{-1}\approx0.367879. The unequal weights concentrate less tightly by this calculation because they have a larger squared sum. Both results concern deviation from the corresponding weighted average of the expectations. They do not require identical distributions, and they cannot be transferred to dependent observations merely by keeping the same weights.

Take it with you

  • McDiarmid uses uniform deterministic coordinate replacement sensitivities.
  • Independence makes those sensitivities control the Doob martingale's conditional range widths.
  • Concentration around a statistic's expectation does not remove bias or justify dependent-copy sampling.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.