Introduction to Statistics · Chapter 4 · Random Variables
Every game of chance, every bet, and every probability distribution reduces to the same two numbers: where it balances, and how far it spreads.
bookSHelf · Introduction to Statistics · §4.2 · a self-paced section
Learning objectives — by the end of this section you will be able to
§4.2.1 — the long-term average
Definition 4.2.1 — Expected Value (Mean) of a Discrete Random Variable
Let X be a discrete random variable with probability distribution function P(x). The expected value, or mean, of X is
μ=∑(x⋅P(x))where the sum runs over every value x that X can take.
Definition 4.2.1 — the x⋅P(x) contributions land you on the same axis the outcomes live on.
§4.2.1 — build the table, then add
In words: multiply each value of the random variable by its probability, then add all the products. That bookkeeping is easy to lose track of in your head, so we set it up in a table with one row per value of X and one column for each piece of the formula.
Every problem you meet in this section — soccer schedules, lottery tickets, biased coins, earthquake bets — is the same three columns filled with different numbers. Build the table first and the arithmetic takes care of itself.
§4.2.1 — from short-term noise to a long-term number
Toss a coin twice and probability does not promise you one head, one tail — you might get nine heads in ten tosses. Probability says nothing about short-term results. Karl Pearson once tossed a fair coin 24,000 times to make exactly this point: he recorded 12,012 heads, a relative frequency of 0.5005, almost dead on the theoretical 0.5.
Law of Large Numbers: as the number of trials in a probability experiment increases, the difference between the theoretical probability of an event and its relative frequency approaches zero. That long-term average is called the mean or expected value, written μ.
Insight Note — "expected" does not mean "likely to happen"
The balance point, not a prediction
A family can have an expected number of 2.3 children, and no family has 2.3 children. The expected value is the balance point of the distribution, not a prediction of any single outcome. Read it as "the average over a very long run," never as "the result I should expect tonight."
Your turn — three columns, then add
Try It Now 4.2.1 — a customer's water-bottle order
A customer orders 1, 2, or 3 bottles of water. P(1)=0.6, P(2)=0.3, P(3)=0.1. Find the long-term average or expected value, μ, of the number of bottles a customer will order.
| x | P(x) | x · P(x) |
|---|---|---|
| 1 | 0.6 | 0.6 |
| 2 | 0.3 | 0.6 |
| 3 | 0.1 | 0.3 |
Answer: μ=0.6+0.6+0.3=1.5 bottles. Over many customers, the store sells an average of 1.5 bottles per order.
Worked example — the workhorse table in action
Example 4.2.1 — A Soccer Team's Weekly Schedule
Coach Dana Whitfield's team plays soccer zero, one, or two days a week: P(0)=0.2, P(1)=0.5, P(2)=0.3. Find the expected value, μ, of the number of days per week the team plays.
| x | P(x) | x · P(x) |
|---|---|---|
| 0 | 0.2 | 0 |
| 1 | 0.5 | 0.5 |
| 2 | 0.3 | 0.6 |
Answer: μ=0+0.5+0.6=1.1. Dana's team would, on average, expect to play soccer 1.1 days per week — no single week has 1.1 practice days, but 1.1 is the long-term average across a season.
§4.2.2 — how spread out the distribution is
Definition 4.2.2 — Standard Deviation of a Discrete Probability Distribution
Let X be a discrete random variable with mean μ. The standard deviation of X is the square root of its variance:
σ=∑[(x−μ)2⋅P(x)]Definition 4.2.2 — each deviation becomes a square, probability shrinks it, and the side of the pooled square is σ.
§4.2.2 — the recipe from Chapter 2, with one change
The expected value tells you where the distribution balances. It says nothing about how spread out it is. Two distributions can share the same μ and behave completely differently — one clustered tightly around the mean, one throwing you far to either side.
The recipe is the one from Chapter 2, with one change: there, every data point counted equally. Here, each value is weighted by how likely it is — a rare outcome far from the mean should not stretch the spread as much as a common one does.
Context Pause — why the deviations get squared
Squaring counts distance, not direction
Values above the mean give positive deviations and values below give negative ones — added directly, they would cancel to zero every time. Squaring makes every deviation count as distance, regardless of direction. Taking the square root at the end puts the answer back into the original units.
Your turn — probabilities as fractions of a sample
Try It Now 4.2.2 — a hospital nurse-call log
A hospital researcher tracks how many times the average post-op patient rings the nurse in a 12-hour shift. For a random sample of 50 patients: P(0)=504, P(1)=508, P(2)=5016, P(3)=5014, P(4)=506, P(5)=502. What is the expected value?
| x | P(x) | x · P(x) |
|---|---|---|
| 0 | 0.08 | 0 |
| 1 | 0.16 | 0.16 |
| 2 | 0.32 | 0.64 |
| 3 | 0.28 | 0.84 |
| 4 | 0.12 | 0.48 |
| 5 | 0.04 | 0.20 |
Answer: μ=2.32. A post-op patient rings the nurse an average of about 2.3 times per 12-hour shift.
Worked example — adding the deviation column
Example 4.2.2 — How Often a Newborn Wakes Its Parents
Mateo Reyes and his husband log how many times per week their newborn's crying wakes them after midnight: P(0)=502, P(1)=5011, P(2)=5023, P(3)=509, P(4)=504, P(5)=501. Find μ and σ.
| x | P(x) | x · P(x) | (x − μ)² · P(x) |
|---|---|---|---|
| 0 | 0.04 | 0 | 0.1764 |
| 1 | 0.22 | 0.22 | 0.2662 |
| 2 | 0.46 | 0.92 | 0.0046 |
| 3 | 0.18 | 0.54 | 0.1458 |
| 4 | 0.08 | 0.32 | 0.2888 |
| 5 | 0.02 | 0.10 | 0.1682 |
Answer: μ=50105=2.1 wakings per week. σ=1.05≈1.0247. A typical week lands roughly one waking above or below 2.1, matching Mateo's log.
§4.2.3 — expected value in games of chance
Expected value earns its keep fastest when the random variable is money. Set X to your profit — what you walk away with minus what you paid — and μ tells you your average gain or loss per play over the long run.
A positive μ means the game pays you to play it. A negative μ means it does not — no matter how good the jackpot sounds.
§4.2.3 — the single most common mistake
In a game of chance the values of X are almost never the numbers printed on the cards or the dice — they are the dollar amounts attached to those outcomes. Ask what you actually walk away with, not what the machine displays.
Write profit from the player's point of view: money you hand over is negative, money you receive is positive. A game that charges $2 and pays $100,000 has profit values of −2 and 100000, not 2 and 100,002 — the $2 you paid comes back with the prize.
Insight Note — the jackpot is not the story; the probability is
A big number times a tiny number can be small
A $100,000 prize looks enormous next to a $2 ticket, and it is. But 0.00001 is a very small number, and multiplying an enormous prize by a tiny probability can easily land under the price of the ticket. Expected value makes those two quantities comparable.
Your turn — a near-fair game
Try It Now 4.2.3 — guessing four suits in a row
Four cards are drawn (with replacement) from a standard deck; you guess each suit before it is drawn. You pay $1 to play. Guess every suit correctly and you get your money back plus $256. What is your expected profit over the long term?
Step 1. P(win)=(41)4=2561≈0.0039, so P(lose)=256255.
| Outcome | x | P(x) | x · P(x) |
|---|---|---|---|
| Win | 256 | 1/256 | 1 |
| Lose | −1 | 255/256 | −0.9961 |
Answer: μ≈$0.004 per game — less than half a cent. This game is very close to fair: over the long run you neither gain nor lose in any meaningful way.
Worked example — a bet that loses on average
Example 4.2.3 — A Five-Digit Lottery
Five numbers, 0–9, are drawn with replacement. You pay $2 to play and profit $100,000 if you match all five in order (you get your $2 back plus $100,000). What is your expected profit over the long term?
Step 1. P(win)=(101)5=0.00001, so P(lose)=0.99999.
| Outcome | x | P(x) | x · P(x) |
|---|---|---|---|
| Loss | −2 | 0.99999 | −1.99998 |
| Profit | 100,000 | 0.00001 | 1 |
Answer: μ=−0.99998≈−$1 per game. Notice what that number is not: each play you either lose $2 or profit $100,000, and neither is $1 — the $1 is the average loss after playing over and over.
§4.2.4 — the same work, done in a different order
Sometimes a problem hands you a partly filled expected value table and asks you to finish it — the same work as before, done out of order. Two habits make this reliable:
Your turn — fill in the payouts, then the products
Try It Now 4.2.4 — a spinner game
P(red)=52, P(blue)=52, P(green)=51. Red costs $10, blue costs and pays nothing, green wins $10. Complete the expected value table.
| Outcome | x | P(x) | x · P(x) |
|---|---|---|---|
| Red | −10 | 2/5 | −4 |
| Blue | 0 | 2/5 | 0 |
| Green | 10 | 1/5 | 2 |
Answer: μ=−4+0+2=−$2. You lose an average of $2 every spin — not a game to play for money.
Worked example — testing a booth game before it opens
Example 4.2.4 — A Biased Coin
Nora Whitaker is testing a booth game before her fundraiser. P(heads)=32, P(tails)=31. Toss heads and you pay $6; toss tails and you win $10. Played many times, does the player come out ahead?
| Outcome | x | P(x) | x · P(x) |
|---|---|---|---|
| WIN (tails) | 10 | 1/3 | 10/3 |
| LOSE (heads) | −6 | 2/3 | −12/3 |
Answer: μ=310−312=−32≈−$0.67. The player loses about 67 cents a game on average — exactly why Nora is happy to keep it at her booth.
§4.2.5 — one more column on the same table
Like data, probability distributions have standard deviations. Once you know μ, the fourth column is a fixed recipe:
§4.2.5 — the recipe, worked on Example 4.2.1's table
| x | P(x) | x · P(x) | (x − μ)² · P(x) |
|---|---|---|---|
| 0 | 0.2 | 0 | 0.242 |
| 1 | 0.5 | 0.5 | 0.005 |
| 2 | 0.3 | 0.6 | 0.243 |
Table 4.2.6: Adding a deviation column to the soccer team's expected value table (μ=1.1, from Example 4.2.1).
Add the last column: 0.242+0.005+0.243=0.490, so σ=0.49=0.7. In practice, a calculator or computer does this arithmetic to cut round-off error — later sections give short-cut formulas for μ and σ for specific distribution families.
Your turn — count odd cards from two stacks
Try It Now 4.2.5 — two card stacks, numbered 1–8
One card is picked from each of two stacks numbered 1 to 8. Let X = the number of cards showing an odd number. Find μ and σ.
Step 1. Each stack: P(odd)=84=21. Independent picks give P(0)=41, P(1)=21, P(2)=41.
| x | P(x) | x · P(x) | (x − μ)² · P(x) |
|---|---|---|---|
| 0 | 1/4 | 0 | 1/4 |
| 1 | 1/2 | 1/2 | 0 |
| 2 | 1/4 | 1/2 | 1/4 |
Answer: μ=1 odd card, σ=0.5≈0.7071.
Worked example — counting from a sample space
Example 4.2.5 — Even Faces on Two Die Rolls
A fair six-sided die is tossed twice. Let X = the number of faces showing even. The 36-outcome sample space has 9 outcomes with no even face, 18 with one, and 9 with two. Find μ and σ.
| x | P(x) | x · P(x) | (x − μ)² · P(x) |
|---|---|---|---|
| 0 | 9/36 | 0 | 9/36 |
| 1 | 18/36 | 18/36 | 0 |
| 2 | 9/36 | 18/36 | 9/36 |
Answer: μ=3636=1 even face, σ=3618≈0.7071.
§4.2.6 — real bets are rarely this tidy
Every game so far handed you its probabilities cleanly — a fair coin, a spinner, a lottery with known digits. Real decisions are rarely that tidy: the probability is often an estimate from data — a forecast, a survey, a historical rate — and the expected value you compute is only as good as that estimate.
The arithmetic does not change. What changes is the report: state the assumption the probability rests on, and remember that a large standard deviation means the long-run average poorly describes any single outcome — a modest expected loss and a huge spread is exactly the shape of most bets people find tempting.
Your turn — a forecast-based bet
Try It Now 4.2.6 — betting on an earthquake in Japan
On May 11, 2013, the 48-hour forecast probability of a moderate earthquake in Japan was about 1.08%. Win the bet and you win $100; lose it and you pay $10. Find μ and σ of the profit X.
| Outcome | x | P(x) | x · P(x) | (x − μ)² · P(x) |
|---|---|---|---|---|
| win | 100 | 0.0108 | 1.08 | 127.87 |
| loss | −10 | 0.9892 | −9.892 | 1.40 |
Answer: μ≈−$8.81, σ=129.27≈$11.37. Japan's 1.08% is far lower than Iran's 21.42% (next slide), so the same style of bet is a much worse deal here.
Worked example — a modest loss, a huge spread
Example 4.2.6 — Betting on an Earthquake
Kai Nakamura bets on the same May 11, 2013 window, but in Iran: the 48-hour forecast probability of a moderate earthquake was about 21.42%. Win and Kai wins $50; lose and Kai pays $20. Will Kai come out ahead over many bets?
| Outcome | x | P(x) | x · P(x) | (x − μ)² · P(x) |
|---|---|---|---|---|
| win | 50 | 0.2142 | 10.71 | 648.10 |
| loss | −20 | 0.7858 | −15.72 | 176.66 |
Answer: μ≈−$5.01, σ=824.76≈$28.72. Kai loses about $5.01 per bet on average — but σ is far larger than that loss, which is what makes a bet like this feel winnable even though it is not.
Key Terms — the vocabulary this section put to work
expected value — the long-term average of a random variable, μ=∑(x⋅P(x)); also called the mean of the distribution.
mean of a discrete random variable (μ) — another name for the expected value; the balance point of the probability distribution.
Law of Large Numbers — as the number of trials increases, the relative frequency of an event approaches its theoretical probability.
expected value table — a table with one row per value of X and columns for x, P(x), and x⋅P(x), used to organize the expected-value calculation.
standard deviation of a probability distribution (σ) — the square root of ∑[(x−μ)2P(x)]; it measures how far outcomes typically fall from the expected value.
fair game — a game whose expected profit is zero, so neither player gains nor loses money over the long run.
The headline result
Two numbers describe any bet completely.
μ says whether it pays you to play; σ says how far any single outcome can land from that average — Iran's earthquake bet: μ≈−$5.01, σ≈$28.72. Japan's: μ≈−$8.81, σ≈$11.37.
Both bets lose on average. The bet with the smaller expected loss (Iran) also carries the larger spread — the number that makes a losing bet feel winnable is σ, not the jackpot.
† Neither bet is a fair game — a fair game has μ=0 exactly, which neither of these forecasts produces. A near-fair game, like Try It Now 4.2.3's four-suit guess (μ≈$0.004), is the closer analogue.
§4.2 — conclusions
μ=∑x⋅P(x) is the balance point of a distribution; σ=∑(x−μ)2P(x) is its spread. Both come from the same three- or four-column table, one row per outcome, built the same way whether X counts days, wakings, or dollars.
A big prize is not a good deal by itself — multiply it by its (usually tiny) probability first. And check the columns: P(x) must sum to 1, and the third column is x⋅P(x), not a running total.
Next: §4.3 — The Binomial Distribution, where a repeated yes/no experiment gets its own shortcut formulas for μ and σ.