Discrete MathematicsProbability, Conditioning and Expectation8 of 9
Probability, Conditioning and Expectation · 8
Variance, Standard Deviation and Chebyshev's Inequality
Two games can have the exact same expected value and still feel completely different to play, so we need a second number that measures how spread out the outcomes are around the center.
1
Measuring Spread with Variance
The variance of a random variable is the weighted average of the squared distances from its expected value.
Measuring Spread with Variance
If we try to measure spread by averaging the plain shifts from the center m=E[X], the negative pulls on the left and the positive pulls on the right always cancel out:
E[X−m]=E[X]−mLinearity of expectation=m−m=0
To keep opposite shifts from canceling, and to make independent random variables combine cleanly later on, we square each outcome's distance from the center before taking the weighted average:
Var(X)=E[squared distancefrom center(X−m)2]
No matter where the outcomes sit on the number line, the weighted shifts from the balance point always cancel to zero, while the squared distances grow rapidly as an outlier moves further away.
Plain shifts from the balance point always cancel to zero, while squaring makes every distance positive so a distant outlier drives the variance way up.
2
The Variance Shortcut and Standard Deviation
Subtracting the average from every outcome gets tedious when the average is a decimal or fraction, and squaring the distances leaves our answer in squared units that do not match the number line. We want a faster way to compute variance directly from the outcomes, along with a measure of spread in the game's original units.
The Variance Shortcut and Standard Deviation
Multiplying out (X−m)2 and applying linearity of expectation turns the definition of variance into a two-piece shortcut:
Var(X)=E[(X−m)2]=E[X2−2mX+m2]Multiply out the square=E[X2]−2mE[X]+m2Linearity of expectation=E[X2]−2m2+m2Substitute E[X]=m=average of squaresE[X2]−square of average(E[X])2Combine like terms
Practical note:E[X2] and (E[X])2 look almost identical at a glance, so read the brackets from the inside out: for E[X2], square each outcome first and then take the weighted average; for (E[X])2, take the original expected value and square that single number.
Because variance squares the units of X (turning dollars into "square dollars"), we take the square root of the variance to get the standard deviation, written σ (sigma), which puts the spread back into the original units of the number line:
σ=Var(X)
3
Shifting, Scaling, and Adding Independent Variables
Next, let's see how the variance and standard deviation behave when we add a constant to a random variable, multiply it by a constant, or add independent random variables together.
Shifting, Scaling, and Adding Independent Variables
Each operation changes the distances from the center in a predictable way:
Shifting by a constant (X+c): Sliding every outcome by c moves the center by c as well, leaving every outcome's distance from the center unchanged:
Var(X+c)=Var(X)
Scaling by a constant (aX): Multiplying every outcome by a stretches every distance from the center by a factor of a, which multiplies every squared distance by a2:
Var(aX)=a2Var(X)
(Even when a is negative and flips the number line backward, a2 is positive, so variance can never be negative.)
Adding independent variables (X+Y): When we square the combined shift of X+Y and take the average, the middle cross-term is 2E[(shift of X)(shift of Y)]. Whenever X and Y are independent, the expected value of that product splits into the product of the individual average shifts, 2×0×0=0, so the cross-term vanishes and the variances simply add:
Var(X+Y)=Var(X)+Var(Y)(for independent X,Y)
This rule makes finding the spread of a Binomial random variable effortless. A single indicator trial I (which equals 1 with probability p and 0 with probability 1−p) has E[I]=p, and since squaring 1 and 0 changes nothing (12=1 and 02=0), we also have E[I2]=p:
Var(I)=E[I2]−(E[I])2=p−p2=p(1−p)
A Binomial random variable X counting the total number of successes in n independent trials is the sum of n independent indicators, X=I1+I2+⋯+In. Adding their variances together n times gives the Binomial variance and standard deviation:
Var(X)=np(1−p),σ=np(1−p)
4
Chebyshev's Inequality
Often we do not know the full probability table of a distribution, only its expected value μ and its standard deviation σ. Chebyshev's Inequality treats the variance as a fixed budget to cap how much probability can sit far away from the center, no matter what the distribution looks like.
Chebyshev's Inequality
When we measure distance in standard deviations σ, the entire distribution has a variance budget of 1, and any outcome sitting at least k standard deviations from the center μ costs at least k2 in squared distance. Even if all the remaining probability sits right on the center at zero cost, the fraction of probability that the budget can afford in the outer tails is at most costbudget=k21:
P(at least k standarddeviations from center∣X−μ∣≥kσ)≤k21
Subtracting the outer tail bound from 1 tells us that at least 1−k21 of the probability must stay strictly within k standard deviations of the center.
With the total variance budget held fixed, moving the tail cutoffs further from the center drives up their squared-distance cost and forces the maximum probability that can fit in the outer tails to drop off as k21.
With the variance budget fixed, pushing the cutoffs farther from the center makes their cost grow as the square of the distance and shrinks the probability that can fit in the tails.
5
Worked Example: Espresso Machine Breakdowns
Now let's put the variance shortcut, standard deviation, and Chebyshev's Inequality together on a distribution with a decimal average.
A coffee shop tracks how many espresso machines break down per week: 0 machines with probability 0.50,1 machine with probability 0.30, and 4 machines with probability 0.20. Find the expected value, the variance, and the standard deviation, and use Chebyshev's Inequality to bound the probability that the number of breakdowns is at least 3 standard deviations away from the average.
Worked Example: Espresso Machine Breakdowns
Text solution
Weight the outcomes to find the expected valueMultiply each breakdown count by its probability and add the pieces to find the weekly average.
Square the outcomes and average them for E[X2]Because the center 1.1 is a decimal, square the breakdown counts first (02=0,12=1,42=16) and take their weighted average.
Subtract the square of the average and take the square rootSubtract (E[X])2 from E[X2] to get the variance, then take the square root to get back to machines.
Bound the k=3 tail probability with Chebyshev's InequalityPlug k=3 into k21 to cap the probability of landing at or above 1.1+32.29≈5.64 machines (or at or below 1.1−32.29≈−3.44).
P(∣X−1.1∣≥3σ)≤321=91≈11.1%
So even someone who only knew the mean 1.1 and standard deviation 1.51 could guarantee that at most 91 (about 11.1%) of weeks fall 3 or more standard deviations from the average. In our actual table where at most 4 machines can break, the true probability of reaching 5.64 or more is 0%.
Key concepts
When you need to find the spread of a random variable from its distribution, start with the center m=E[X]. If the outcomes sit at clean integer distances around m (like Game A paying 9 or 11 dollars around m=10), you do not need the shortcut: just square the shifts directly to get Var(X)=E[(X−m)2]=1. Whenever m is a fraction or decimal, or when there are several outcomes, use the shortcut Var(X)=E[X2]−(E[X])2 (for Game B, 500−102=400), and take the square root at the end to get the standard deviation σ=Var(X)=20 in the original units of the number line.
When a variable is shifted, scaled, or added to another variable, always do the algebra in variances first and take the square root for σ only at the final step. Adding a fixed bonus X+5 slides the whole game without changing its variance (Var(X+5)=Var(X)), whereas scaling a single game to 3X stretches every distance by 3 and multiplies its variance by 32=9(Var(3X)=9Var(X)). Adding independent variables adds their variances (Var(X+Y)=Var(X)+Var(Y)), which gives Var(X)=np(1−p) for the number of successes in n independent trials with probability p (so 100 fair coin flips have Var(X)=100(21)(21)=25 and σ=5).
When you only have a distribution's average μ and standard deviation σ and need a worst-case guarantee on how much probability can fall in the tails, divide the cutoff distance by σ to find how many standard deviations k the cutoff sits from μ. Chebyshev's Inequality guarantees that at most k21 of the probability lies k or more standard deviations out (P(∣X−μ∣≥kσ)≤k21), and at least 1−k21 lies strictly inside (for μ=50 and σ=5, the cutoffs 35 and 65 sit k=515=3 standard deviations out, so at most 91 is outside and at least 98 is inside). If you are already given the full probability table and asked for the exact probability of an event, read the exact probabilities straight from the table rather than using Chebyshev's bound.
6
Practice
1
A game pays −2 dollars with probability 0.20,3 dollars with probability 0.50, and 8 dollars with probability 0.30. Let X be the payout in dollars. Using the shortcut formula, find the expected value E[X], the variance Var(X), and the standard deviation σ.
After finding E[X], what do you get when you square each of the three payouts −2,3, and 8 before weighting them by their probabilities?
To find E[X2], square each payout first (be careful to square the negative sign so (−2)2=+4; writing −22=−4 is the most common slip here and leads to E[X2]=22.9 and a wrong variance of 10.65):
A random variable X has expected value E[X]=6 and variance Var(X)=9. Define a new random variable Y=20−4X. Find E[Y],Var(Y), and the standard deviation of Y.
Which part of 20−4X is a constant shift, and which part stretches the distances from the center?
By linearity of expectation,
E[Y]=20−4(6)=−4.
For the variance, shifting by 20 changes nothing, and multiplying X by −4 multiplies the variance by (−4)2=+16 (watch out for plugging Var(X)=9 linearly into 20−4X to get −16, or multiplying by 4 instead of (−4)2 to get 36):
Var(Y)=(−4)2Var(X)=16×9=144,σY=144=12.
3
A single play of a game has an expected payout of 10 dollars and a standard deviation of 6 dollars. In Option 1, you play the game once for triple the stakes, receiving 3X. In Option 2, you play the game three independent times and add your winnings, receiving X1+X2+X3. Find the expected value, variance, and standard deviation of your total payout under each option.
Before applying the scaling or addition rules, what is the variance Var(X) of a single play?
First square the given standard deviation to get the single-play variance Var(X)=62=36 dollars2 (using σ=6 as if it were already the variance is a common slip that gives 54 and 18).
Under Option 1 (3X), the expected value is 3(10)=30 dollars, the variance scales by 32=9 to give
Var(3X)=32×36=324 dollars2,
and the standard deviation is 324=18 dollars.
Under Option 2 (X1+X2+X3), the expected value is 10+10+10=30 dollars, and because the three plays are independent, their variances add (do not add the standard deviations 6+6+6=18 directly):
The daily number of support tickets at a company has an average of 80 and a variance of 16. Using Chebyshev's Inequality: (a) At least what fraction of days have strictly between 68 and 92 tickets? (b) Find a symmetric interval around 80 that is guaranteed to contain the ticket count on at least 96% of days.
By Chebyshev's Inequality, at most 321=91 of days fall on or outside these cutoffs, so the fraction of days strictly between 68 and 92 tickets (don't stop at the tail bound 91) is at least 1−91=98.
First find the standard deviation σ. In (a), how many standard deviations away from 80 are the cutoffs 68 and 92? In (b), if at least 96% of days are inside, at most what fraction can be on or outside the boundaries?
First take the square root of the variance to get the standard deviation σ=16=4 tickets (dividing or multiplying by the variance 16 instead of σ=4 is the main trap in both parts, which would give k=1612=43 in (a) and an interval of 0 to 160 in (b)).
(a) The cutoffs 68 and 92 are 12 tickets from the mean 80, which is k=412=3 standard deviations. By Chebyshev's Inequality, at most 321=91 of days fall on or outside these cutoffs, so the fraction of days strictly between 68 and 92 tickets (don't stop at the tail bound 91) is at least
1−91=98≈88.9%.
(b) To guarantee at least 96%=2524 of days inside the interval, at most 1−2524=251 can fall in the outer tails. Setting k21=251 gives k=5 standard deviations, or 5×4=20 tickets on either side of 80, which is the interval strictly between 60 and 100 tickets.
5
A biased coin lands Heads with probability p=0.20. You flip the coin n=400 independent times and let X be the total number of Heads. Find E[X],Var(X), and σ, and use Chebyshev's Inequality to give an upper bound on the probability that X is either 48 or fewer, or 112 or more.
Use the Binomial formulas for n independent trials to find the mean and standard deviation first, then measure how many standard deviations 48 and 112 sit from the mean.
Because X is a Binomial random variable with n=400 and p=0.20, its expected value is
E[X]=np=400(0.20)=80 heads,
its variance is (remember the 1−p=0.80 factor; leaving it out gives a wrong variance of 80)
Var(X)=np(1−p)=400(0.20)(0.80)=64 heads2,
and its standard deviation is σ=64=8 heads. The cutoffs 48 and 112 are each 32 heads away from 80, which is k=832=4 standard deviations (dividing 32 by the variance 64 instead of σ=8 would give k=0.5). By Chebyshev's Inequality, the probability of landing at 48 or fewer, or 112 or more, is at most
P(∣X−80∣≥32)≤421=161=6.25%.
6
Suppose a game has expected value 50 dollars and variance 25 dollars2 (so σ=5 dollars). Chebyshev's Inequality says that at most 91 of the probability can lie 15 dollars or more from the center (at or below 35, or at or above 65). Construct a symmetric probability distribution on the three outcomes 35,50, and 65 that has E[X]=50 and Var(X)=25, showing that the 91 bound can actually be achieved.
Split the remaining 91 tail probability equally between the two outer outcomes 35 and 65 (putting 91 on each tail is the common slip here, which doubles the total tail probability to 92 and gives a variance of 50 instead of 25).
How much variance does an outcome at 50 cost, and how must the total tail probability of 91 be divided between 35 and 65 to keep the distribution symmetric?
Place probability 98 at the center 50 (where the distance from the mean is 0, costing 0 variance) and split the remaining 91 tail probability equally between the two outer outcomes 35 and 65 (putting 91 on each tail is the common slip here, which doubles the total tail probability to 92 and gives a variance of 50 instead of 25). This gives
P(X=35)=181,P(X=50)=98,P(X=65)=181,
which has expected value E[X]=50 by symmetry, total tail probability 181+181=91, and variance