A11 · Lesson 30 · Tail bounds
Guarantees about rare events when you don't know the whole distribution
A buffer holds 10 packets and the average queue is 2: how often can it overflow? A test measured 20 000 bits: how sure can you be that the true error rate is within 1% of what you saw? Often you know a mean, maybe a variance or a generating function, but not the full distribution, and you need a guarantee, not a guess. Tail bounds give one. The more you know about a variable, the tighter the bound: the mean alone gives Markov's, the variance adds Chebyshev's, and the generating function (lesson 26) gives Chernoff's, which shrinks exponentially. Lesson 29's law of large numbers rests on them.
- For a standard Gaussian, the curves are the true chance of landing at least standard deviations above the mean, , and the bounds on it: Chebyshev's (for both tails together) and Chernoff's .
- On the log scale the true tail and Chernoff's bound both curve down like parabolas; Chebyshev's only falls as a straight line, which is why it's so loose far out.
Predict
A queue holds 2 packets on average. Knowing only that, what can you say about the chance it holds 10 or more?
At most 20%. A count is never negative, so if it were 10 or more more than a fifth of the time, its mean would already exceed . That's Markov's inequality, . It's weak but it needs nothing beyond the mean, and knowing more tightens it.
Name it
Markov's inequality
For a variable that's never negative,
Proof: .
Chebyshev's inequality
Apply Markov to , with :
for any distribution with a variance. It's why "within a few standard deviations" means something even for unknown distributions, and with for an average of samples it proves the law of large numbers.
Chernoff's bound
Apply Markov to for any , then pick the best :
For a Gaussian with variance and mean 0, the minimum is at and gives : exponentially small, like the true tail.
Hoeffding's bound for averages
For the average of independent variables each between 0 and 1, such as error indicators,
whatever their distribution. Setting the right side to gives a sample size that guarantees accuracy with confidence :
Worked example
A buffer's queue averages 2 packets with a standard deviation of 1.5. Bound the chance it reaches 10.
Show the solution
- Markov, from the mean alone.
- Chebyshev, using the variance. 10 is standard deviations above the mean, so
- Compare. The second bound is six times tighter because it uses more information. If the queue were known to be geometric, the exact answer would be smaller still, but neither bound needed that.
Answer Markov bounds the chance by 0.2, and Chebyshev by 0.035.
Worked example
Compare the bounds with the truth for a Gaussian at 3 and 4 standard deviations from the mean.
Show the solution
- At 3σ, Chebyshev. It bounds both tails together by
- At 3σ, the truth. forty times smaller.
- At 4σ, Chernoff. It bounds one tail by against : ten times too big, but with the right exponential shape.
- Which to use. For bit-error estimates that need the shape, Chernoff's bound is the useful one; Chebyshev's guarantee is for when you know nothing but the variance.
Answer at 3σ Chebyshev gives 0.111 against a true 0.0027; at 4σ Chernoff gives against a true .
Worked example
A link's bit error rate is estimated by counting errors in bits. How many bits guarantee the estimate is within 0.01 of the truth with 99% confidence, whatever the true rate?
Show the solution
- Hoeffding's bound. With and :
- What it guarantees. That's a distribution-free guarantee; for a rate as small as , where the variance is tiny, a sharper bound needs fewer bits, but the absolute accuracy 0.01 would then be useless anyway.
- Small rates. For small rates you specify relative accuracy, and need roughly bits or more.
Answer 26 492 bits guarantee it, whatever the true rate.
Check
A nonnegative quantity has mean 2. What's the most the chance it reaches 10 can be, knowing nothing else?
Check
Knowing only the mean and standard deviation, what is the largest possible chance of landing 2 or more standard deviations from the mean, in either direction?
Check
What does Chernoff's bound give for the chance a Gaussian lands at least 3 standard deviations above its mean?
Check
You estimate a probability by the fraction of successes in independent trials.
(a)
By Hoeffding's bound, how many trials guarantee an error under 0.01 with probability at least ?
(b)
How many for half that error?
Check
For the average of n = 100 Bernoulli trials with = 0.1, compute the exact chance for e = 0.05 from the binomial distribution (sum the probabilities of the counts with , using math.comb or logs to avoid overflow). Set exact, cheb to Chebyshev's bound (capped at 1), and hoeff to Hoeffding's (capped at 1).
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Derive Chernoff's bound for a Gaussian with mean 0 and standard deviation (written sg), whose .
Step 1
What is ?
Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.
Step 2
Which minimizes it?
Step 3
What is the bound there?
Check
You know a random variable's mean and variance but nothing about the shape of its distribution. Which tail bound can you use?
Explain why
Why is Chebyshev's bound so much looser than the truth for a Gaussian, and why can't it be made tighter without more information?
Chebyshev's bound must hold for every distribution with the given variance, including the worst one: a distribution that puts a little probability exactly at and the rest at the mean, which reaches exactly. A Gaussian spreads its probability smoothly and has tails that fall like , far below , but nothing in the mean and variance alone rules out the worst case. Only extra information, like a generating function or knowing the variable is a sum of many small independent pieces, lets a bound like Chernoff's or Hoeffding's capture the exponential fall.
Practice
Keep practicing
7 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.