Expected value and variance
▸ Pretest — guess, even if you don't know
A coin flip pays $1 if heads, $0 if tails. The flip is fair. What is the expected value of one flip?
Expected value (the first moment)
For a discrete random variable taking values with probabilities :
For a continuous random variable with density :
Concrete examples:
- Fair coin paying 0: .
- Daily SPY return historically: (about 7.5% annualized).
- An unfair die (face rolled with ): .
Linearity (this is huge)
Always. No matter whether and are independent, correlated, anything. Linearity of expectation is the most useful single fact in probability — it lets you compute expected portfolio returns as weighted sums of expected asset returns, even when the assets are correlated.
Variance (the second central moment)
The variance measures how spread out the distribution is:
where . The square is important — it weights large deviations more than small ones.
Standard deviation is just the square root: . Same information, but in the units of instead of . For daily SPY returns, (about 1.2% per day, or ~19% annualized).
Why squared, not absolute?
You might wonder: why measure spread with instead of (mean absolute deviation)? Three reasons:
- Mathematical convenience. The squared term is differentiable everywhere; the absolute value isn't. Variance plays nicely with calculus.
- CLT alignment. Variance is the parameter the normal distribution is defined in terms of.
- Portfolio math. Variance of a sum decomposes nicely: . Absolute deviations don't.
Modern quantitative work occasionally uses MAD or other robust scale measures, but variance is the default.
Annualization (a tiny piece of magic)
For independent daily returns: (252 trading days per year). Standard deviation scales as :
This is the source of the famous "multiply daily volatility by ~16 to annualize" rule. Returns being roughly independent across days is what makes this work — and it's the first assumption that breaks under volatility clustering.
Higher moments (briefly)
Two more moments come up:
- Skewness () — asymmetry. Negative skew means more weight in the left tail. Stock returns have slight negative skew.
- Kurtosis () — tail heaviness. Normal distribution has kurtosis 3. Daily stock returns have kurtosis often 5–10 (fat tails again).
We'll see these explicitly when we discuss risk decomposition later in the curriculum.
The single most important fact for trading
For correlated assets, the variance of a sum is NOT the sum of variances.
If and are positively correlated (most stocks are with each other), portfolio variance is larger than the simple sum. If negatively correlated, smaller. This is the math underneath diversification — and it's why portfolio construction is interesting.
We'll come back to this in Track D3 (Portfolio theory). For now: linearity is universal; variance is not.
Try it
Compute the first two moments of a discrete distribution — probability-weighted, not sample statistics:
Implement expected_value(outcomes, probs) = sum of outcome * probability, and variance(outcomes, probs) = sum of probability * (outcome - E)**2. These are the population formulas for a discrete distribution — do NOT use np.mean or np.var, which assume equal weights.
⧉ Review cardWhat is the formula for expected value of a continuous random variable?
⧉ Review cardWhat is linearity of expectation?
⧉ Review cardWhy is variance defined as E[(X-μ)²], not E[|X-μ|]?
⧉ Review cardHow do you annualize daily volatility?
⧉ Review cardWhat is Var(X + Y) when X and Y are correlated?
Predict before the next track
Tomorrow we shift to statistics (Track A2) — applying these probability concepts to data. Predict:
- If you have 30 days of returns and want to estimate the true mean return, how confident should you be that your sample mean is close to the true mean?
- What about with 30 years of data?
◈ Calibration check
Could you compute the expected value and variance of a simple two-outcome bet?
1 = guessing · 5 = could teach it
⏻ End of lesson
Mark it read to book its 5 review cards into your deck.
Sources & further reading
- bookWasserman (2004), All of Statistics — §3
- bookRoss (2014), Introduction to Probability Models, 11e — §2.3, 2.4
- bookTsay (2010), Analysis of Financial Time Series, 3e — §1.2