A random variable X assigns a number to each outcome. Its expected value, E[X], is the probability-weighted average of its possible values, the long-run average you would see if you could rerun the same random process forever. For a discrete X taking values x₁, …, xₙ with probabilities p₁, …, pₙ: E[X] = Σ pᵢxᵢ. Expectation is linear, and this fact does an enormous amount of work with almost no effort:
E[aX + b] = a·E[X] + b E[X + Y] = E[X] + E[Y] (always — even if X, Y are dependent)
How is variance calculated?
Variance measures spread around that average: Var(X) = E[(X − E[X])²], which algebraically simplifies to the computing formula Var(X) = E[X²] − (E[X])², square the values, average them, subtract the square of the mean. Standard deviation, SD(X) = √Var(X), restores the original units (a variance in "percent-squared" becomes a standard deviation back in percent). Variance is not linear the way expectation is:
Var(aX + b) = a²·Var(X)
- shifting by a constant b does not change spread at all (it only relocates the whole distribution), while scaling by a multiplies the variance by a², not by a, because variance is built from squared deviations.
Now the step that everything from a two-asset portfolio to a factor model rests on: what happens to variance when you add two random variables together? Unlike expectation, this is not simply Var(X) + Var(Y) unless X and Y happen to be uncorrelated:
Var(X + Y) = Var(X) + Var(Y) + 2·Cov(X, Y)
Advertisement
What are covariance and correlation?
Covariance, Cov(X, Y) = E[XY] − E[X]E[Y], measures whether X and Y move together (positive covariance), move oppositely (negative), or show no linear tendency either way (covariance near zero). Because covariance's units are awkward (X's units times Y's units), it is normalized into correlation:
ρ(X, Y) = Cov(X, Y) / (σ_X · σ_Y), always between −1 and +1 inclusive
A correlation of +1 means a perfect increasing linear relationship, −1 a perfect decreasing one, and 0 means no linear tendency, a point worth holding onto with both hands, because "zero correlation" is quietly misread as "no relationship at all" more often than almost any other statistical fact in finance (Common Mistakes, item 8, and Practice Problem 7 gives you the arithmetic to feel it directly).
How do you find a two-asset portfolio's variance?
Put the pieces together and you have, without any further theory, the exact formula a two-asset portfolio's risk is built from. If a portfolio holds weight w_A in asset A and w_B = 1 − w_A in asset B, its return is R_p = w_A·R_A + w_B·R_B, and by the rules above:
E[R_p] = w_A·E[R_A] + w_B·E[R_B]
Var(R_p) = w_A²·σ_A² + w_B²·σ_B² + 2·w_A·w_B·Cov(R_A, R_B)
This is as far as this module goes with it. AA1.01 is where you turn this exact expression into an efficient frontier by varying w_A across every possible weight and tracing the resulting (E[R_p], σ_p) pairs, and M3.02 is where the equity risk premium and CAPM's beta enter the picture, neither construction is repeated here, on purpose (R1). Worked Example 4 puts real numbers through the formula above so the mechanics are not abstract when you reach those modules.