Lesson 89: Random Variables and Expected Value
A random variable is a numerical value associated with outcomes of a random experiment. Random variables can be discrete (finite/countable values) or continuous (any value in an interval). The expected value measures the long-run average outcome of a random variable.
Types of Random Variables
- Discrete Random Variable: Takes specific countable values (e.g., number of heads in 3 coin flips).
- Continuous Random Variable: Takes infinitely many values over an interval (e.g., height of a student, time until an event).
Expected Value
For a discrete random variable \(X\) with outcomes \(x_i\) and probabilities \(P(x_i)\), the expected value is:
\( E(X) = \sum [x_i \cdot P(x_i)] \)
For a continuous random variable with probability density function \(f(x)\):
\( E(X) = \int_{-\infty}^{\infty} x \cdot f(x) \, dx \)
Examples
Example 1 — Discrete:
Roll a fair die. Random variable \(X\) = outcome. Expected value: \( E(X) = (1+2+3+4+5+6)/6 = 21/6 = 3.5 \).
Example 2 — Lottery Game:
You play a game where you win \$10 with probability 0.3 and lose \$5 with probability 0.7. \( E(X) = (10)(0.3) + (-5)(0.7) = 3 - 3.5 = -0.5 \). On average, you lose 50 cents per game.
Example 3 — Continuous:
Suppose the time to complete a task follows a uniform distribution on [0, 2]. \( E(X) = (0+2)/2 = 1 \). On average, the task takes 1 unit of time.
Practice Problems
- A coin is flipped 3 times. Let \(X\) = number of heads. Find \(E(X)\).
- A random variable takes values 1, 2, 3 with probabilities 0.2, 0.5, 0.3. Find \(E(X)\).
- You win \$100 with probability 0.05, lose \$20 with probability 0.95. Find the expected value.
- Roll two dice. Let \(X\) = sum. Find \(E(X)\).
- A continuous random variable is uniformly distributed on [2, 6]. Find \(E(X)\).
