Markov, Chebyshev, and Jensen inequalities
Bound tail probabilities and relate E[f(X)] to f(E[X]) with the basic inequalities.
Exact distributions are often unavailable, but a mean or a variance is. The basic probability inequalities turn those one or two numbers into guarantees: how much probability can sit far from the mean, and how a convex function reshapes an average. They are also the building blocks of the law of large numbers and of generalization bounds in learning theory.
Markov's inequality
For a nonnegative random variable and any [1],
Proof. Define the indicator , which is 1 when and 0 otherwise. Because , the pointwise bound holds: when the indicator is 1, ; when it is 0, the left side is 0 and . Taking expectations and using monotonicity, . Divide by .
Markov uses only the mean, so the bound is weak, but it needs nothing else.
Chebyshev's inequality
Applying Markov to the nonnegative variable with threshold turns a variance into a two-sided tail bound. With and , for any :
Stated in standard-deviation units : . At least 75% of any distribution's mass lies within two standard deviations, 89% within three, regardless of shape. This distribution-free guarantee is what powers the law of large numbers.
Jensen's inequality
For a convex function (one curving upward, so every chord lies above the graph)[2],
The inequality reverses for concave .
Proof. Convexity gives a supporting line at the point : there is a slope with for all . Take expectations of both sides. The right side becomes , since . So .
Consequences appear everywhere: (which is just ), and for concave , , the step behind the nonnegativity of KL divergence two lessons from now.
Check it on arrays
import numpy as np
rng = np.random.default_rng(9)
N = 2_000_000
# Markov on a nonnegative variable: Exponential(rate=1), mean 1
X = rng.exponential(1.0, N)
for a in [2.0, 4.0, 6.0]:
print(f"P(X>={a}) = {np.mean(X >= a):.4f} Markov bound {1.0/a:.4f}")
# Chebyshev: any distribution, here a mixture
Y = np.where(rng.random(N) < 0.5, rng.normal(0, 1, N), rng.normal(0, 3, N))
mu, sigma = Y.mean(), Y.std()
for c in [2.0, 3.0]:
emp = np.mean(np.abs(Y - mu) >= c * sigma)
print(f"P(|Y-mu|>={c}sigma) = {emp:.4f} Chebyshev bound {1/c**2:.4f}")
# Jensen for convex phi(x)=x^2: phi(E[X]) <= E[phi(X)]
print("phi(E[X]) =", round(X.mean()**2, 4), "<= E[phi(X)] =", round((X**2).mean(), 4))Every empirical tail probability sits below its Markov or Chebyshev bound, and Jensen's inequality holds for the square.
Exercises
Exercise 1. A nonnegative random variable has mean . Use Markov's inequality to bound , then . State why the second bound is weaker as a guarantee.
Solution
Step 1. Markov's inequality gives . With :
Step 2. The bound for is larger, so it constrains the tail less. As the threshold drops toward the mean, rises toward 1 and eventually says nothing (for the bound exceeds or equals 1, which any probability already satisfies). Markov is informative only far out in the tail.
Exercise 2. Show that Chebyshev's inequality gives the "at least 75% within two standard deviations" claim, and find the smallest for which Chebyshev guarantees at least 90% of the mass lies within standard deviations of the mean.
Solution
Step 1. Chebyshev in standard-deviation units is . The complementary event, mass within , satisfies
At this is , the 75% claim.
Step 2. Require , i.e. , so and
The smallest such is : any distribution puts at least 90% of its mass within standard deviations of its mean, whatever its shape.
Exercise 3 (code). Pick a convex function and a random variable, and verify Jensen's inequality . Then check the gap vanishes for an affine (both convex and concave) function.
Solution
import numpy as np
rng = np.random.default_rng(0)
N = 2_000_000
X = rng.normal(0.0, 1.0, N)
# Convex phi(x) = e^x: Jensen says phi(E[X]) <= E[phi(X)]
lhs = np.exp(X.mean())
rhs = np.exp(X).mean()
print("phi(E[X]) =", round(lhs, 4), "<= E[phi(X)] =", round(rhs, 4))
assert lhs <= rhs
# Affine psi(x) = 3x + 1 is both convex and concave: Jensen holds with equality
psi = lambda x: 3 * x + 1
print("psi(E[X]) =", round(psi(X.mean()), 4),
" E[psi(X)] =", round(psi(X).mean(), 4))
assert np.isclose(psi(X.mean()), psi(X).mean(), atol=1e-3)For the convex exponential the strict gap appears (here against , the log-normal mean), while the affine map turns Jensen into an equality, the boundary case where the chord sits on the graph.
These bounds make the next lesson's limit theorems precise: as samples accumulate, the average concentrates on the mean.
References
- [1]Wasserman, L. (2004). All of Statistics. Springer. §4.1, the Markov and Chebyshev inequalities. doi:10.1007/978-0-387-21736-9↩
- [2]Cover, T. M., & Thomas, J. A. (2006). Elements of Information Theory (2nd ed.). Wiley. §2.6, Jensen's inequality and its consequences. doi:10.1002/047174882X↩