Title: Chapter 6 — Random Variables
Course: Introduction to Statistics (18-Week Generic Edition)

Course: Introduction to Statistics (18-week generic edition) The module's primary reading · ~30–40 minutes · Objective 4 · Read this before (or alongside) the week's lecture — everything else in the module builds on it.

Why you already care about this

An arcade claw machine costs $1 a play. Most plays win nothing. Sometimes it drops a little $1 keychain, occasionally a $5 plush, and once in a blue moon a $10 headset. Would you play? More interesting: how would you even decide? You know the outcomes. What you're missing is a way to boil "a mix of outcomes with different chances" down to a single honest number — what one play is worth.

That question is everywhere once you see it. Is the $30 extended warranty on a blender a good deal? What should a food truck expect a slow-season day to bring in? How many spaces does a board-game card "typically" move you? In every case there's a number you care about — a payout, a count, a score — whose value hasn't been decided yet. Chance will decide it. Last week you learned to measure chance itself; this week you'll attach chance to numbers and compute with the combination.

By the end of this chapter you will be able to: recognize a random variable and tell a discrete one from a continuous one; check whether a table of values and probabilities is a legitimate probability distribution and read probabilities out of it; compute and — more importantly — correctly interpret the expected value E(X); measure a random variable's spread with its variance and standard deviation; predict what happens to the mean and SD when a variable is shifted or rescaled (fees subtracted, rates multiplied); and explain the strange, beautiful rule that governs continuous random variables: probability is area, and any single exact value has probability zero.

Here is the one-line version of the whole week: a random variable is just a number that hasn't happened yet — and we can still say what it's worth.

Where we are

Weeks 1–4 taught you to describe data you already had: where it comes from (Week 1), what it looks like (Week 2), its center and spread (Week 3), and how two variables relate (Week 4). Week 5 changed direction: instead of describing what did happen, we measured the chance of what might happen — sample spaces, the complement and addition and multiplication rules, conditional probability, and the big idea underneath them all, that chance is wild in the short run and dependable in the long run. This week merges the two halves: outcomes that are uncertain and numeric. The mean and standard deviation from Week 3 are about to reappear — but now they belong to a process instead of a dataset.

1. A number that hasn't happened yet

Start with the plain idea. A random variable is a numeric outcome of a chance process — a number whose value chance will decide. Before the claw drops, "the cash value of my prize" is a random variable: it will definitely be a number, we just don't know which one yet. After the claw drops, it's not a random variable anymore — it's data.

Statisticians write random variables with capital letters, usually X or Y, and particular values with small letters. The sentence "P(X = 5)" reads "the probability that X turns out to be 5." The capital letter is the process; the small letter is one thing the process might produce.

Random variables come in two kinds, and the split will feel familiar from Week 1's variable types:

- A discrete random variable has separate, countable possible values — 0, 1, 2, 3, and so on. Counts of things: prizes won, warranty claims filed, spaces moved. You could write out a complete list of every possible value.
- A continuous random variable's possible values fill an entire interval — between any two possibilities there are infinitely many more. Measurements: the exact time you wait at a crosswalk, the exact weight of a backpack. No list is possible, even in principle.

The memory hook: discrete you count, continuous you measure. The distinction isn't decoration — discrete variables get a table (Sections 2–5), and continuous variables need something stranger, a curve (Section 6).

Misconception check. "A random variable is just another name for the data we collected." Not quite — and the difference matters. The random variable is the number before it happens, with chances attached; data are what you're left with after. The random variable plays the same role the population played in Week 1: the truth-generating machinery behind the numbers we actually see.

2. The probability distribution: a variable's whole personality

For a discrete random variable, everything there is to know fits in one small table: every possible value, with the probability of each. That table is called the variable's probability distribution.

Here is the claw machine's. Let X = the cash value of the prize from one $1 play. The arcade's own service data give:

The table below is the probability distribution of X — each possible prize value with its probability.

x (prize value) | $0 | $1 | $5 | $10
P(X = x) | 0.70 | 0.20 | 0.08 | 0.02

Before you compute anything from a table like this, run the two legitimacy rules:

1. Every probability is between 0 and 1 (inclusive).
2. The probabilities add up to exactly 1 — because something must happen.

Check: 0.70 + 0.20 + 0.08 + 0.02 = 1.00. ✓ Legitimate. If a table totals 0.9 or 1.1, it is broken — a value is missing or a number is mistyped — and every computation you build on it will be quietly wrong. (This check has a useful reverse gear: if a problem gives you all but one probability, the missing one is whatever brings the total to 1.)

Once the table passes, you can read probabilities straight out of it, and Week 5's rules still work. P(X = 0) = 0.70 — most plays win nothing. What's the chance of winning something?

P(X ≥ 1) = 0.20 + 0.08 + 0.02 = 0.30 — or, faster, the complement rule: 1 − P(X = 0) = 1 − 0.70 = 0.30. Same machinery as last week, new packaging.

In practice (your tools). In Google Sheets or Excel, type the values into A2:A5 and the probabilities into B2:B5, then keep a sanity cell nearby: =SUM(B2:B5). It must display exactly 1. Spreadsheets will happily compute nonsense from an illegitimate table — the sanity cell is your legitimacy rule, automated.

3. Expected value: what a chance is worth

Now the payoff question from the hook: what is one play of the claw machine worth?

Imagine playing thousands of times. Some plays pay $0, some $1, occasionally $5 or $10. Your average winnings per play would wobble early and then settle down to one number — exactly the way the running proportion of sixes settled toward 1/6 in last week's lab. That settling point is the expected value of X, written E(X) or μ_X (it is the mean of the random variable). You compute it by weighting each value by its probability:

E(X) = Σ x · P(x) — multiply each possible value by its probability, then add everything up.

Worked example. For the claw machine:

E(X) = 0(0.70) + 1(0.20) + 5(0.08) + 10(0.02) = 0 + 0.20 + 0.40 + 0.20 = $0.80.

Say it in words, because the words are what exams and real life both grade: over many, many plays, the machine pays out about 80 cents per play, on average. The play costs $1.00, so the average player loses 1.00 − 0.80 = $0.20 per play — that's the arcade's edge. Play 100 times and you'll spend $100 to win back roughly $80.

Notice what the weighting did: the $10 headset is tempting, but its 0.02 probability shrinks its contribution to just 20 cents of value. A plain average of the four prize values — (0 + 1 + 5 + 10) ÷ 4 = 4 — would pretend all four outcomes are equally likely and miss the truth by a factor of five. The probabilities are not optional.

Misconception check. "The expected value is what you should expect to win on a play." No — and here's the strangest part: $0.80 is not even a possible prize. No single play ever pays 80 cents. The most likely outcome is $0 (probability 0.70); the expected value is $0.80. Both are true at once, because E(X) is a long-run average, not a prediction for one play. Averages land between the possible values all the time — "2.3 people per household" has never described an actual household. The hook to memorize: expected value is what you'd average, not what you'd expect.

4. Variance and standard deviation: how far off is typical?

Two deals can share an expected value and feel completely different. A machine that pays a steady $2 every play and a machine that flips between $0 and $4 both average $2 — but they are not the same experience. The number that separates them is spread.

In Week 3 the standard deviation measured how far data values typically sit from their mean. A random variable has the same pair of measures, with the averaging weighted by probability:

Var(X) = σ²_X = Σ (x − μ)² · P(x) — each squared distance from the mean, weighted by how likely it is. SD(X) = σ_X = √Var(X) — the square root, which returns to the variable's own units.

Worked example (the week's longest grind — worth doing once by hand). A parking office tracks X = the number of vehicles a randomly chosen household in one neighborhood keeps registered:

The table below is the distribution of registered vehicles per household.

x | 0 | 1 | 2 | 3
P(X = x) | 0.10 | 0.30 | 0.40 | 0.20

Step 1 — the mean. E(X) = 0(0.10) + 1(0.30) + 2(0.40) + 3(0.20) = 0 + 0.30 + 0.80 + 0.60 = 1.7 vehicles.

Step 2 — each squared deviation, weighted by its probability.

- (0 − 1.7)² = 2.89, and 2.89 × 0.10 = 0.289
- (1 − 1.7)² = 0.49, and 0.49 × 0.30 = 0.147
- (2 − 1.7)² = 0.09, and 0.09 × 0.40 = 0.036
- (3 − 1.7)² = 1.69, and 1.69 × 0.20 = 0.338

Step 3 — add. Var(X) = 0.289 + 0.147 + 0.036 + 0.338 = 0.81 vehicles².

Step 4 — square root. SD(X) = √0.81 = 0.9 vehicles.

Interpretation, in words: a randomly chosen household typically sits about 0.9 vehicles away from the mean of 1.7. Households at 1 or 2 vehicles are ordinary; a 3-vehicle household is a bit more than one SD above the mean — noticeable, not shocking.

Misconception check. "Variance, standard deviation — same thing, roughly." They are one square root apart, and the units make the difference vivid: the variance above is 0.81 squared vehicles, a unit no human thinks in. Variance is the math's scratch work; the SD is the answer you say out loud. If a reported "standard deviation" looks suspiciously large, ask whether it's actually a variance still waiting for its square root — this σ vs. σ² slip is one of the most common errors in the course.

In practice (your tools). After the values-in-A, probabilities-in-B setup: E(X) is one cell — =SUMPRODUCT(A2:A5,B2:B5) (pairwise multiply, then add: exactly the formula). For the spread, make a helper column: in C2, =(A2-0.8)^2*B2 (using the claw machine's mean of 0.8), fill down, then Var = =SUM(C2:C5) and SD = =SQRT(...) of that cell. Google Sheets and Excel are identical here. You'll run this whole workflow in Data Lab 6 — and then simulate a thousand plays to watch the long-run average do its settling act.

5. Shifts and stretches: linear transformations

Real questions rarely stop at X itself. Fees get subtracted, per-unit rates get multiplied, units get converted. The good news: if Y = a + bX (a constant a added, a constant multiplier b), you do not have to rebuild the distribution. Two rules carry everything:

- Mean: E(a + bX) = a + b·E(X). The average goes through the same arithmetic as the variable.
- SD: SD(a + bX) = |b|·SD(X). Only the multiplier touches the spread. Adding a constant slides every possible outcome by the same amount — the outcomes don't spread out or squeeze together. (Variance, being squared, picks up b²: Var(a + bX) = b²·Var(X).)

The memory hook: adding shifts the center; multiplying stretches both. A constant can't stretch anything.

Worked example. A phone-repair kiosk's service records say X = the number of screen repairs in a day has mean E(X) = 4 and SD(X) = 1.5. Each repair brings in $60, and the kiosk pays $50 a day for its mall stall. Daily profit is Y = 60X − 50.

- E(Y) = 60(4) − 50 = 240 − 50 = $190.
- SD(Y) = 60 × 1.5 = $90. The $50 fee is nowhere in this calculation — subtracting the same $50 every day shifts profits down but leaves the gap between good days and bad days untouched.

Quick stress test of the idea: if the stall fee rises to $60, the mean profit drops $10 to $180 — and the SD is still $90.

Misconception check. "Subtracting the fee makes profits less variable." Picture every possible day's profit lined up on a number line, then slide the whole line 50 units left. The line moved; the spacing didn't. Only multiplication rescales the spacing — which is why b (and only b) appears in the SD rule.

6. Continuous random variables: probability becomes area

Everything so far leaned on a table — one row of values, one row of probabilities. A continuous random variable breaks the table. Between any two possible values sit infinitely many more, so you cannot list values, and no single value can hold its own chunk of probability. The fix is one of the most elegant trades in statistics: replace the table with a density curve, and replace "add up the chunks" with

probability = area under the density curve over an interval.

Two facts govern every density curve: the total area under it is exactly 1 (the continuous version of "probabilities sum to 1"), and probability questions are always interval questions.

Worked example (the friendliest density there is). Glance at a wall clock at a completely random moment, and let X = where the second hand points, measured in seconds from 0 up to 60. Every position is equally likely, so the density curve is a flat rectangle from 0 to 60 — the uniform density.

- The rectangle's base is 60 and its total area must be 1, so its height is 1/60 (about 0.0167). The height is not a probability — it's simply the level that makes the total area come out to 1.
- P(X ≤ 15) — the second hand is somewhere in the first quarter of the face — is the area from 0 to 15: 15 × (1/60) = 0.25. Exactly the quarter your intuition demanded.
- P(20 ≤ X ≤ 50) = 30 × (1/60) = 0.50.
- P(X = exactly 30)? A single point is an interval of width zero. No width, no area — probability 0. You can land near 30 easily (the interval from 29 to 31 has area 2/60), but exactly 30.000000…, never — no single instant owns any chunk of chance.

That last fact has a tidy consequence: for continuous variables, P(X ≤ a) and P(X < a) are the same number, because the boundary point contributes nothing. (For discrete variables they can differ a lot — P(X ≤ 0) and P(X < 0) differ by the whole P(X = 0).)

Misconception check. "P(X = a) is the height of the curve at a." Height is not probability — area is. A tall, narrow density and a short, wide one can enclose identical areas. The chapter's chant: no width, no area, no probability.

Where is this going? Next week, one famous discrete random variable — the count of successes in n tries — gets its own name, formula, and spreadsheet function: the binomial. And in Week 8 you'll meet the most famous density curve in the world, the normal curve. Both run entirely on this week's machinery.

Key terms

- Random variable — a numeric outcome of a chance process; a number chance hasn't decided yet (written X, Y).
- Discrete random variable — possible values are separate and countable (counts); a complete list is possible.
- Continuous random variable — possible values fill an interval (measurements); no list is possible.
- Probability distribution (discrete) — the table of every possible value with its probability.
- Legitimate distribution — every probability is between 0 and 1, and the probabilities total exactly 1.
- Expected value E(X) = μ_X — the long-run average value, Σ x · P(x); need not be a possible value of X.
- Variance of a random variable (σ²_X) — Σ (x − μ)² · P(x); the probability-weighted average squared distance from the mean, in squared units.
- Standard deviation of a random variable (σ_X) — √Var(X); the typical distance from the mean, in the variable's own units.
- Linear transformation (Y = a + bX) — shifting by a moves the mean only; multiplying by b rescales the mean and the SD (and variance by b²).
- Density curve — the curve describing a continuous random variable; total area under it is 1.
- Uniform density — the flat density for "every value in the interval equally likely."

Summary

- A random variable attaches numbers to chance: discrete you count, continuous you measure.
- A discrete variable's distribution table is its whole personality — but only after it passes the two legitimacy rules (each probability in [0,1]; total exactly 1).
- E(X) = Σ x·P(x) is the long-run average — what you'd average, not what you'd expect — and it doesn't have to be a possible value (the $1 claw machine play is worth $0.80).
- Var(X) = Σ (x−μ)²·P(x) and SD = √Var measure spread; variance is scratch work in squared units, the SD is the number you report (vehicles example: mean 1.7, Var 0.81, SD 0.9).
- Under Y = a + bX: adding shifts the center; multiplying stretches both — E(Y) = a + b·μ, SD(Y) = |b|·σ (kiosk: 60X − 50 gives mean $190, SD $90).
- For continuous variables, probability is area under a density curve; total area is 1, and any single exact value has probability zero (so P(X ≤ a) = P(X < a)).

Check your understanding

Work these before looking at the answers — they're ungraded, and the answers (with reasoning) are at the bottom of the page.

1. Classify each as a discrete or a continuous random variable, with a one-line reason: (a) the number of times you hit snooze tomorrow morning; (b) the exact time, in minutes, until you fall asleep tonight. Then, for the continuous one: what is the probability it equals one exact value (say, exactly 12.5 minutes), and why?
2. A small music shop's daily guitar sales follow this distribution: X = 0, 1, 2, 3 guitars with probabilities 0.4, 0.3, 0.2, 0.1. First verify the table is legitimate, then compute E(X) and interpret it in one sentence. Is it a problem that your E(X) is a whole number the shop can sell — or that it might not have been?
3. A band's merch table sells either 4 hoodies (slow night, probability 0.5) or 8 hoodies (good night, probability 0.5). Compute E(X), Var(X), and SD(X), showing the deviation steps.
4. A wedding photographer books X sessions per weekend, with mean 3 and SD 1. Each session pays $80, and parking costs a flat $15 per weekend, so weekend earnings are Y = 80X − 15. Find E(Y) and SD(Y) — and explain in plain language why the $15 shows up in one answer but not the other.

Answers (worked reasoning — read after attempting)

1. (a) Discrete — snooze presses are separate, countable values (0, 1, 2, …); you could list them. (b) Continuous — time fills an interval; between 12 and 13 minutes are infinitely many possible values, so no list is possible. For the continuous one, P(X = exactly 12.5) = 0: a single point is an interval of width zero, and with no width there is no area — no probability. Only intervals (like "between 12 and 13 minutes") carry probability.
2. Legitimacy: each probability is between 0 and 1 ✓ and 0.4 + 0.3 + 0.2 + 0.1 = 1.0 ✓. E(X) = 0(0.4) + 1(0.3) + 2(0.2) + 3(0.1) = 0 + 0.3 + 0.4 + 0.3 = 1.0 guitar. Interpretation: over many days, the shop sells about 1 guitar per day on average. And no — it wouldn't have been a problem either way. E(X) happening to equal a possible value (1) is a coincidence, not a requirement; an E(X) of, say, 1.3 guitars would be just as correct, because the expected value is a long-run average, not a single day's outcome.
3. E(X) = 4(0.5) + 8(0.5) = 2 + 4 = 6 hoodies. Deviations: (4 − 6)² = 4, weighted 4 × 0.5 = 2; (8 − 6)² = 4, weighted 4 × 0.5 = 2. Var(X) = 2 + 2 = 4 hoodies²; SD(X) = √4 = 2 hoodies. (Sanity check on the interpretation: every night is either 4 or 8 — exactly 2 away from the mean of 6 — so "typically 2 hoodies from the mean" is literally true here.)
4. E(Y) = 80(3) − 15 = 240 − 15 = $225. SD(Y) = 80 × 1 = $80. The $15 is a constant: it's subtracted from every weekend identically, so it slides all possible earnings down by $15 (moving the mean) without changing the gaps between good and bad weekends (leaving the spread alone). Only the $80-per-session multiplier stretches the spread — which is why it, and not the parking fee, appears in the SD.

Next up in this module: the slide deck if you want the lecture's visual walk-through, then the Readings & Resources page for optional deeper dives — and when you're ready to practice, Lecture Tutorial 6 turns your chatbot into your personal Week 6 tutor.