The Timpson Lyceum · Discrete Math (2025)
Probability, Expectation, and Variance - Lecture 17 (Discrete Math)
Probability, Expectation, and Variance – Lecture 17
Overview
This lecture builds the theory of real-valued random variables on top of the probability model from earlier in the course: a sample space of outcomes together with a probability function . It defines the expected value of a random variable, proves the linearity properties that make expectations easy to compute, and shows why the product rule holds only for independent variables. It then introduces variance as a measure of how spread out a distribution is and derives the shortcut formula that everyone uses in practice. Two recurring intuitions tie it together: expectation as a long-run average (and as a center of mass), and variance as average squared distance from that center.
Key Concepts
Sample space and probability function
- A sample space is a pair where is the set of all possible outcomes and is the probability function.
- Restrictions on : probabilities are never negative, and they sum to , i.e. .
Real random variable
- A real random variable is a function whose domain is the sample space and whose codomain is : it maps each outcome to a real number.
- Example (one fair die): , for every outcome, and returns the number rolled.
Expected value
- Definition: — for every outcome, multiply its value by its probability and add up the results.
- Interpretation: the long-run average value of , or the "fair price" of a game that pays dollars for outcome . A single fair die has .
- The shorthand denotes (which variable is understood from context).
Second formula for expectation (grouping by output)
- Instead of summing over outcomes, group by the values can produce:
- For two dice with sum, the outputs run through with probabilities , giving .
Linearity of expectation
- Sum rule: — proved by distributing and splitting the sum.
- Scalar rule: for a constant (factor the constant out of the sum).
- Combined: .
- Payoff: the expected sum of two dice is without summing all outcomes; for dice it is .
Product rule (independence required)
- holds only when and are independent, meaning .
- Counterexample (flip a coin twice): with number of heads and number of tails, so , but . The variables are dependent, so the rule fails.
Center of mass
- Expectation also computes a center of mass: place masses (here, equal "weights" acting like probabilities) at positions, and is the balance point.
Variance
- Variance measures how spread out a distribution is — average squared distance from the center .
- Definition: .
- The deviation is squared (not absolute-valued) to keep terms positive without a piecewise function, to magnify large deviations, and to shrink small ones. The standard deviation is .
- Three mean-zero variables illustrate the idea: each with prob. has ; a variable taking with prob. each (and otherwise) has ; a variable taking each with prob. has .
Computational formula for variance
- . Note (square the values before averaging) differs from .
- This is far easier in practice: you already need , and is a direct expectation rather than a sum of squared deviations.
Worked Example
Compute the variance of a single fair die roll, , , .
Use . First find , then subtract the square of the known mean :
Summary
- A real random variable maps outcomes in to real numbers; its expected value is , the long-run average.
- Expectation is linear: , which collapses huge sums (e.g. dice ) into trivial arithmetic.
- The product rule requires independence; the two-coin-flip example shows it fails for dependent variables.
- Expectation doubles as a center of mass (and a weighted average) of masses placed along a line.
- Variance measures spread; squaring (rather than absolute value) avoids piecewise definitions and exaggerates outliers.
- In practice always compute variance with — e.g. a single fair die has variance .