Chapter 4 · OpenStax Ch 4

Discrete Random Variables

Random variables that count things, their expected values, and the named distributions.

4.1 Expectation

A random variable \(X\) is a number whose value depends on chance, like the face a die shows. Its probability distribution lists every possible value with its probability. The expected value is the probability-weighted average of the values,

\[\mu = E[X] = \sum x \, P(x),\]

and it is what the ordinary average of the outcomes settles toward after many repetitions. Roll the fair die and watch the sample mean wander, then calm down near 3.5. Now drag the weight of face 6 up. The probabilities change, the table recomputes \(\mu\), and the running mean settles somewhere new. The expected value need not be a possible outcome, and no die ever shows 3.5. It is a long-run average, not a prediction of the next roll.

Reading: OpenStax Introductory Statistics, Sections 4.1, 4.2.

4.2 Variance of a random variable

Two dice can have the same expected value and behave very differently. One always shows 3 or 4, the other only 1 or 6. The variance of a random variable measures how far outcomes typically land from \(\mu\). It weights each squared distance by its probability,

\[\sigma^2 = \sum (x - \mu)^2 \, P(x), \qquad \sigma = \sqrt{\sigma^2}.\]

Each stick in the top chart is a distance \(x - \mu\), and the bottom chart shows how much each face contributes to \(\sigma^2\). Faces far from \(\mu\) contribute a lot even when they are unlikely. Roll the die and the sample variance \(s^2\) of the outcomes1 drifts toward \(\sigma^2\). Push the weights of faces 1 and 6 up and the rest down. Now \(\mu\) stays near 3.5 while \(\sigma^2\) grows.

1 The sample variance divides by \(n - 1\). Reading: OpenStax Introductory Statistics, Section 4.2.

4.3 The named discrete distributions

Some situations come up so often that their distributions have names. The binomial counts successes in \(n\) independent trials that share the same chance \(p\), and its probabilities are \(P(X = k) = \binom{n}{k} p^k (1-p)^{n-k}\). The geometric counts trials until the first success, which gives \(P(X = k) = (1-p)^{k-1} p\). The hypergeometric counts successes when drawing without replacement, so each draw changes the odds. The Poisson counts rare events at an average rate \(\lambda\), with \(P(X = k) = \lambda^k e^{-\lambda} / k!\).

Pick a distribution, read its one-line scenario, and move the sliders to see the shape respond. Then draw. The dark bars of real draws pile up under the light bars of theory, and the sample mean approaches \(E[X]\). The skill being built here is recognition. Given a story, which distribution is it?

Reading: OpenStax Introductory Statistics, Sections 4.3 to 4.6.