Basic Prerequisites: Mean–Variance from Zero.
1. Intuition & Practical Objective
This page builds the why of this whole topic with no optimization background beyond the one-line spec of Markowitz. The objective is one idea: the unconstrained mean–variance optimum is a mathematical point, not a tradeable portfolio. It short-sells, it levers, and - crucially - it sits far away from wherever you currently are, so reaching it is itself a large, costly bet. Constraints and transaction costs are not bureaucratic frictions bolted onto the theory; they are the difference between the answer and the implementable answer.
Start with the dumbest question: the optimizer says hold for six assets. What does a portfolio manager actually do with that?
Three “aha”s:
-
The number is not a portfolio. Those weights sum to but the gross exposure is - you are told to be levered, with a short in asset 1 financed by a long in asset 6. A balance-sheet limit, a long-only mandate, or a position cap kills this answer immediately. The optimizer never knew those rules existed because we never told it.
-
Reaching the optimum is a trade, and trades cost money. From an equal-weight book, hitting those unconstrained weights requires of notional - a one-way turnover. At a 10 bp all-in cost that is bp of return gone in one rebalance; at 50 bp it is bp. The strategy’s entire theoretical edge can be spent on the arbitrage of getting there.
-
Cost is not a haircut you apply afterwards - it belongs inside the objective. Because the cost term is , it has a kink at : a non-differentiable cusp. Optimizing a kinked objective creates a no-trade region - a band of current weights in which the optimal action is to do nothing at all, because the alpha gain does not clear the cost hurdle. The optimum of a cost-aware problem is frequently “hold what you own.” That is the single most practically important consequence in this folder.
The one-sentence essence. “A portfolio is the triple (signs you may hold, sizes you may hold, trades you may make); the unconstrained Markowitz optimum ignores all three, and adding them back turns the problem from a matrix inversion into a convex program whose answer is often to not trade.”
2. Mathematical Ground Truth & Derivations
The unconstrained problem and its closed form. With expected returns , covariance , risk-aversion and budget ,
The constrained problem (what you actually solve). Add the feasible set :
Long-only is ; a position cap is ; group/sector limits are the rows of . is a convex polytope and the resulting problem is a quadratic program (QP) - solvable in milliseconds at in the hundreds.
The turnover definition. With current weights , the trade is and turnover is the mass moved:
The cost-augmented objective. Transaction costs come in two families (developed in 03 · Transaction-Cost Models):
so the net optimization is
Why the kink matters (first principles). Consider one asset with mean , variance , risk-aversion and a linear cost per unit traded. The problem has first-order conditions that split into three cases:
i.e. a no-trade region of half-width around the frictionless target . The width scales linearly in the cost and inversely in risk-aversion and variance: cheap, volatile, high-conviction assets are re-traded; expensive, calm, low-conviction ones are left alone. 03 · Transaction-Cost Models confirms this numerically, and 04 turns the idea into a usable policy.
3. Computational Implementation - the unimplementable optimum, quantified
One universe, three answers: unconstrained, long-only, long-only capped at . For each we report gross exposure, the one-way turnover needed to get there from an equal-weight book, and the net-of-cost return at 10 bp and 50 bp. Runs on numpy + scipy.
Read the second and third blocks together. The unconstrained “optimum” is unattemptable twice over: (i) it is levered and short-sells an asset at , so no real mandate can hold it; (ii) even if your mandate allowed it, getting there costs of notional, which at 50 bp is bp of return - and note that the naive book’s crude gross-alpha of is a leveraged that is almost entirely a bet on the sample’s estimation error (see The Estimation-Error Problem). Clipping to the simplex collapses turnover to (one-way) and leaves a portfolio you could actually trade. Constraints here are not conservative - they are the only reason the answer exists.
4. Failure Modes & First-Principles Breakdowns
- “Constraints just cost me alpha.” They cost gross alpha and buy implementable alpha. §3 shows the cap-35% book with gross vs. the naive - but the naive number is levered and unattainable. Comparing a levered, short-saturated fantasy to a funded portfolio is the most common accounting error in portfolio construction.
- “I’ll optimize unconstrained, then clip.” Clipping after the fact is not the constrained optimum - the geometry changes what the middle weights should be. The correct procedure solves the QP with the box inside it; see 02 for how much the answer moves.
- “Costs are a rounding error.” At turnover, a 50 bp cost is bp of drag - larger than most strategies’ net alpha. Cost is first-order, not second-order, precisely because unconstrained optima are far away. This is the emotional core of the whole folder.
- The no-trade region feels like a bug. A beginner sees the optimizer return and thinks the code failed. It did not: the kinked cost term makes “do nothing” genuinely optimal below the hurdle . Non-differentiable objectives have interior flat spots; that is the point.
5. References
- Lobo, Fazel & Boyd (2007), Portfolio Optimization with Linear and Fixed Transaction Costs, Annals of Operations Research 152:341–365
- Grinold & Kahn (2000), Active Portfolio Management, 2nd ed.
- Clarke, de Silva & Thorley (2002), Portfolio Constraints and the Fundamental Law of Active Management, FAJ 58(5):48–66
- Almgren & Chriss (2000/01), Optimal Execution of Portfolio Transactions, Journal of Risk 3(2):5–39
- Hasbrouck (2007), Empirical Market Microstructure
6. Connected Graph Bridges
- Base: Mean–Variance from Zero · 05 · Estimation-Error Maximizers
- Foundations: Calculus & Optimization (convexity, KKT, the kink) · Statistics & Inference
- Execution sibling: Optimal Execution (Almgren–Chriss) · POV
- Microstructure source: Spread Decomposition & the Roll Model
- Continue: 02 · Weight Constraints · Index Hub