01 / 21

Expected Value &
Variance

Master the foundations of discrete random variables: learn to compute the center and spread of any probability distribution.

Discrete Math

What Is a Discrete Random Variable?

A discrete random variable \(X\) takes on a finite or countably infinite set of values. Each possible value \(x_i\) has a corresponding probability \(P(X = x_i)\).

Countable
You can list all outcomes: \(\{0, 1, 2, \ldots\}\)
Probability Sum
All probabilities add to 1: \(\sum P(x_i) = 1\)

Visualizing a Probability Distribution

Consider a random variable \(X\) representing the number of heads in 3 coin flips.

0 1/8 2/8 3/8 0 1/8 1 3/8 2 3/8 3 1/8 Number of Heads (X)

Why Do We Need \(E(X)\) and \(\text{Var}(X)\)?

Two distributions can have the same center but very different spreads. Expected value tells us where outcomes cluster; variance tells us how tightly they cluster.

\(E(X)\): Center
The long-run average outcome: the "balance point" of the distribution.
\(\text{Var}(X)\): Spread
How far outcomes typically deviate from the expected value, on average.
\(\sigma\): Scale
Standard deviation \(\sigma = \sqrt{\text{Var}(X)}\) returns spread to the original units.

The Expected Value Formula

Each outcome is weighted by its probability. Outcomes that are more likely contribute more to the average. This is a weighted mean, not a simple arithmetic mean.

E(X) small P med P large P med P

The Variance Formula

Variance measures the average squared deviation from the mean. Each squared distance \((x_i - \mu)^2\) is weighted by its probability.

Standard Deviation: \(\sigma = \sqrt{\text{Var}(X)}\)

Variance is in squared units, which is hard to interpret. Taking the square root gives us the standard deviation \(\sigma\), back in the original units of \(X\).

\(\sigma^2\) (Variance)
Squared units. Used in formulas and proofs. Always \(\geq 0\).
\(\sigma\) (Std Dev)
Original units. Used for interpretation. "Typical distance from the mean."

\(E(X)\) vs \(\text{Var}(X)\): Key Differences

\(E(X)\) \(\text{Var}(X)\)
Measures Center / location Spread / dispersion
Formula \(\sum x_i P(x_i)\) \(\sum (x_i - \mu)^2 P(x_i)\)
Units Same as \(X\) Squared units of \(X\)
Can be negative? Yes No (always \(\geq 0\))
If all values equal That value \(0\)

Key Properties of Expected Value

1
Linearity: \(E(aX + b) = aE(X) + b\) for constants \(a, b\).
2
Sum rule: \(E(X + Y) = E(X) + E(Y)\) always (even if dependent).
3
Constant: \(E(c) = c\) for any constant \(c\).
4
Independence: If \(X, Y\) are independent, \(E(XY) = E(X) \cdot E(Y)\).

Key Properties of Variance

1
Scaling: \(\text{Var}(aX + b) = a^2 \text{Var}(X)\). Adding a constant doesn't change spread.
2
Independence sum: If \(X, Y\) independent, \(\text{Var}(X + Y) = \text{Var}(X) + \text{Var}(Y)\).
3
Non-negative: \(\text{Var}(X) \geq 0\), with equality only if \(X\) is constant.
4
Shortcut: \(\text{Var}(X) = E(X^2) - [E(X)]^2\) is often faster to compute.

Step-by-Step Calculation

1
List all values of \(X\) and their probabilities \(P(X = x_i)\). Verify \(\sum P = 1\).
2
Compute \(E(X)\): Multiply each \(x_i \cdot P(x_i)\) and sum the products.
3
Compute \(E(X^2)\): Multiply each \(x_i^2 \cdot P(x_i)\) and sum the products.
4
Find Variance: \(\text{Var}(X) = E(X^2) - [E(X)]^2\).
5
Standard deviation: \(\sigma = \sqrt{\text{Var}(X)}\).

Example 1: Fair Die Roll

Let \(X\) be the result of rolling a fair six-sided die. Find \(E(X)\) and \(\text{Var}(X)\).

Example 2: Loaded Coin Game

A game pays $5 if a biased coin lands heads (\(P = 0.3\)) and loses $2 for tails (\(P = 0.7\)). Find the expected profit \(E(X)\) and \(\text{Var}(X)\).

Heads +$5 P = 0.3 Tails -$2 P = 0.7

Example 3: Using Properties

Suppose \(E(X) = 4\) and \(\text{Var}(X) = 9\). Let \(Y = 3X - 2\). Find \(E(Y)\) and \(\text{Var}(Y)\).

Common Mistakes to Avoid

✕ Simple Average
Using \(\frac{x_1 + x_2 + \cdots}{n}\) instead of the probability-weighted sum. The values are not equally likely unless stated.
✕ Forgetting to Square
Computing \(\text{Var}(aX) = a \cdot \text{Var}(X)\) instead of \(a^2 \cdot \text{Var}(X)\). The coefficient must be squared.
✕ Shortcut Reversal
Writing \([E(X)]^2 - E(X^2)\) instead of \(E(X^2) - [E(X)]^2\). Order matters: variance can never be negative.

Summary of Key Formulas

Quantity Formula Key Property
\(E(X)\) \(\sum x_i P(x_i)\) \(E(aX+b) = aE(X)+b\)
\(\text{Var}(X)\) \(\sum (x_i - \mu)^2 P(x_i)\) \(\text{Var}(aX+b) = a^2\text{Var}(X)\)
Shortcut \(E(X^2) - [E(X)]^2\) Often faster to compute
\(\sigma\) \(\sqrt{\text{Var}(X)}\) Same units as \(X\)
Sum (indep.) \(\text{Var}(X+Y)\) \(= \text{Var}(X) + \text{Var}(Y)\)

Question 1 of 5

A random variable \(X\) has the distribution: \(P(X=1) = 0.2\), \(P(X=3) = 0.5\), \(P(X=7) = 0.3\). What is \(E(X)\)?

Question 2 of 5

If \(E(X) = 5\) and \(\text{Var}(X) = 4\), what is \(\text{Var}(2X + 3)\)?

Question 3 of 5

A coin is flipped 3 times. Let \(X\) = number of heads. We know \(E(X) = 1.5\) and \(E(X^2) = 3\). What is \(\text{Var}(X)\)?

Question 4 of 5

Which statement is always true about variance?

Question 5 of 5

If \(X\) and \(Y\) are independent with \(E(X) = 2\), \(E(Y) = 3\), \(\text{Var}(X) = 1\), and \(\text{Var}(Y) = 4\), what are \(E(X + Y)\) and \(\text{Var}(X + Y)\)?