Probability Inequalities
Markov, Chebyshev, Jensen, Cauchy–Schwarz and Hoeffding bounds, and where each is used in ML theory.
Assumes you know
Probability Inequalities
Intuition first
Often you cannot compute a probability exactly — the distribution is unknown, or the integral is intractable — but you can bound it. Inequalities give guarantees using only partial information such as the mean, or the mean and variance.
The trade-off is universality against tightness. Markov's inequality needs only the mean and holds for every non-negative variable, so it must accommodate the worst case and is usually loose. Chebyshev adds the variance and does better. Hoeffding assumes bounded variables and gives exponentially tight bounds — which is why it, not the others, underpins generalisation theory in machine learning.
These are the tools behind every statement of the form "with probability at least , the error is at most ".
Markov's inequality
For a non-negative random variable and any :
Proof by indicatorAdvanced
Define the indicator . The key observation is the pointwise inequality
Check both cases. If the right side is and indeed . If the right side is 0 and by assumption — which is exactly where non-negativity is needed.
Take expectations of both sides, using monotonicity of expectation:
Divide by . Note how little was assumed: only and a finite mean. That generality is why the bound is weak.
Chebyshev's inequality
For any random variable with finite mean and variance , and any :
Chebyshev from MarkovAdvanced
Apply Markov to the non-negative variable with threshold :
The event is identical to , since squaring is monotone on non-negative values. Done.
The gain over Markov comes from squaring: it converts a one-sided statement about a non-negative variable into a two-sided statement about deviations, and the decay is faster than Markov's .
| Chebyshev bound | Actual, if normal | |
|---|---|---|
| 1 | (vacuous) | 31.7% |
| 2 | 4.6% | |
| 3 | 0.27% | |
| 4 | 0.006% |
Solved problem 1 · Comparing the three bounds
Exam scores have mean 70 and standard deviation 10. Bound using Markov, then Chebyshev, then compare with the normal answer.
Step 1 — Markov, using only the mean
Scores are non-negative, so Markov applies with :
Step 2 — Chebyshev, using mean and variance
is standard deviations above the mean where
Chebyshev bounds the two-sided event:
We want only the upper tail. Without a symmetry assumption we cannot simply halve, so the guaranteed bound is
Step 3 — normal assumption, for comparison
If :
Step 4 — compare
Markov is 500 times too large, Chebyshev 82 times too large. Each additional piece of information — first the variance, then the full shape — tightens the bound by roughly two orders of magnitude.
Answer
Markov ; Chebyshev ; normal gives . The bounds are correct but weak, which is the price of assuming almost nothing.
Jensen's inequality
For a convex function :
with the inequality reversed for concave , and equality only when is constant or is linear.
Proof via the supporting lineAdvanced
Convexity means the graph of lies above every tangent line. At the point there is a supporting line with some slope :
Take expectations of both sides:
The linear term vanishes precisely because we expanded about the mean.
Two instances used repeatedly in this curriculum: gives , which is variance non-negativity; and gives , which is the step that produces the ELBO in variational inference.
Hoeffding's inequality
For independent with , and their mean:
For the common case this simplifies to
Solved problem 2 · Sample size from Hoeffding
You estimate a classifier's accuracy on held-out examples. How large must be so that the estimate is within of the true accuracy with probability at least ?
Step 1 — set up
Each example contributes a correctness indicator, so and Hoeffding applies in its simplified form. We need
Step 2 — solve for n
Step 3 — substitute
Step 4 — compare with Chebyshev
Chebyshev needs with for a variable:
Setting this to :
Nearly ten times more data for the same guarantee.
Step 5 — and the normal approximation
Assuming normality, with for 99% and :
Answer
Hoeffding requires ; Chebyshev ; the normal approximation .
Hoeffding is only 60% more conservative than the normal approximation while requiring no distributional assumption at all — which is why it is the tool of choice for guarantees.
Summary
| Inequality | Needs | Bound | Tightness |
|---|---|---|---|
| Markov | , mean | Very loose | |
| Chebyshev | Mean, variance | Loose | |
| Jensen | Convexity | Directional | Exact tool, not a tail bound |
| Hoeffding | Independence, bounded | Tight | |
| Chernoff | Independence, MGF exists | Exponential | Tightest |
import numpy as np
from scipy import stats
mu, sigma = 70, 10
print(f"Markov P(X>=100) <= {mu/100:.5f}")
print(f"Chebyshev P(X>=100) <= {1/3**2:.5f}")
print(f"Normal P(X>=100) = {stats.norm.sf(100, mu, sigma):.5f}")
# Sample size for |X̄ - μ| <= 0.02 with 99% confidence.
t, delta = 0.02, 0.01
n_hoeff = np.ceil(np.log(2/delta) / (2 * t**2))
n_cheb = np.ceil(0.25 / (delta * t**2))
n_norm = np.ceil((stats.norm.ppf(1 - delta/2) * 0.5 / t) ** 2)
print(f"\nn needed — Hoeffding {n_hoeff:.0f} Chebyshev {n_cheb:.0f} normal {n_norm:.0f}")
# Check Hoeffding empirically at n = 6623.
rng = np.random.default_rng(0)
n = int(n_hoeff)
means = rng.binomial(1, 0.85, size=(20_000, n)).mean(axis=1)
violations = np.mean(np.abs(means - 0.85) >= t)
print(f"observed violation rate {violations:.5f} <= bound {2*np.exp(-2*n*t**2):.5f}")Exercise 1
A non-negative variable has mean 5. Bound . Then, told additionally that , improve it.
Show solutionHide solution
Markov:
Chebyshev. The threshold is standard deviations above the mean with
Adding the variance tightened the bound from to — a fourteen-fold improvement, for one extra number.
Exercise 2
Use Jensen's inequality to show that the arithmetic mean is at least the geometric mean for positive numbers.
Show solutionHide solution
Let take the values each with probability . Apply Jensen to the concave function , which reverses the inequality:
The left side is
the log of the geometric mean. The right side is of the arithmetic mean. Since is strictly increasing, the inequality passes through:
which is AM–GM. Equality holds exactly when is constant, that is when all are equal — matching the equality condition in Jensen.
This is why the geometric mean is the right average for multiplicative quantities such as growth rates: the arithmetic mean of returns systematically overstates the compounded result.
Next: Laws of Large Numbers, which Chebyshev proves in three lines.