Hoeffding's Inequality
A hard, distribution-free guarantee on how far the average of bounded random variables can stray from its true mean — the tool that turns "we backtested on 500 days" into an actual confidence number.
Prerequisites: Markov and Chebyshev Inequalities, The Law of Large Numbers
You backtest a signal on 500 trading days and get a 55% hit rate. Is that real edge, or could a coin-flip strategy print 55% out of 500 flips just by luck? Chebyshev's inequality gives a bound, but it's loose — it doesn't use the fact that a hit/miss outcome is bounded between 0 and 1. Hoeffding's inequality uses exactly that boundedness, and the bound it produces shrinks exponentially fast as you collect more data, not just polynomially.
The analogy: a jar of marked coins
Picture a jar with an unknown fraction of red marbles. You draw marbles with replacement and compute the fraction that are red. Common sense says this sample fraction should land close to once is large — that's the Law of Large Numbers. Hoeffding's inequality is the sharpened version of that common sense: it tells you, for any fixed sample size , exactly how small the probability is that your sample fraction lands more than some given distance from . And critically, that probability shrinks faster and faster — like a bell curve's tail, not like a slowly decaying power — because each marble draw contributes only a small, bounded amount of randomness.
Writing it down
Let be independent random variables, each confined to an interval (bounded — this is the whole trick). Let be their average and its true mean. Hoeffding's inequality says: for any ,
In words: the chance the sample average is off from the true average by more than decays exponentially in and in , and it decays faster the tighter the bounds are. Wider possible values per draw (a bigger ) weaken the bound; more draws or a bigger tolerance strengthen it, and strengthen it fast.
For the common special case of i.i.d. variables in (like win/loss indicators), this simplifies to
Set the decay rate high and watch how quickly the curve collapses toward zero — that collapse rate is exactly what buys you as grows: doubling doesn't just halve the bound, it squares how small it gets.
Worked example 1: is 55% out of 500 real?
A signal fires 500 times, hits 275 (55%). Suppose the truth is actually (no edge). What's the chance of seeing a sample average at least 5 percentage points away from 0.5 by luck alone? Here , , each observation in :
So there's up to a 16.4% chance a fair coin produces a result this extreme purely by chance over 500 trials — not negligible. This single backtest is not strong evidence of edge. Compare with 5,000 trials at the same 5% gap: — essentially impossible by luck. The exponential in is doing real work: 10x the sample size didn't just tighten the bound tenfold, it crushed it by ten orders of magnitude.
Watch the running average settle inside its shrinking envelope as more points are added — Hoeffding's bound is the hard, non-asymptotic version of exactly that shrinking band, giving you a concrete probability at every fixed rather than just a "it converges eventually" promise.
Worked example 2: how many trades to trust a 2% edge?
You want to be 99% confident your measured average return is within (2 percentage points) of the true mean, and each trade's return, after clipping, sits in (so ). Solve for :
You need roughly 26,500 trades before Hoeffding will certify that kind of precision — a sobering number for anyone eyeballing a 200-trade backtest and calling an edge "confirmed."
What this means in practice
- Backtest sample size. Before trusting a hit rate or average return, plug your and desired precision into Hoeffding's bound. It tells you honestly whether your sample size can even support the claim you want to make.
- A/B testing execution algorithms. Comparing two execution strategies' fill quality (a bounded quantity, like slippage in ticks) is a textbook Hoeffding setting — no need to assume normality.
- Model-free. Unlike a t-test, Hoeffding needs no assumption about the shape of the distribution — only that the values are bounded. That's valuable when returns are skewed or fat-tailed.
For any average of independent, bounded random variables, the probability of being far from the true mean shrinks exponentially in both the sample size and the squared error tolerance — Hoeffding's bound turns "how much data do I need" into an actual number.
Hoeffding needs the variables to be bounded and independent. Applying it directly to unbounded returns (a strategy with a rare huge win or loss) is invalid unless you first clip or transform the data — and applying it to serially correlated trades (the same regime driving many consecutive signals) silently understates the true uncertainty, because the bound assumes each observation adds fresh, independent information.
Related concepts
Practice in interviews
Further reading
- Boucheron, Lugosi, Massart, Concentration Inequalities (ch. 2)
- Wasserman, All of Statistics (ch. 4)