Expectation and Variance
Learn how to compute the expectation and variance of random variables in both discrete and continuous cases, with clear definitions and examples.
Two fundamental concepts in probability theory are expectation (mean) and variance.
- The expectation represents the “average value” of a random variable.
- The variance measures how much the values spread out around the expectation.
In this article, we explain how to compute them in both discrete and continuous settings, with simple examples.
Definition of Expectation
Discrete Case
If a random variable takes values with probabilities :
This is a weighted average.
Continuous Case
If has probability density function :
This is the average with respect to the density.
Definition of Variance
Variance is defined as the expectation of the squared deviation from the mean:
It can be rewritten in a more convenient form:
- : the expectation of the square
- : the square of the expectation
Example 1: A Die (Discrete Uniform Distribution)
Let be the outcome of a fair six-sided die ().
- Expectation:
- Variance:
Example 2: Uniform Distribution on [0,1] (Continuous)
Let be uniformly distributed on [0,1].
Its density is for .
- Expectation:
- Variance:
Summary
- Expectation is the average value of a random variable.
- Discrete:
- Continuous:
- Variance measures the spread around the expectation.
- Example: Die →
- Example: Uniform[0,1] →
Understanding expectation and variance deepens our grasp of how probability distributions are characterized. These quantities will keep appearing as we study specific distributions in more detail.
Interactive Expectation and Variance Demo
Fair Six-Sided Die
Calculations
Interpretation
- • Each outcome has probability 1/6
- • The red line shows the expected value (3.5)
- • This is the "center of gravity" of the distribution
- • Variance measures spread around the mean
- • Higher variance = more spread out values
Key Insights
- Discrete: Expectation is weighted average of possible values
- Continuous: Expectation is integral of x × density
- Variance: Always E[X²] - (E[X])² in both cases
- Units: Variance has units²; standard deviation has same units as X