5.5.3Portfolio Theory

Understand Markowitz mean-variance optimization

1,476 words7 min readdifficulty · medium1 backlinks

WHY does this exist?

Before Markowitz (1952), people picked "good stocks" one at a time. The problem: two stocks can each be risky, yet combined be calmer than either — because they don't move together. Ignoring how assets co-move (covariance) means you overpay in risk. Markowitz gave the first math that treats return and risk jointly and shows diversification is a free lunch (up to a limit).


WHAT are we measuring?


HOW: derive portfolio return and risk from scratch

Portfolio return is just the money-weighted average of the pieces. If you put fraction wiw_i in asset ii: Rp=iwiRiμp=E[Rp]=iwiμi=wμR_p = \sum_i w_i R_i \quad\Rightarrow\quad \mu_p = E[R_p] = \sum_i w_i \mu_i = \mathbf{w}^\top \boldsymbol{\mu} Why? Expectation is linear — no covariances appear in the mean.

Portfolio variance — derive for two assets, then generalize. σp2=Var(w1R1+w2R2)\sigma_p^2 = \text{Var}(w_1 R_1 + w_2 R_2) Use Var(aX+bY)=a2Var(X)+b2Var(Y)+2abCov(X,Y)\text{Var}(aX+bY) = a^2\text{Var}(X)+b^2\text{Var}(Y)+2ab\,\text{Cov}(X,Y): σp2=w12σ12+w22σ22+2w1w2σ12\boxed{\sigma_p^2 = w_1^2\sigma_1^2 + w_2^2\sigma_2^2 + 2w_1w_2\,\sigma_{12}} Why this step? The cross term 2w1w2σ122w_1w_2\sigma_{12} is the whole point: if σ12<0\sigma_{12}<0, it subtracts risk. That's diversification.

General nn-asset form (stacking into a covariance matrix Σ\Sigma): σp2=ijwiwjσij=wΣw\sigma_p^2 = \sum_i\sum_j w_i w_j \sigma_{ij} = \mathbf{w}^\top \Sigma\, \mathbf{w}


The optimization problem

HOW to solve (Lagrange, first principles)

Build the Lagrangian with multipliers λ,γ\lambda,\gamma: L=12wΣwλ(wμμ)γ(w11)L=\tfrac12\mathbf w^\top\Sigma\mathbf w-\lambda(\mathbf w^\top\boldsymbol\mu-\mu^*)-\gamma(\mathbf w^\top\mathbf 1-1) Set L/w=0\partial L/\partial \mathbf w = 0: Σwλμγ1=0  w=Σ1(λμ+γ1)\Sigma\mathbf w-\lambda\boldsymbol\mu-\gamma\mathbf 1=0 \ \Rightarrow\ \mathbf w^* = \Sigma^{-1}(\lambda\boldsymbol\mu+\gamma\mathbf 1) Why? The gradient of 12wΣw\tfrac12\mathbf w^\top\Sigma\mathbf w is Σw\Sigma\mathbf w; setting it against the constraint gradients gives the optimum. Solve the two constraints for λ,γ\lambda,\gamma. The set of all such w\mathbf w^* (over every μ\mu^*) traces a parabola in (σp2,μp)(\sigma_p^2,\mu_p) space — the minimum-variance frontier.

The upper half (higher return for same risk) is the efficient frontier. Its leftmost tip is the global minimum-variance portfolio.

Figure — Understand Markowitz mean-variance optimization

Worked example 1 — two assets, the diversification magic

Assets: μ1=8%,σ1=10%\mu_1=8\%,\sigma_1=10\%; μ2=12%,σ2=20%\mu_2=12\%,\sigma_2=20\%; correlation ρ=0\rho=0 so σ12=0\sigma_{12}=0. Try 50/50: w1=w2=0.5w_1=w_2=0.5.

  • μp=0.5(8)+0.5(12)=10%\mu_p=0.5(8)+0.5(12)=10\%. Why? Linear average of means.
  • σp2=0.25(100)+0.25(400)+0=125σp=11.18%\sigma_p^2 = 0.25(100)+0.25(400)+0 = 125 \Rightarrow \sigma_p=11.18\%.

Why remarkable? A naive average of the two risks would be 15%15\%. Because they're uncorrelated, real risk is only 11.18%11.18\%risk fell below the average for free.

Worked example 2 — find the min-variance weight (2 assets)

Minimize σp2=w2σ12+(1w)2σ22+2w(1w)σ12\sigma_p^2=w^2\sigma_1^2+(1-w)^2\sigma_2^2+2w(1-w)\sigma_{12}. Take d/dw=0d/dw=0: w=σ22σ12σ12+σ222σ12w^*=\frac{\sigma_2^2-\sigma_{12}}{\sigma_1^2+\sigma_2^2-2\sigma_{12}} Why this step? Differentiate, collect ww, solve linearly. With numbers above (σ12=0\sigma_{12}=0): w=4000100+4000=0.8w^* = \frac{400-0}{100+400-0}=0.8 So 80% in the safe asset gives the lowest-risk mix: σp2=0.64(100)+0.04(400)=80σp=8.94%\sigma_p^2=0.64(100)+0.04(400)=80\Rightarrow\sigma_p=8.94\% — lower than either asset's 10%10\% or 20%20\%!

Worked example 3 — negative correlation supercharges it

Same assets but ρ=1\rho=-1 (perfectly opposite), so σ12=ρσ1σ2=1(10)(20)=200\sigma_{12}=\rho\sigma_1\sigma_2 = -1(10)(20)=-200. w=400(200)100+4002(200)=600900=0.667w^*=\frac{400-(-200)}{100+400-2(-200)}=\frac{600}{900}=0.667 σp2=0.444(100)+0.111(400)+2(0.667)(0.333)(200)=44.4+44.488.8=0\sigma_p^2=0.444(100)+0.111(400)+2(0.667)(0.333)(-200)=44.4+44.4-88.8=0. Why zero? With perfect negative correlation you can fully cancel risk — a riskless portfolio from two risky assets.


Common mistakes (steel-manned)


Recall Feynman: explain to a 12-year-old

Imagine packing an ice-cream cart. Umbrellas sell on rainy days, ice cream on sunny days. Each alone is a gamble — bad weather ruins it. But sell both and you win every day: when one drops, the other rises. Markowitz just wrote the math for "mix things that don't fail at the same time," so your total earnings stay smooth. The best mixes — smoothest earnings for a chosen average profit — sit on a special curved line, and smart people only pick from that line.


Active recall

Portfolio expected return formula
μp=wμ=iwiμi\mu_p=\mathbf{w}^\top\boldsymbol\mu=\sum_i w_i\mu_i (linear in weights, no covariance).
Portfolio variance for 2 assets
σp2=w12σ12+w22σ22+2w1w2σ12\sigma_p^2=w_1^2\sigma_1^2+w_2^2\sigma_2^2+2w_1w_2\sigma_{12}.
Why does diversification reduce risk?
The cross term 2w1w2σ122w_1w_2\sigma_{12} can subtract risk when covariance is low/negative.
What is minimized in the Markowitz program?
Portfolio variance wΣw\mathbf w^\top\Sigma\mathbf w, subject to target return and weights summing to 1.
Min-variance weight (2 assets)
w=σ22σ12σ12+σ222σ12w^*=\dfrac{\sigma_2^2-\sigma_{12}}{\sigma_1^2+\sigma_2^2-2\sigma_{12}}.
Optimal weight vector from Lagrange
w=Σ1(λμ+γ1)\mathbf w^*=\Sigma^{-1}(\lambda\boldsymbol\mu+\gamma\mathbf 1).
Efficient frontier vs minimum-variance frontier
Efficient frontier = upper half (max return per risk); global min-var portfolio is its leftmost tip.
When can two risky assets form a riskless portfolio?
When ρ=1\rho=-1 (perfect negative correlation); then σp\sigma_p can equal 0.
Do standard deviations of assets add?
No — only if ρ=+1\rho=+1; generally σpwiσi\sigma_p\le\sum w_i\sigma_i.
Shape of frontier in (σ, μ) space
A hyperbola (parabola in variance), not a straight line.

Connections

Concept Map

ignores co-movement

assets zig vs zag

solved by

input to

weighted avg

combine assets

quadratic form

quadratic form

negative cross term

constraint

minimize

solve via

first order condition

defines

Pre-Markowitz stock picking

Overpay in risk

Covariance sigma ij

Diversification

Markowitz 1952

Covariance matrix Sigma

Expected returns mu

Portfolio return mu_p = w'mu

Weights w, sum=1

Portfolio variance sigma_p^2 = w'Sigma w

Optimization program

Lagrangian method

Optimal weights w* = Sigma-inverse of lambda mu + gamma 1

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, Markowitz ka core idea simple hai: kisi bhi stock ko akele mat judge karo — dekho wo poore portfolio ke risk ko kya karta hai. Do stock alag-alag risky ho sakte hain, par agar wo ulti direction mein move karte hain (negative covariance), to mix karke total risk kam ho jaata hai. Isko diversification kehte hain, aur yahi "free lunch" hai investing mein.

Formula yaad rakho: portfolio ka return to seedha weighted average hai (μp=wiμi\mu_p=\sum w_i\mu_i), lekin risk mein ek twist hai. Variance = "squares plus a cross" — har asset ka apna variance, aur ek cross term 2w1w2σ122w_1w_2\sigma_{12}. Yeh cross term hi magic hai: agar covariance negative hai to yeh risk ko minus kar deta hai. Isliye standard deviations kabhi seedhe add nahi hote.

Optimization ka game yeh hai: ek target return fix karo, aur us return ko dete hue minimum possible variance wala portfolio dhoondo. Sab aise best portfolios ko join karo to ek curve banti hai — efficient frontier. Smart investor sirf isi curve par baithta hai, kyunki uske neeche koi bhi point "wasteful risk" hai (utna hi return kam risk mein mil sakta tha).

Exam aur real life dono mein: agar do assets ka correlation 1-1 ho jaye, to tum poori tarah risk cancel karke riskless portfolio bana sakte ho — theoretically σp=0\sigma_p=0. Yahi baat proof karti hai ki covariance kitna powerful hai. Toh mantra: mix cheezein jo saath mein fail na hon.

Test yourself — Portfolio Theory

Connections