Random Variables and Expected Value
Discounts, tax, tips, profit margins
A random variable assigns a numerical value to each outcome of a random process. It is the bridge between probability (which deals with events) and statistics (which deals with numbers). Instead of saying βthe event is heads,β a random variable lets you say βthe value is 1.β This shift from events to numbers opens the door to averages, spread, and all the quantitative tools of statistics.
What Is a Random Variable?
A random variable is a variable whose value is determined by the outcome of a random process. Random variables are typically denoted by capital letters such as , , or .
Example: Flip a fair coin 3 times and let = the number of heads. The possible values of are 0, 1, 2, and 3. Before you flip, you do not know what will be β but you can describe the probability of each possible value.
There are two types of random variables:
- Discrete random variables take on a countable number of values (0, 1, 2, 3, β¦). Examples include the number of heads in 3 flips, the number of defective items in a batch, or the number of customers per hour.
- Continuous random variables can take any value within a range (like height, temperature, or time). These require different tools (probability density functions) and are covered in a later topic.
This page focuses entirely on discrete random variables.
Probability Distribution Tables
A probability distribution lists every possible value of a random variable alongside its probability. It provides a complete picture of the random variableβs behavior.
Every valid probability distribution must satisfy two rules:
- Every probability is non-negative: for all values
- All probabilities sum to exactly 1:
Example 1: Number of Heads in 3 Coin Flips
When you flip a fair coin 3 times, the sample space has equally likely outcomes: HHH, HHT, HTH, THH, HTT, THT, TTH, TTT. Counting the number of heads in each outcome gives us this distribution:
| (heads) | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
Verification:
The distribution tells us that getting exactly 1 or exactly 2 heads is much more likely (probability each) than getting 0 or 3 heads (probability each).
Probability Distribution β Number of Heads in 3 Coin Flips
Expected Value (Mean of a Random Variable)
The expected value (or mean) of a discrete random variable is the long-run average value you would observe if you repeated the random process many times. It is calculated by multiplying each value by its probability and summing:
The expected value does not have to be a value the random variable can actually take. It represents the theoretical average.
Example 2: Expected Number of Heads
Using the distribution from Example 1:
Interpretation: On average, you would expect 1.5 heads per 3 flips. Of course you cannot flip exactly 1.5 heads in a single trial, but over 1,000 sets of 3 flips, the average number of heads would be very close to 1.5.
Example 3: Insurance Payout
An insurance policy pays out as follows:
| Outcome | Payout | Probability |
|---|---|---|
| No claim | $0 | 0.90 |
| Minor claim | $2,000 | 0.08 |
| Major claim | $10,000 | 0.02 |
What is the expected payout per policy?
The expected payout is $360 per policy. If the insurance company charges a premium of $500, it expects to profit $140 per policy on average. This is exactly how insurance companies set their prices β by calculating expected value and adding a margin.
Verification: . .
Variance and Standard Deviation of a Random Variable
Expected value tells you the center of a distribution, but it says nothing about how spread out the values are. Variance measures the average squared distance from the mean:
There is an equivalent shortcut formula that is often easier to compute:
The standard deviation is the square root of the variance, bringing the measure of spread back to the original units:
Example 4: Variance of Coin Flips
Using the distribution from Example 1 with :
Verification: . . Sum:
Interpretation: The number of heads in 3 coin flips has a mean of 1.5 and a standard deviation of about 0.87. Most outcomes will fall within one standard deviation of the mean (roughly between 0.63 and 2.37), which aligns with what we see β 1 and 2 heads are the most common results.
Linear Transformations
If you transform a random variable using a linear function , the expected value and variance follow predictable rules:
Adding a constant () shifts the mean but does not change the spread. Multiplying by a constant () scales both the mean and the standard deviation, and scales the variance by .
Example: A store marks up each item by doubling the wholesale price and adding $5. If the wholesale price has and , then the retail price has:
Real-World Application: Retail β Expected Daily Revenue
A small bookstore tracks the number of books sold per day and finds the following distribution:
| Books sold () | 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| Probability | 0.05 | 0.15 | 0.30 | 0.25 | 0.15 | 0.10 |
Each book sells for $25. What is the expected daily revenue?
Step 1: Find , the expected number of books sold.
Verification:
Step 2: Since revenue , use the linear transformation rule:
Answer: The bookstore expects to earn $65 in daily book revenue on average.
Step 3 (bonus): Find the standard deviation of daily revenue.
The expected daily revenue is $65, with a standard deviation of about $33 β there is meaningful day-to-day variation.
Practice Problems
Test your understanding with these problems. Click to reveal each answer.
Problem 1: A discrete random variable X has the following distribution. Find the missing probability.
| 1 | 2 | 3 | 4 | |
|---|---|---|---|---|
| 0.10 | 0.25 | ? | 0.30 |
Since all probabilities must sum to 1:
Answer:
Problem 2: A random variable X has the distribution: P(X=1) = 0.2, P(X=2) = 0.5, P(X=3) = 0.3. Find E(X).
Answer:
Problem 3: A game costs $5 to play. You roll a die: if you roll a 6 you win $20, otherwise you win nothing. What is the expected net gain per game?
Let = net gain. If you roll a 6, net gain = $20 - $5 = $15. Otherwise, net gain = $0 - $5 = -$5.
Answer: The expected net gain is approximately -$1.67 per game. On average, you lose about $1.67 each time you play. The game favors the house.
Problem 4: Using the distribution from Problem 2, find Var(X) and SD(X).
We found . Now compute variance:
Answer: and
Problem 5: If X has E(X) = 10 and Var(X) = 4, find E(Y) and SD(Y) where Y = 3X - 2.
Using the linear transformation rules:
Answer: and
Key Takeaways
- A random variable assigns a number to each outcome of a random process. Discrete random variables take countable values; continuous ones take any value in a range.
- A probability distribution lists every value with its probability. All probabilities must be non-negative and sum to 1.
- Expected value gives the long-run average β the theoretical center of the distribution.
- Variance measures spread. Standard deviation is .
- Linear transformations: if , then and .
- Expected value is used everywhere β insurance pricing, inventory planning, game theory, and business revenue forecasting.
Return to Statistics for more topics in this section.
Next Up in Statistics
All Statistics topicsLast updated: March 29, 2026