law #10
In this lesson

Wide tables, equations, and code scroll sideways. Swipe, or Tab to focus them and use the left and right arrow keys.

Hoeffding’s inequality

You will learn: Bound independent bounded sums while keeping assumptions and exact probabilities separate.

Start with: Bernoulli distribution · Expectation and variance

If X1,…,XnX_1,\dots,X_n are iid and bounded to [a,b][a, b], the sample mean concentrates around its expectation exponentially fast:

P ⁣(∣Xˉn−μ∣≥t)≤2exp⁡ ⁣(−2nt2(b−a)2)P\!\left(\left|\bar X_n-\mu\right|\ge t\right) \le 2\exp\!\left(-\frac{2nt^{2}}{(b-a)^{2}}\right)
tail probability (log10) by n (sample size)1e-41e-31e-21e-1150100150200n (sample size)tail probability (log10)
empirical (Uniform[0,1], 4,000 reps per dot) Hoeffding (solid) 2e−2nt2/(b−a)22e^{-2nt^{2}/(b-a)^{2}} Chebyshev (dashed) σ2/(nt2)\sigma^{2}/(nt^{2})

At n = 30: empirical = 0.0052; Hoeffding = 0.5185; Chebyshev = 0.1235.

Plan a sufficient sample size

For independent observations in [0,1], Hoeffding guarantees P(|average−mean|≥0.15)≤0.05 when n≥82. This is a sufficient bound, not a minimum for a particular distribution.

P ⁣(∣Xˉn−μ∣≥t)≤2exp⁡ ⁣(−2nt2(b−a)2)P\!\left(\left|\bar X_n-\mu\right|\ge t\right)\le 2\exp\!\left(-\frac{2nt^{2}}{(b-a)^{2}}\right). Dots are empirical tail probabilities at fixed n. Hoeffding has an exponential rate in n. Both bounds are capped at 1; values below 0.0001, including zero observed frequencies, sit on the display floor. Chebyshev uses the selected source's variance: 0.08333. Blue, when present, is the exact binomial tail.

What to notice

  • Different rates, different constants. Chebyshev falls like 1/n and Hoeffding exponentially in n for fixed positive t. Which is smaller at a particular n depends on the threshold and variance. A bound above one is valid but uninformative; the plot caps it at one.
  • A bound is not an approximation. For Uniform(0,1), the observed tail can be much smaller than either bound. A loose upper bound has not failed. Zero observed exceedances do not prove the true tail probability is zero.
  • Assumptions matter. Hoeffding uses independent bounded variables; identical distributions are unnecessary in its more general version. Bernstein-type bounds use variance together with a bound on the increments. Independence cannot be silently dropped.

Invert the bound

For observations in [0,1], choose n so that 2 exp(−2nt²) ≤ δ. Rearranging gives n ≥ log(2/δ)/(2t²). To guarantee an error of at most 0.1 with probability at least 0.95, this sufficient condition asks for 185 independent observations. It is conservative: a specific distribution may need fewer.

The chart floors values at 0.0001 to display a logarithmic axis. A point on that floor means “at or below the display limit”, not an exact probability of 0.0001. Each plotted empirical point uses 4,000 repetitions; the current-n readout uses the repetition control.

Why it matters

  • PAC learning. Sample complexity for learning a hypothesis class comes from Hoeffding applied to the 0/1 losses of a finite hypothesis class — each loss is bounded, so Hoeffding gives you exponential tail probabilities.
  • Multi-armed bandits. UCB confidence radii of the form 2ln⁡t/na\sqrt{2\ln t/n_a} are Hoeffding deviations inverted.
  • Monte Carlo. Hoeffding is why simulation error for bounded estimators shrinks like 1/n1/\sqrt{n} with guaranteed probability, not just on average.

Proof idea (Chernoff-style)

Apply Markov’s inequality to eλ(Sn−ESn)e^{\lambda(S_n-E S_n)}, then bound the moment generating function using Hoeffding’s lemma for bounded random variables, and finally optimize over λ\lambda. The result is the concentration inequality above:

P ⁣(∣Sn−E[Sn]∣≥nt)≤2exp⁡ ⁣(−2nt2(b−a)2)P\!\left(\left|S_n-E[S_n]\right|\ge n t\right) \le 2\exp\!\left(-\frac{2nt^{2}}{(b-a)^{2}}\right)

This template — Markov on the MGF, optimize the parameter — produces Bernstein, Bennett, and Azuma-type inequalities as variants.

Check a bound against an exact discrete tail

Choose independent fair coin indicators. At n=10 and t=0.2, a deviation of at least 0.2 means at most three or at least seven successes. Summing the binomial probabilities gives 0.34375. Hoeffding gives 2 exp(−0.8)≈0.898658; Chebyshev gives 0.25/(10×0.2²)=0.625. Both are valid upper bounds, and Chebyshev is tighter in this case despite its slower asymptotic rate.

Set t=0.1 and δ=0.05 in the sample-size control. The bound asks for 185 observations. Halving t to 0.05 multiplies the unrounded requirement by four, giving 738 after rounding up. The parameter δ is the maximum allowed tail probability, not the error in the sample mean itself.

Make a prediction

You record the same fair coin result 185 times. Does the displayed independent-sample guarantee apply?

Explore the answer

No. The average is still either zero or one, always half a unit from its expectation. Recording duplicates does not create independent observations. Boundedness alone does not justify multiplying moment generating functions as in the proof.

Reference

Wisconsin: Chernoff and Hoeffding inequalities states the independent bounded-variable conditions and the exponential bound. The exact coin example uses a direct finite binomial sum.

Reset all settings