Chebyshev's Inequality

lean4-proofprobabilityvisualization
P(Xμkσ)1k2P(|X - \mu| \geq k\sigma) \leq \frac{1}{k^2}

Statement

For a square-integrable real random variable XX with mean μ=E[X]\mu = E[X], variance σ2=Var(X)\sigma^2 = \text{Var}(X), and any c>0c > 0:

P(Xμc)σ2c2P(|X - \mu| \geq c) \leq \frac{\sigma^2}{c^2}

Writing c=kσc = k\sigma gives the memorable form P(Xμkσ)1/k2P(|X - \mu| \geq k\sigma) \leq 1/k^2.

Visualization

Consider a discrete distribution approximating a bell shape:

xx3-32-21-100112233
p(x)p(x)1/161/162/162/164/164/162/162/164/164/162/162/161/161/16

Mean μ=0\mu = 0 (by symmetry). Variance σ22.25\sigma^2 \approx 2.25, so σ1.5\sigma \approx 1.5.

kkThreshold kσk\sigmaExact P(Xkσ)P(\|X\| \geq k\sigma)Chebyshev 1/k21/k^2
11.53/160.193/16 \approx 0.191.01.0 (trivial)
1.52.253/160.193/16 \approx 0.190.440.44
23.02/160.132/16 \approx 0.130.250.25
34.5000.110.11

The bound is distribution-free — it cannot be improved for all distributions simultaneously (the bound is tight for a two-point mass).

Proof Sketch

Chebyshev is Markov applied to the non-negative random variable Y=(Xμ)2Y = (X - \mu)^2:

P(Xμc)=P(Yc2)E[Y]c2=σ2c2P(|X - \mu| \geq c) = P(Y \geq c^2) \leq \frac{E[Y]}{c^2} = \frac{\sigma^2}{c^2}

Connections

Chebyshev's inequality is Markov's InequalityMarkov's InequalityP(Xa)E[X]aP(X \geq a) \leq \frac{E[X]}{a}A non-negative random variable rarely exceeds a multiple of its expectationRead more → applied to the square deviation. Its power comes from using more information (the variance). The weak law of large numbers follows directly: sample averages concentrate around the mean with rate σ2/n\sigma^2/n. The same spirit of concentration appears in the study of Iterated Function SystemsIterated Function SystemsA=i=1Nfi(A)A = \bigcup_{i=1}^{N} f_i(A)Constructing fractals via contractive affine transformationsRead more →, where contraction ratios control convergence rates.

Lean4 Proof

The proof below uses ProbabilityTheory.meas_ge_le_variance_div_sq from Mathlib.Probability.Moments.Variance (Mathlib v4.28.0).

meas_ge_le_variance_div_sq is itself proved by reducing to meas_ge_le_evariance_div_sq, which in turn reduces to meas_ge_le_mul_pow_eLpNorm_enorm — precisely the L2L^2 Markov inequality applied to XE[X]|X - E[X]|.

Lean4 Proof

import Mathlib.Probability.Moments.Variance

namespace MoonMath

open MeasureTheory ProbabilityTheory

/-- **Chebyshev's inequality** (real-valued form).
    For a square-integrable random variable `X` and threshold `c > 0`,
    `μ {ω | c ≤ |X ω - μ[X]|} ≤ ENNReal.ofReal (Var[X] / c²)`. -/
theorem chebyshev_inequality
    {Ω : Type*} {m : MeasurableSpace Ω} (μ : Measure Ω)
    [IsFiniteMeasure μ] {X : Ω  }
    (hX : MemLp X 2 μ) {c : } (hc : 0 < c) :
    μ {ω | c  |X ω - μ[X]|}  ENNReal.ofReal (variance X μ / c ^ 2) :=
  meas_ge_le_variance_div_sq hX hc

end MoonMath