Discrete Random Variables
View .md

Expected Value and Variance

Expected Value (Mean)

The expected value of a discrete random variable XX is the weighted average of all possible values:

E[X]=∑xx⋅pX(x)E[X] = \sum_x x \cdot p_X(x)

Intuition

Think of expected value as the “center of mass” or “center of gravity” of the PMF when plotted as a bar graph. It represents the long-run average if you repeated the experiment many times.

Properties

  • Non-negativity: If X≥0X \geq 0, then E[X]≥0E[X] \geq 0
  • Linearity: E[aX+b]=aE[X]+bE[aX + b] = aE[X] + b for constants a,ba, b
  • Linearity for sums: E[X+Y]=E[X]+E[Y]E[X + Y] = E[X] + E[Y] (always true, even if XX and YY are dependent!)

Example: Travel Time

You travel 200 miles. With probability 1/2, you fly at 200 mph. With probability 1/2, you walk at 1 mph.

  • Speed VV: E[V]=12(1)+12(200)=100.5E[V] = \frac{1}{2}(1) + \frac{1}{2}(200) = 100.5 mph
  • Time T=200/VT = 200/V: E[T]=12(200)+12(1)=100.5E[T] = \frac{1}{2}(200) + \frac{1}{2}(1) = 100.5 hours

Important: E[V]⋅E[T]≠E[V⋅T]E[V] \cdot E[T] \neq E[V \cdot T]! You cannot reason on averages when dealing with non-linear functions.


Variance

The variance measures the spread of a distribution around its mean:

Var(X)=E[(X−E[X])2]\text{Var}(X) = E\left[(X - E[X])^2\right]

Why Not Average Distance?

The average distance from the mean is zero: E[X−E[X]]=0E[X - E[X]] = 0 (positive and negative deviations cancel). So we square the deviations first.

Alternative Formula

Var(X)=E[X2]−(E[X])2\text{Var}(X) = E[X^2] - (E[X])^2

This is often easier to compute in practice.

Standard Deviation

σX=Var(X)\sigma_X = \sqrt{\text{Var}(X)}

The standard deviation has the same units as XX, making it easier to interpret. It tells you the “typical” distance from the mean.

Properties of Variance

  1. Scaling: Var(aX)=a2Var(X)\text{Var}(aX) = a^2 \text{Var}(X)
  2. Shifting: Var(X+b)=Var(X)\text{Var}(X + b) = \text{Var}(X) (adding a constant doesn’t change spread)
  3. Sum of independent RVs: If XX and YY are independent, Var(X+Y)=Var(X)+Var(Y)\text{Var}(X + Y) = \text{Var}(X) + \text{Var}(Y)

Warning: Variance does NOT add for dependent random variables!

Example: Travel Speed Variance

For the travel example:

  • E[V]=100.5E[V] = 100.5
  • Var(V)=12(1−100.5)2+12(200−100.5)2≈10,000\text{Var}(V) = \frac{1}{2}(1 - 100.5)^2 + \frac{1}{2}(200 - 100.5)^2 \approx 10,000
  • σV≈100\sigma_V \approx 100 mph

The standard deviation tells us the “typical” distance from the mean—speeds are typically about 100 mph away from the average.


Conditional Expectation

Given an event AA with P(A)>0P(A) > 0:

E[X∣A]=∑xx⋅pX∣A(x)E[X | A] = \sum_x x \cdot p_{X|A}(x)

The conditional expectation is just an ordinary expectation in the “conditional universe” where we know AA occurred.

Example

If XX is uniform on {1,2,3,4}\{1, 2, 3, 4\} and we’re told X≥2X \geq 2:

E[X∣X≥2]=13(2+3+4)=3E[X | X \geq 2] = \frac{1}{3}(2 + 3 + 4) = 3


Key Terms

Expected ValueThe long-run average value of a random variable over many repetitions of an experiment.
VarianceThe expected squared deviation from the mean — measures how spread out a random variable is.
Standard DeviationThe square root of the variance — measures spread in the same units as the random variable.
Linearity of ExpectationE[aX + bY] = aE[X] + bE[Y] — expectation is always linear, even for dependent variables.
Conditional ExpectationThe expected value of a random variable given that another event or variable is known.