Join · scan

OTTO-PR4

ottolearn.org/join

Module 3 · Probability Distributions · PR-4

Discrete Random Variables
"What's a typical week — and how much does it wobble?"

Last class ended on an honest hedge: 35 of the 128 diary weeks have three short nights — about 27%, if every pattern were equally likely. That "if" is a claim Maya can't keep dodging. Today she stops counting equally-likely patterns and starts weighting them: her sleep data becomes a random variable, and the mean and spread she reported back in the fall come back as \(E(X)\) and \(\text{Var}(X)\) — the same two numbers, now built from a probability model.

Live session · join with code OTTO-PR4 · ottolearn.org/join

Same rules as always: vote before I explain, every poll is anonymous, and changing your mind after discussion is the goal.

Today · turning the sleep data into a model

One random variable, five moves.

Name the variable, weight its outcomes, then read off its center and its spread. Every step starts with your vote.

Recall · last class · 45 seconds

Warm-up · 60 seconds · anonymous

Hold your vote — the second concept settles it. And notice the leap: relative frequencies are data; probabilities are a model. Today is where one becomes the other.

Core concept 1 · C1

A random variable turns an outcome into a number

Maya's diary week is a random outcome. "Short nights this week" attaches a number to it — 0, 1, 2, up to 7. That rule is a random variable: capital \(X\) for the variable, lowercase \(x\) for one value it can take.

Discrete: countable, isolated values

Short nights per week: \(0, 1, 2, \ldots, 7\). You can list them, and nothing sits between 2 and 3 nights. Counts are discrete — that's the world of today's tools.

\(X,\ P(X = x)\)

Continuous: any value in an interval

Hours slept last night — \(6.4\), \(6.41\), \(6.412\)… any value in a range. You can't list them; between any two there's always another. Those are continuous (the next module's job).

"Discrete" is not "small"

The trap: discrete means countable, not few. Grains of sand on a beach are countable — discrete, however enormous. The real question is always: can the value land anywhere in an interval (continuous), or only on isolated points (discrete)?

One question sorts every variable: can it take any value in an interval, or only isolated ones you could list? Maya's short-night count is discrete — everything today is built for it.

Core concept 2 · C2

The PMF: the complete probability recipe

A probability mass function lists every value \(X\) can take alongside its probability. Maya's diary tallies become exactly this — the warm-up's relative frequencies, now read as a model.

Condition 1 · nothing negative

Every probability must be \(\geq 0\). A negative probability is impossible — no "less than never." This is the first PMF-validity check, straight from the axioms at the start of the probability module.

\(P(X = x) \geq 0\)

Condition 2 · the total is exactly 1

The probabilities of all values must sum to \(1\): some outcome is certain to happen. Maya's model: \(0.10 + 0.40 + 0.30 + 0.20 = 1.00\) ✓. Both conditions hold, so it's a valid PMF.

\(\sum_{\text{all }x} P(X = x) = 1\)

Unequal is normal

A PMF does not need \(1/n\) for each value — that's only the fair-die special case. Real data is lumpy: \(2\) short nights (\(0.40\)) is four times as likely as, say, one specific rare value. Building the table is how we capture that.

Two checks make a PMF valid — non-negative, and summing to 1. Miss either and it's not a probability model. That validity check is the machinery under the next visual.

See it · C2

Make the total hit exactly 1.00

Predict first: three probabilities are fixed; only one value of \(P(X = 4)\) makes the bar reach exactly \(1.00\). What must it be — and what happens to "valid PMF" the moment you overshoot or undershoot?

Practice · valid PMF? · fresh numbers on demand

Commit first · today's summit

Core concept 3 · C3

Expected value: the balance point of the distribution

The poll's answer names it: \(E(X)\) is the long-run average outcome — each value weighted by how often it happens. It's the population mean \(\mu\) from the fall, rebuilt from a probability model.

A weighted average

Multiply each value by its probability and add: \(E(X) = 1(0.10) + 2(0.40) + 3(0.30) + 4(0.20) = 2.6\). Likelier outcomes pull harder — that's what "weighted" means.

\(E(X) = \mu = \sum x \cdot P(X = x)\)

Balance point, not tallest bar

Picture the bars as weights on a ruler. \(E(X)\) is where it balances — \(2.6\), between the mode (\(2\)) and the long right tail. It need not land on any bar, and usually doesn't.

It means long-run

One week is a whole number nowhere near \(2.6\). Average a whole semester of weeks and the running mean settles onto \(2.6\). "Expected" is a statement about the long run, never about the next single week.

Same arithmetic as the classroom mean — but weighted by probability instead of counted from a list. Two visuals make "balance point" and "long-run" literal:

See it · C3 · balance point

Where does the distribution balance?

Predict first: try the right-skewed preset. The tallest bar is at one value, but the beam balances somewhere else. Which way does \(E(X)\) sit relative to the mode — and why does the long tail pull it there?

See it · C3 · the long run

Watch the running average settle

Predict first: run one trial — the average is a single whole number, nowhere near \(2.6\). Keep running trials. Where does the running average wander, and what line does it settle onto?

Practice · expected value · fresh numbers on demand

Core concept 4 · C4

E(X²): the piece variance needs

Before spread, one intermediate quantity. \(E(X^2)\) is another weighted average — but you square each value first, then weight and sum. Same PMF, one extra step.

Square, then weight, then sum

For Maya's model: \(E(X^2) = 1^2(0.10) + 2^2(0.40) + 3^2(0.30) + 4^2(0.20) = 0.10 + 1.60 + 2.70 + 3.20 = 7.60\).

\(E(X^2) = \sum x^2 \cdot P(X = x)\)

The order is the whole trick

Square each outcome, then average. That is not the same as averaging first and squaring the result — the next card is the error that eats this chapter.

The \(\$1000\)-mistake trap

\(E(X^2) \neq [E(X)]^2\). Here \(E(X^2) = 7.60\) but \([E(X)]^2 = 2.6^2 = 6.76\). They're equal only for a constant (no randomness). Swap them and variance collapses to \(6.76 - 6.76 = 0\) — the single most common error ahead.

\(E(X^2) \neq [E(X)]^2\)

Hold two numbers side by side: \(E(X^2) = 7.60\) (square then average) and \([E(X)]^2 = 6.76\) (average then square). Their difference is the whole point of variance — coming up next.

Core concept 5 · C5

Variance and standard deviation: measuring the wobble

The shortcut formula

Variance is how far outcomes typically sit from \(E(X)\), squared and weighted: \(\text{Var}(X) = E(X^2) - [E(X)]^2\). The two pieces you just built — \(7.60\) and \(6.76\) — subtract to \(0.84\).

\(\text{Var}(X) = E(X^2) - [E(X)]^2\)

Standard deviation: back to real units

Variance is in squared units ("short-nights²" — awkward). Take the square root: \(\sigma_X = \sqrt{\text{Var}(X)} = \sqrt{0.84} \approx 0.92\). Now it reads in short nights — a typical week lands about \(0.92\) nights off the average of \(2.6\).

\(\sigma_X = \sqrt{\text{Var}(X)}\)

It can never be negative

Variance averages squared distances, and squares are never negative — so \(\text{Var}(X) \geq 0\) always. A negative answer isn't a distribution with strange spread; it's a signal you swapped \(E(X^2)\) and \([E(X)]^2\). Recheck, don't report it.

\(\text{Var}(X) \geq 0\)

The spread number Maya reported in the fall, rebuilt from a model. Watch the whole pipeline decided out loud, then run it yourself:

I do · watch the whole decision

  1. 1 I do
  2. 2 We do
  3. 3 You do

Watch me decide every step out loud — which formula, why square before averaging, why the answer can't be negative.

Maya's reader asks: "how much does a week actually wobble?"

Step 1 · Pick the tool, gather the pieces

She wants spread, so it's variance — and the shortcut \(\text{Var}(X) = E(X^2) - [E(X)]^2\) is cheaper than distances. It needs two numbers: \(E(X) = 2.6\) (already computed) and \(E(X^2)\). I gather those before touching the formula.

Step 2 · Square THEN average for E(X²)

Order first — square each outcome, then weight: \(E(X^2) = 1^2(0.10) + 2^2(0.40) + 3^2(0.30) + 4^2(0.20) = 7.60\). If I averaged first and squared, I'd get \(6.76\) — a different, wrong number.

Step 3 · Subtract, then square-root

\(\text{Var}(X) = 7.60 - (2.6)^2 = 7.60 - 6.76 = 0.84\). That's squared units, so \(\sigma_X = \sqrt{0.84} \approx 0.92\) short nights — back in the units the reader cares about.

Step 4 · Sanity-check the sign

Is \(0.84 \geq 0\)? Yes — good. Had I flipped the two pieces (\(6.76 - 7.60\)) I'd have gotten \(-0.84\); a negative variance is impossible and would have caught the swap instantly. Always glance at the sign.

The habit: gather \(E(X)\) and \(E(X^2)\), square before averaging, subtract, root, check the sign. The order of operations is the whole game.

We do · you finish it

  1. 1 I do
  2. 2 We do
  3. 3 You do

Same pipeline, one blank left for the room: you supply the final variance and standard deviation.

A steadier program's week

A second program's weeks give \(X = 1, 2, 3\) short nights with \(P = 0.20, 0.50, 0.30\). I've done the two weighted sums: \(E(X) = 2.1\) and \(E(X^2) = 4.9\).

  1. Pieces gathered: \(E(X) = 2.1\), \(E(X^2) = 4.9\) — both weighted sums already run.
  2. Formula: \(\text{Var}(X) = E(X^2) - [E(X)]^2\), then \(\sigma_X = \sqrt{\text{Var}(X)}\).
  3. Finish it: \(\text{Var}(X) = ?\) and \(\sigma_X = ?\)

    \(\text{Var}(X) = 4.9 - (2.1)^2 = 4.9 - 4.41 = 0.49\), so \(\sigma_X = \sqrt{0.49} = 0.70\) short nights. Smaller than the first program's \(0.92\) — this program's weeks wobble less, exactly the "average hides the spread" point from the fall.

Practice · variance & SD · fresh numbers on demand

  1. 1 I do
  2. 2 We do
  3. 3 You do

Now you run the whole thing solo — fresh numbers every re-roll, support at its minimum.

See it · C5

What the formula actually measures

Predict first: each outcome's distance to \(\mu\) is squared (the green squares — area \(= (x - \mu)^2\)) and weighted by its probability. Which contributes more to the variance: a far-but-rare outcome, or a near-but-common one? Watch how squaring tips the balance.

Diagram showing why Var(X) measures spread, using the PMF with X equal to 1, 2, 3, 4 and probabilities 0.10, 0.40, 0.30, 0.20, whose mean is 2.60. For each outcome, a horizontal arrow shows its deviation from the mean (minus 1.60, minus 0.60, plus 0.40, plus 1.40), and a square built on that arrow has area equal to the squared deviation (2.56, 0.36, 0.16, 1.96). Each square is shaded in proportion to its probability weight. Variance is the probability-weighted average of these squared distances from the mean: 2.56 times 0.10 plus 0.36 times 0.40 plus 0.16 times 0.30 plus 1.96 times 0.20 equals 0.84, so the standard deviation is about 0.92. Outcomes far from the mean contribute disproportionately because the distance is squared. μ = E(X) = 2.60 x = 1 x − μ = −1.60 (x − μ)² = 2.56 weight P = 0.10 2.56 × 0.10 = 0.256 x = 2 x − μ = −0.60 (x − μ)² = 0.36 weight P = 0.40 0.36 × 0.40 = 0.144 x = 3 x − μ = +0.40 (x − μ)² = 0.16 weight P = 0.30 0.16 × 0.30 = 0.048 x = 4 x − μ = +1.40 (x − μ)² = 1.96 weight P = 0.20 1.96 × 0.20 = 0.392 0.10 0.40 0.30 0.20 1 2 3 4 Var(X) = 2.56(0.10) + 0.36(0.40) + 0.16(0.30) + 1.96(0.20) = 0.256 + 0.144 + 0.048 + 0.392 = 0.84 σ = √0.84 ≈ 0.92

Each square's side is the distance from μ, so its area is the squared deviation (x − μ)². Darker squares carry more probability weight. Variance averages the areas using those weights — outcomes far from μ contribute disproportionately because the distance is squared.

Core concept 6 · C6

The CDF: "at most" and "at least" in one table

The PMF answers "exactly equal to." The cumulative distribution function \(F(x) = P(X \leq x)\) answers "at most" — it accumulates probability as \(x\) grows. For Maya's model: \(F(1) = 0.10,\ F(2) = 0.50,\ F(3) = 0.80,\ F(4) = 1.00\).

Accumulate to answer "at most"

\(F(x) = P(X \leq x)\) sums every probability up to and including \(x\). "At most 2 short nights" is \(F(2) = 0.10 + 0.40 = 0.50\) — read straight off the running total.

\(F(x) = P(X \leq x)\)

"At least" flips to a complement

"At least \(k\)" is the complement of "at most \(k - 1\)": \(P(X \geq k) = 1 - F(k-1)\). That's the complement rule from the start of the probability module, pointed at a running total.

\(P(X \geq k) = 1 - F(k-1)\)

A range is a difference of totals

\(P(a < X \leq b) = F(b) - F(a)\) — the total up to \(b\) minus the total up to \(a\) leaves exactly the outcomes in between. It accumulates the whole interval, not just an endpoint.

\(P(a < X \leq b) = F(b) - F(a)\)

One table answers three question shapes — "exactly," "at most," "at least" — because each is just addition, subtraction, or a complement of running totals. Watch it build:

See it · C6

Climb the staircase one step at a time

Predict first: each step adds one bar of the PMF and one jump to the staircase. Before you slide from \(x = 1\) to \(x = 3\): what total height will \(F(3)\) reach, and how does \(P(1 < X \leq 3)\) show up as a gap between two steps?

Find the flaw · one line is wrong

Which route decides? · mixes an earlier class + today

Practice · reading the CDF · fresh numbers on demand

Production task · write the reply

Exit ticket · 60 seconds · anonymous

What Maya files

What Maya can now model

Her sleep data is a random variable now, not just a pile of numbers: a PMF weights each outcome, and \(E(X) = 2.6\) short nights is the long-run balance point — a rate, not a forecast for any one week.

Spread has a number too: \(\text{Var}(X) = E(X^2) - [E(X)]^2 = 0.84\), so \(\sigma_X \approx 0.92\) short nights. Square before averaging, and the answer is never negative — the fall's "average hides the spread," rebuilt from a model.

The CDF answers "at most," "at least," and ranges from one running total — and "at least" is just the complement rule she already owned, \(P(X \geq 2) = 1 - F(1) = 0.90\).

Maya can now describe one random variable built by hand. But her real question — "how many of my 300 respondents report a short week?" — has a formula of its own. Next class: the binomial distribution, and then whether sleep-hours data actually follows the normal curve.

Vote counts on today's slides are simulated for rehearsal; live sessions show the room's real votes.