The Chronicles of Randomia
THE CHRONICLES OF RANDOMIA
Unit 2 · Discrete Random Variables — a self-study storybook
Presented by Top EduPrep  ·  Written by Teacher Kim Min-ho
Chapter Zero

In the kingdom of Randomia, nothing was ever certain — not the weather, not the harvest, not even the roll of a single die at the market square. Yet the kingdom did not fear uncertainty. Long ago, its scholars discovered that even chance obeys quiet laws, and those who learn these laws are given the title Royal Reckoner.

You are Lyra Quill, a new apprentice at the Reckoner's Guild. Your guide is old Master Aleph, keeper of the Oracle Archive, who promises to walk you through five realms of the kingdom — each one guarding a piece of the puzzle of chance. Master every realm, and the crown will name you Royal Reckoner of Randomia.

Your travel log — the random variable — is simply a rule that assigns a number to every possible outcome of an uncertain event. In this unit, we study the kind of random variable that can only take a countable list of values (like 0, 1, 2, 3…), which the guild calls a discrete random variable, written \(X\).

I
The Hall of Tables
2.1 · Probability distribution tables
II
The Treasurer's Ledger
2.2 · Expected value E(X)
III
The Alchemist's Spread
2.3 · Variance & standard deviation
IV
The Royal Mint
2.4 · Linear transformations
V
The Twin Traders
2.5 · Sum & difference of variables
Scroll of Wisdom
Full unit summary & formula sheet
Realm I · Section 2.1

The Hall of Tables

Where every outcome is written in its rightful column.
The Story

Master Aleph leads you into a marble hall lined with endless scrolls. "Every game of chance in this kingdom," he says, "can be written as a table — one column for what could happen, one column for how likely it is." He unrolls a scroll showing the spin of a carnival wheel, its numbers and odds sitting side by side like matched dance partners.

"But beware," Aleph warns, tapping the scroll with his cane. "A table only earns the Guild's seal if it follows two sacred rules. Break them, and the table is false."

Concept · Probability Distribution Table

A discrete random variable \(X\) lists every value it can take, alongside the probability of each value. This is called its probability distribution.

\[ \text{Rule 1:} \quad 0 \le P(x) \le 1 \ \text{ for every value } x \] \[ \text{Rule 2:} \quad \sum P(x) = 1 \]

In plain words: no probability can be negative or bigger than 1, and all the probabilities together must add up to exactly 1 (100% of everything that could happen).

Example 1 · The Carnival Wheel
A spinner has four slots, numbered 1 through 4. The guild scribe recorded three of the probabilities but spilled ink on the fourth. Find the missing value \(P(3)\).
x1234
P(x)0.100.30?0.20
Step 1. All probabilities must add to 1: \(0.10 + 0.30 + P(3) + 0.20 = 1\).
Step 2. Add the known pieces: \(0.10+0.30+0.20 = 0.60\).
Step 3. Solve: \(P(3) = 1 - 0.60 = 0.40\).
P(3) = 0.40
Example 2 · Three Flips of the Royal Coin
A fair coin is flipped 3 times. Let \(X\) = the number of heads. Build the probability distribution table for \(X\).
Step 1. List all 8 equally likely outcomes: HHH, HHT, HTH, THH, HTT, THT, TTH, TTT.
Step 2. Count the heads in each: this gives \(X = 0,1,2,3\).
Step 3. Count how many outcomes give each value: 1 way for 0 heads, 3 ways for 1 head, 3 ways for 2 heads, 1 way for 3 heads — out of 8 total.
x0123
P(x)1/83/83/81/8
Check: \( \frac{1}{8}+\frac{3}{8}+\frac{3}{8}+\frac{1}{8} = \frac{8}{8} = 1\ \checkmark\)
Valid distribution — we will reuse this table in the next two realms!
Try It Yourself
A table lists \(P(1)=0.15,\ P(2)=0.45,\ P(3)=0.50\). Is this a valid probability distribution? Why or why not?
Add them: \(0.15+0.45+0.50 = 1.10\), which is greater than 1.
Not valid — the probabilities must sum to exactly 1
Realm II · Section 2.2

The Treasurer's Ledger

Where the kingdom learns what to expect, on average.
The Story

The Royal Treasurer greets you with a heavy ledger. "Every merchant asks me the same question," she sighs, "‘What should I expect to earn, on average, if I play this game a thousand times?’" She shows you her trick: multiply each outcome by its likelihood, then add everything together. This single number is the game's heart — its long-run average.

Concept · Expected Value E(X)

The expected value (also called the mean, \(\mu_X\)) of a discrete random variable is the weighted average of all its possible values, where each value is weighted by its probability.

\[ E(X) = \mu_X = \sum \big[ x \cdot P(x) \big] \]

This is not a value \(X\) has to actually land on — it's the balance point of the distribution, the value you'd expect on average over many, many repetitions.

Example 1 · The Coin Realm, Revisited
Using the coin-flip table from the Hall of Tables (\(X\) = number of heads in 3 flips), find \(E(X)\).
x0123
P(x)1/83/83/81/8
Step 1. Multiply each value by its probability: \(0(\frac18)+1(\frac38)+2(\frac38)+3(\frac18)\).
Step 2. That equals \(0 + \frac{3}{8} + \frac{6}{8} + \frac{3}{8} = \frac{12}{8}\).
Step 3. Simplify: \(\frac{12}{8} = 1.5\).
E(X) = 1.5 heads
Example 2 · The Merchant's Lottery Ticket
A lottery ticket costs $5. It wins $100 with probability 0.02, wins $20 with probability 0.08, and wins nothing with probability 0.90. Find the expected winnings, then the expected net profit for a player.
Step 1. Check the table sums to 1: \(0.02+0.08+0.90=1.00\ \checkmark\)
Step 2. Expected winnings: \(E(\text{win}) = 100(0.02)+20(0.08)+0(0.90) = 2 + 1.6 + 0 = 3.6\).
Step 3. Net profit = winnings − ticket price, so subtract the $5 cost: \(3.6 - 5 = -1.4\).
E(winnings) = $3.60, E(net profit) = −$1.40
Meaning: over many tickets, a player loses $1.40 on average per ticket — this is exactly why the Royal Mint (Realm IV) always tilts games in its own favor!
Try It Yourself
A household's number of pets \(X\) has the distribution below. Find \(E(X)\).
x0123
P(x)0.40.30.20.1
\(E(X) = 0(0.4)+1(0.3)+2(0.2)+3(0.1) = 0+0.3+0.4+0.3 = 1.0\)
E(X) = 1.0 pet
Realm III · Section 2.3

The Alchemist's Spread

Where the kingdom learns to measure how far things wander from average.
The Story

Deep in a candle-lit workshop, the Royal Alchemist mixes potions of wildly different strengths. "Knowing the average potency isn't enough," she says, swirling a vial. "Two potions can share the same average strength, yet one is wonderfully consistent while the other explodes half the time! I need a number that tells me how spread out the outcomes are."

She teaches you her measure: for every outcome, find its distance from the mean, square it (so far-away outcomes count extra), weight by probability, and add it all up. This is the variance. Its square root — back in the same units as \(X\) — is the standard deviation.

Concept · Variance & Standard Deviation

\[ \text{Var}(X) = \sigma_X^2 = \sum \big[(x-\mu_X)^2 \cdot P(x)\big] \;=\; E(X^2) - \big[E(X)\big]^2 \] \[ SD(X) = \sigma_X = \sqrt{\text{Var}(X)} \]

The shortcut formula \(E(X^2)-[E(X)]^2\) is usually the fastest path: find \(E(X)\) first, then find \(E(X^2)=\sum x^2 P(x)\), then subtract.

Example 1 · The Coin Realm, One Last Time
For the coin-flip distribution (\(E(X) = 1.5\) from Realm II), find \(\text{Var}(X)\) and \(SD(X)\).
x0123
P(x)1/83/83/81/8
Step 1. Find \(E(X^2) = \sum x^2 P(x) = 0^2(\frac18)+1^2(\frac38)+2^2(\frac38)+3^2(\frac18)\).
Step 2. That's \(0+\frac{3}{8}+\frac{12}{8}+\frac{9}{8}=\frac{24}{8}=3\).
Step 3. \(\text{Var}(X) = E(X^2)-[E(X)]^2 = 3 - (1.5)^2 = 3 - 2.25 = 0.75\).
Step 4. \(SD(X) = \sqrt{0.75} \approx 0.87\).
Var(X) = 0.75, SD(X) ≈ 0.87 heads
Example 2 · The Household Pets, Revisited
Using \(X\) = number of pets (\(E(X)=1.0\) from Realm II), find \(\text{Var}(X)\) and \(SD(X)\).
x0123
P(x)0.40.30.20.1
Step 1. \(E(X^2) = 0^2(0.4)+1^2(0.3)+2^2(0.2)+3^2(0.1) = 0+0.3+0.8+0.9 = 2.0\).
Step 2. \(\text{Var}(X) = 2.0 - (1.0)^2 = 2.0-1.0 = 1.0\).
Step 3. \(SD(X) = \sqrt{1.0} = 1.0\).
Var(X) = 1.0, SD(X) = 1.0 pet
Try It Yourself
A distribution has \(E(X)=4\) and \(E(X^2)=20\). Find \(\text{Var}(X)\) and \(SD(X)\).
\(\text{Var}(X)=20-4^2=20-16=4\), so \(SD(X)=\sqrt{4}=2\).
Var(X) = 4, SD(X) = 2
Realm IV · Section 2.4

The Royal Mint

Where every value is stretched, shifted, and re-stamped with a new face.
The Story

At the Royal Mint, coins are melted, re-measured, and re-stamped by a fixed rule: multiply by a constant, add a constant. "Every currency conversion, every flat fee, every tax," says the Mint Master, "is just a straight line drawn through the old values: \(Y = aX+b\)." He shows you how the whole distribution shifts and stretches — but never changes shape.

Concept · Linear Transformations

If \(Y = aX + b\) for constants \(a\) and \(b\):

\[ E(aX+b) = aE(X) + b \] \[ \text{Var}(aX+b) = a^2 \, \text{Var}(X) \] \[ SD(aX+b) = |a| \cdot SD(X) \]

Adding a constant \(b\) shifts the center but never changes the spread (adding $3 flat to every price doesn't make prices more variable). Multiplying by \(a\) stretches both the center and the spread — and variance gets multiplied by \(a^2\), never just \(a\), because variance is already in "squared units."

Example 1 · Converting the Weather Scrolls
Randomia's temperature \(X\), in \(^\circ\)C, has \(E(X)=20\) and \(SD(X)=5\). A traveling merchant wants Fahrenheit, using \(Y = 1.8X+32\). Find \(E(Y)\), \(\text{Var}(Y)\), and \(SD(Y)\).
Step 1. \(E(Y) = 1.8E(X)+32 = 1.8(20)+32 = 36+32=68\).
Step 2. \(SD(Y) = |1.8|\cdot SD(X) = 1.8(5)=9\).
Step 3. \(\text{Var}(Y) = 1.8^2 \cdot \text{Var}(X) = 3.24 \times 25 = 81\) (matches \(9^2\ \checkmark\)).
E(Y) = 68°F, SD(Y) = 9°F, Var(Y) = 81
Example 2 · The Caravan Shipping Fee
A caravan carries \(X\) crates, with \(E(X)=4\) and \(SD(X)=1.2\). The toll office charges a shipping cost \(Y = 2X+3\) (in gold coins). Find \(E(Y)\) and \(SD(Y)\).
Step 1. \(E(Y) = 2(4)+3 = 8+3=11\).
Step 2. \(SD(Y) = |2|(1.2) = 2.4\).
E(Y) = 11 gold coins, SD(Y) = 2.4 gold coins
Try It Yourself
A quiz score \(X\) has \(E(X)=70\) and \(SD(X)=8\). The teacher rescales with \(Y = X + 5\) (a flat 5-point curve). Find \(E(Y)\) and \(SD(Y)\).
\(E(Y)=70+5=75\). Since \(a=1\), the spread doesn't change: \(SD(Y) = 8\).
E(Y) = 75, SD(Y) = 8 (unchanged!)
Realm V · Section 2.5

The Twin Traders

Where two independent fortunes are added, subtracted — and their uncertainties always combine.
The Story

At the final gate stand the Twin Traders, Corin and Della, who never share information about their sales — truly independent merchants. "People assume that if you subtract my earnings from hers," Corin laughs, "the uncertainty should shrink. It doesn't! Randomness never cancels — it only adds up."

This is the final, and most surprising, lesson of Randomia: means behave exactly as you'd expect under addition and subtraction, but variances only ever add — even when the random variables themselves are being subtracted.

Concept · Sum & Difference of Independent Random Variables

\[ E(X+Y) = E(X)+E(Y) \qquad\qquad E(X-Y) = E(X)-E(Y) \] \[ \text{If } X, Y \text{ are independent:} \] \[ \text{Var}(X+Y) = \text{Var}(X)+\text{Var}(Y) \qquad \text{Var}(X-Y) = \text{Var}(X)+\text{Var}(Y) \] \[ SD(X\pm Y) = \sqrt{\text{Var}(X)+\text{Var}(Y)} \]

The one trap every apprentice falls into: variances are added for both the sum and the difference of independent variables. They are never subtracted, since variability from two separate, independent sources can only pile up — it can never partially cancel out.

Example 1 · Two Tasks on the Same Day
Task A takes \(X\) minutes with \(E(X)=30,\ \text{Var}(X)=16\). Task B takes \(Y\) minutes with \(E(Y)=45,\ \text{Var}(Y)=25\), independent of Task A. Find the mean and standard deviation of the total time \(T=X+Y\), and of the difference \(D=Y-X\).
Total time \(T=X+Y\):   \(E(T)=30+45=75\) minutes.
\(\text{Var}(T)=16+25=41\), so \(SD(T)=\sqrt{41}\approx 6.40\) minutes.
Difference \(D=Y-X\):   \(E(D)=45-30=15\) minutes.
Even though we subtracted the means, we still add the variances: \(\text{Var}(D)=16+25=41\), so \(SD(D)=\sqrt{41}\approx 6.40\) minutes — identical spread to the sum!
E(T)=75, SD(T)≈6.40 | E(D)=15, SD(D)≈6.40
Example 2 · The Height Difference
Among Randomia's knights, height \(X\) (inches) has \(E(X)=70,\ SD(X)=3\). Among its scholars, height \(Y\) has \(E(Y)=64,\ SD(Y)=2.5\), independent of \(X\). Find the mean and standard deviation of the difference \(D = X - Y\).
Step 1. \(E(D) = E(X)-E(Y) = 70-64 = 6\) inches.
Step 2. Convert SDs to variances first: \(\text{Var}(X)=3^2=9\), \(\text{Var}(Y)=2.5^2=6.25\).
Step 3. \(\text{Var}(D) = 9+6.25 = 15.25\), so \(SD(D)=\sqrt{15.25}\approx 3.91\) inches.
E(D) = 6 in, SD(D) ≈ 3.91 in
Try It Yourself
Two independent games have \(\text{Var}(X)=9\) and \(\text{Var}(Y)=4\). What is \(\text{Var}(X-Y)\)? (Careful — is it 5 or 13?)
Variances always add for independent variables, even in a difference: \(\text{Var}(X-Y)=9+4=13\), not \(9-4=5\).
Var(X-Y) = 13
Epilogue

The Scroll of Wisdom

Every law of Randomia, gathered onto a single scroll.
The Story

You return to Master Aleph's archive, your travel log filled with five hard-won lessons. He rolls out one final, blank scroll. "Copy down what you've learned," he says, "in your own hand — for the Reckoner who understands a law well enough to summarize it, owns that law forever." With that, you are named Royal Reckoner of Randomia.

2.1 Probability Distribution Tables

\[ 0 \le P(x) \le 1 \quad\text{and}\quad \sum P(x) = 1 \]

2.2 Expected Value

\[ E(X) = \mu_X = \sum \big[x \cdot P(x)\big] \]

2.3 Variance & Standard Deviation

\[ \text{Var}(X) = \sigma_X^2 = \sum\big[(x-\mu_X)^2P(x)\big] = E(X^2)-[E(X)]^2 \] \[ SD(X) = \sigma_X = \sqrt{\text{Var}(X)} \]

2.4 Linear Transformations \(Y=aX+b\)

\[ E(aX+b)=aE(X)+b \qquad \text{Var}(aX+b)=a^2\text{Var}(X) \qquad SD(aX+b)=|a|SD(X) \]

2.5 Sum & Difference of Independent Variables

\[ E(X \pm Y) = E(X) \pm E(Y) \] \[ \text{Var}(X \pm Y) = \text{Var}(X) + \text{Var}(Y) \quad \text{(always adds, for both + and −)} \] \[ SD(X\pm Y) = \sqrt{\text{Var}(X)+\text{Var}(Y)} \]

— End of Unit 2: Discrete Random Variables —
May your calculations be ever accurate, Royal Reckoner.