Variance of a Random Variable
Variance measures expected squared distance from the mean, while Chebyshev's Inequality uses that variance to bound the probability of a large deviation.
Try it: Expectation and Variance of a Random Variable
A discrete random variable X as values with probabilities: the expectation E[X] = Σ x·p(x) is a probability-weighted average, and the variance is the expected squared distance from that mean, computed two ways.
How it works
- Each outcome has a value x and a bar height; probabilities are the heights renormalised, p(x) = height / total, so they always sum to exactly 1.
- E[X] = μ is built term by term: every outcome adds x·p(x) to the running sum.
- Var[X] = E[(X − μ)²]: centre each value on μ, square the deviation, weight it by p(x) and add.
- The same variance again as E[X²] − μ², and the standard deviation √Var[X].
- All sums are exact fractions (shown alongside decimals).
Default run (22 steps): X has 6 outcomes with bar heights 10, 10, 10, 10, 10, 10 (total W = 60). … E[X] = μ = 7/2 = 3.5; Var[X] = 35/12 ≈ 2.9167; standard deviation = √Var ≈ 1.7078.
Simplified: Up to 8 outcomes with integer values from −20 to 20 and integer bar heights 0–100. If every bar is 0 the first outcome gets height 1 (a distribution needs total probability 1).
Loading the simulation…
Try it: Concentration: Hoeffding, Chebyshev and Markov
The sample mean of m i.i.d. bounded samples concentrates around the true mean μ: repeated seeded experiments estimate P(|sample mean − μ| ≥ ε) and compare it with Hoeffding's bound 2·exp(−2mε²), Chebyshev's bound Var/ε² and Markov's bound for the one-sided event.
How it works
- Draw θ1, …, θm i.i.d. Bernoulli(p) (bounded in [a, b] = [0, 1], common mean μ = p) and track the running sample mean.
- The deviation event is |sample mean − μ| ≥ ε for a chosen positive tolerance ε.
- Hoeffding: P(|mean − μ| ≥ ε) ≤ 2·exp(−2mε²/(b − a)²); Chebyshev with Var[mean] = p(1 − p)/m: ≤ p(1 − p)/(mε²); Markov for the non-negative mean: P(mean ≥ μ + ε) ≤ μ/(μ + ε).
- Repeat the whole experiment many times (seeded) and count how often each event happens.
- Compare the observed frequencies with the bounds: they are upper bounds, not the exact probability.
Default run (32 steps): θ1, …, θm are i.i.d. Bernoulli(0.5) samples, each in [a, b] = [0, 1], with true mean μ = 0.5. m = 100, ε = 0.1, seed 7. … 200 experiments: |mean − μ| ≥ 0.1 happened 3 times (frequency 0.015) — Hoeffding allows at most 0.2707, Chebyshev 0.25. One-sided mean ≥ μ + ε: 1 times (0.005) vs Markov 0.8333.
Simplified: Samples are Bernoulli(p) (0 or 1), so [a, b] = [0, 1]; the randomness comes from a seeded pseudo-random generator (mulberry32). Observed frequencies are estimates from a finite number of experiments.
Loading the simulation…
Why Spread Matters
A random variable does not always equal its mean. To describe how widely its values can spread, we use variance. Chebyshev's Inequality then connects that spread to a probability statement: it gives an upper bound on the chance that the random variable is at least a chosen distance away from its mean.
Variance measures expected squared distance from the mean, while Chebyshev's Inequality uses that variance to bound the probability of a large deviation.
From Values to Variance
The construction of variance follows three steps. First, compare the random variable Z with its mean E[Z]. This produces the deviation Z − E[Z]. Next, square the deviation. Squaring makes the deviation nonnegative and gives more weight to larger distances. Finally, take the expected value of the squared deviation. The result is Var[Z], the variance of Z.
- 1Find the mean E[Z].
- 2Center the random variable by forming Z − E[Z].
- 3Square the centered deviation to obtain (Z − E[Z])².
- 4Take the expected value of the squared deviation.
Chebyshev's Bound
Chebyshev's Inequality states that the probability that Z differs from its mean by at least a chosen distance a is at most the variance divided by the squared distance: P(|Z − E[Z]| ≥ a) ≤ Var[Z] / a².
Read the inequality from left to right. The left side describes the deviation event: Z is at least a distance a from its mean. The right side is the bound that can be calculated from two inputs: the variance in the numerator and the squared deviation threshold in the denominator.
Applying the Calculation
A numerical Chebyshev bound
Suppose a random variable has variance 4. Find an upper bound for the probability that it differs from its mean by at least 2.
- 1Identify the inputs
The variance is 4 and the deviation threshold is a = 2.
- 2Substitute into Chebyshev's Inequality
Use P(|Z − E[Z]| ≥ a) ≤ Var[Z] / a², giving P(|Z − E[Z]| ≥ 2) ≤ 4 / 2².
- 3Evaluate the denominator
The squared threshold is 2² = 4.
- 4Compute the bound
The right-hand side is 4 / 4 = 1.
The probability that Z is at least 2 units from its mean is bounded above by 1.
Changing the Bound
| Quantity that changes | Position in the bound | Effect described by the formula |
|---|---|---|
| Variance Var[Z] | Numerator | A larger variance produces a larger value of Var[Z] / a². |
| Deviation threshold a | Denominator after squaring | A larger threshold produces a larger a², making Var[Z] / a² smaller when the variance is fixed. |
Chebyshev's bound is Var[Z] divided by the squared deviation threshold.
The formula makes the roles of spread and distance visible. Variance appears in the numerator, so increasing variance increases the calculated bound when the threshold stays fixed. The threshold is squared in the denominator, so increasing the allowed distance from the mean increases the denominator and decreases the bound when variance stays fixed.
A random variable has variance 9. Use Chebyshev's Inequality to find an upper bound for the probability that it differs from its mean by at least 3.
Hints
- Use P(|Z − E[Z]| ≥ a) ≤ Var[Z] / a².
- Substitute Var[Z] = 9 and a = 3.
Averages of i.i.d. Variables
The source also considers the average of m independent and identically distributed random variables. In this setting, the variance of the average decreases as m increases. When the common variance is written as σ², the variance of the average is σ² divided by m. Thus, increasing the number of variables makes the variance term used in a Chebyshev bound smaller.
Comparing averages
Compare the variance of an average formed from 2 i.i.d. variables with the variance of an average formed from 8 i.i.d. variables, assuming the common variance is σ².
- 1Use the average-variance formula
For m i.i.d. variables, the variance of the average is σ² / m.
- 2Substitute m = 2
The first average has variance σ² / 2.
- 3Substitute m = 8
The second average has variance σ² / 8.
- 4Compare the results
The denominator is larger for 8 variables, so σ² / 8 is smaller than σ² / 2.
The average based on 8 i.i.d. variables has the smaller variance.
Common Calculation Mistakes
Common mistake Using the deviation threshold without squaring it.
What it looks likeWriting Var[Z] / a instead of Var[Z] / a².Why it failsChebyshev's bound uses the squared deviation threshold in the denominator.
Do this insteadSquare a before dividing the variance by it.
Common mistake Treating variance as an ordinary distance from the mean.
What it looks likeDescribing Var[Z] as Z − E[Z].Why it failsVariance is the expected value of the squared deviation, not the unsquared deviation itself.
Do this insteadUse Var[Z] = E[(Z − E[Z])²].Common mistake Reading the Chebyshev result as the exact deviation probability.
What it looks likeSaying P(|Z − E[Z]| ≥ a) equals Var[Z] / a².Why it failsThe inequality provides an upper bound.
Do this insteadUse the language at most or no greater than for the right-hand side.
Common mistake Forgetting that the average's variance depends on the number of variables.
What it looks likeUsing σ² for every average regardless of m.
Why it failsFor an average of m i.i.d. variables, the variance is σ² / m.
Do this insteadInclude m in the denominator.
Practice Check
What do you think happens?
A random variable has variance 16. Which expression is the Chebyshev upper bound for the probability that it differs from its mean by at least 4?
Reveal answer
16 / 4²
Chebyshev's Inequality places the variance in the numerator and the squared deviation threshold in the denominator.
Explain in one or two sentences why increasing m makes the variance of the average σ² / m smaller.
Hints
- Look at the position of m in the expression σ² / m.
- Connect the smaller variance to the variance term in Chebyshev's bound.
Key Takeaways
- 1Variance is the expected squared distance from a random variable's mean: Var[Z] = E[(Z − E[Z])²].
- 2Chebyshev's Inequality states that P(|Z − E[Z]| ≥ a) ≤ Var[Z] / a².
- 3A larger variance produces a larger Chebyshev bound when the deviation threshold is fixed.
- 4A larger deviation threshold produces a smaller bound because the threshold is squared in the denominator.
- 5For an average of m i.i.d. random variables with common variance σ², the variance is σ² / m, so the variance decreases as m increases.
At a glance
- Variance measures expected squared distance from the mean.
- Chebyshev's Inequality converts variance and a deviation threshold into an upper bound on deviation probability.
- The bound is Var[Z] divided by the squared threshold.
- The variance of an average of m i.i.d. random variables is σ² / m and decreases as m increases.