4.3 Optimisation in Practice: Constraints, Goals and LP
Real portfolios have rules — no short selling, weight caps, sector limits, loss limits, goals with deadlines. Writing those rules as linear inequalities turns portfolio choice into linear and quadratic programmes; this section solves them, reads their shadow prices, and shows why estimated inputs make 'optimal' weights fragile.
📍 The situation
Meera Menon, 38, a doctor in Kochi, and her husband have ₹11,00,000 to invest, and three things they want the money to do: keep a ₹2 lakh emergency fund ready at all times, provide ₹6 lakh for a house down payment in 5 years, and provide ₹12 lakh for their daughter's education in 12 years. Like the investors in §4.1 and §4.2 they work with three building blocks — an equity index fund, a debt fund and a gold fund — and they have rules of their own: no borrowing or short selling (mutual funds cannot be sold short anyway), at most 60% in equity, at least 25% in debt, at most 25% in gold, and "in a bad year we must not lose more than 10%".
Meera's brother-in-law built an optimiser in a spreadsheet using the formulas of §4.1. Its first answer told them to short the debt fund to reach a 12% expected return — impossible. When he forced all weights to be positive, the answer jumped to a corner. When he changed one expected return by a single percentage point, the "optimal" split between two similar large-cap funds moved by more than 50 points. Should they trust it? This section answers four questions: how to write rules like Meera's as linear constraints, turning portfolio choice into a linear programme (LP) or a quadratic programme (QP) — the operations-research side of finance; how to solve a two-variable LP by drawing it; how to plan several goals at once as one LP; and why optimisers amplify errors in their inputs, with simple robust alternatives (equal weights, risk parity) that need far fewer estimates.
All expected returns, volatilities, correlations, stress-scenario moves and "planning returns" on this page are illustrative assumptions chosen to make the arithmetic realistic — not historical data, forecasts or recommendations. The three building blocks use the same illustrative inputs as §4.1. People, funds and advisers are hypothetical, and nothing here is investment advice: an optimiser only turns your assumptions and rules into weights.
Constraints Turn Portfolio Theory into Optimisation Problems
In §4.1 the only rule was that the weights add up to 1, and Lagrange multipliers gave formulas for the minimum-variance portfolio and the frontier. Those formulas happily produce negative weights. Real investors face inequalities: a weight cannot be negative, cannot exceed a cap, a sector cannot exceed a limit. Inequalities cannot be handled by setting derivatives to zero, so we need the language of optimisation.
An optimisation problem has decision variables (here the weights $w=(w_1,\dots,w_n)$ or rupee amounts), an objective to minimise or maximise (variance, expected return, money needed today), and constraints — equations and inequalities the variables must satisfy.
- The feasible set (feasible region) is the set of all points satisfying every constraint; a problem with an empty feasible set is infeasible.
- An optimal solution is a feasible point whose objective value is at least as good as that of every other feasible point.
- At a given point an inequality $a^{\mathsf T}w\le h$ is binding (active) if $a^{\mathsf T}w=h$, and slack if $a^{\mathsf T}w\lt h$; the slack is $h-a^{\mathsf T}w\ge0$.
A linear programme optimises a linear objective $p^{\mathsf T}x=p_1x_1+\dots+p_nx_n$ subject to finitely many linear equations and inequalities, written compactly as $$Ax\le h,\qquad Cx=d.$$
A quadratic programme has the same kind of constraints but a quadratic objective, such as $x^{\mathsf T}Qx+p^{\mathsf T}x$. It is convex when $Q$ is positive semidefinite ($x^{\mathsf T}Qx\ge0$ for all $x$). A covariance matrix $\Sigma$ is always positive semidefinite, because $w^{\mathsf T}\Sigma w$ is a variance (§4.1).
Almost every rule an investor or a fund mandate imposes is linear in the weights. With $\mathbf 1=(1,\dots,1)^{\mathsf T}$:
| rule | constraint |
|---|---|
| fully invested (budget) | $\mathbf 1^{\mathsf T}w=1$ |
| no short selling (long-only) | $w_i\ge0$ for every $i$ |
| single-asset cap | $w_i\le u_i$ |
| sector limit (e.g. banks ≤ 35%) | $\sum_{i\in\text{banks}}w_i\le0.35$ |
| minimum holding (debt ≥ 25%) | $-w_{D}\le-0.25$ |
| target return | $\mu^{\mathsf T}w\ge m$ |
| stress-scenario loss ≤ $L$ | $-s^{\mathsf T}w\le L$, where $s$ lists each asset's return in the scenario |
| portfolio beta ≤ 1 (§4.2) | $\beta^{\mathsf T}w\le1$ |
Two common rules look non-linear but are not hard. A turnover limit $\sum_i|w_i-w_i^{0}|\le\tau$ (do not trade more than $\tau$ of the portfolio when moving from the current weights $w^0$) becomes linear with helper variables $t_i$: require $t_i\ge w_i-w_i^0$, $t_i\ge w_i^0-w_i$ and $\sum t_i\le\tau$. A tracking-error limit $(w-b)^{\mathsf T}\Sigma(w-b)\le\text{TE}^2$ against a benchmark $b$ is a convex quadratic constraint, which the same solvers handle.
Once the rules are linear, two problems cover most of practice. Minimising risk gives a QP; maximising expected return under linear risk limits gives an LP.
Let $F$ be the set of weights satisfying a list of linear constraints (budget, bounds $l\le w\le u$, $Aw\le h$, optionally $\mu^{\mathsf T}w\ge m$).
- Constrained minimum variance (QP): minimise $w^{\mathsf T}\Sigma w$ over $w\in F$.
- Constrained maximum return (LP): maximise $\mu^{\mathsf T}w$ over $w\in F$, where $F$ may include linear risk limits such as scenario losses.
The set $F$ is convex (it contains the segment between any two of its points) and $f(w)=w^{\mathsf T}\Sigma w$ is a convex function. Consequently every local minimum of the QP is a global minimum, and if $\Sigma$ is positive definite and $F$ is non-empty and bounded, the minimiser exists and is unique.
Why. If $w,w'\in F$ and $0\le\theta\le1$, then $A(\theta w+(1-\theta)w')$ $=\theta Aw+(1-\theta)Aw'$ $\le\theta h+(1-\theta)h=h$, and the same works for every other linear constraint, so $F$ is convex. For convexity of $f$, expand the product to check the identity $$\theta f(w)+(1-\theta)f(w')-f(\theta w+(1-\theta)w')$$ $$=\theta(1-\theta)\,(w-w')^{\mathsf T}\Sigma(w-w'),$$ whose right side is $\ge0$ because $\Sigma$ is positive semidefinite. Now suppose $w$ were a local minimum but some $w'\in F$ had $f(w')\lt f(w)$. Points $\theta w+(1-\theta)w'$ with $\theta$ close to 1 lie in $F$, arbitrarily close to $w$, and by convexity have $f\le\theta f(w)+(1-\theta)f(w')\lt f(w)$ — contradicting local minimality. A minimiser exists because a continuous function on a closed bounded set attains its minimum. If $\Sigma$ is positive definite and $w\ne w'$ were two minimisers, the identity with $\theta=\tfrac12$ would make the midpoint strictly better. ∎
So a solver (Excel Solver, Python's scipy) that finds a local minimum of a constrained variance problem has found the minimum. How can we recognise it by hand? Write $(\Sigma w)_i=\tfrac12\,\partial\sigma_p^2/\partial w_i$ for the marginal risk of asset $i$ — how fast the variance rises when a little more money goes into asset $i$. (It is the quantity behind the risk contributions of §4.1.)
Consider minimising $w^{\mathsf T}\Sigma w$ subject to $\mathbf 1^{\mathsf T}w=1$ and $l_i\le w_i\le u_i$ (e.g. $l_i=0$ for long-only). A feasible $w$ is optimal if and only if there is a number $\kappa$ such that
- $(\Sigma w)_i=\kappa$ for every asset strictly between its bounds;
- $(\Sigma w)_i\ge\kappa$ for every asset at its lower bound;
- $(\Sigma w)_i\le\kappa$ for every asset at its upper bound.
In words: all "free" assets have the same marginal risk; an asset held at zero is too risky at the margin to add; an asset held at its cap would be worth adding if the cap allowed. With no bound binding this is the condition $\Sigma w=\kappa\mathbf 1$ of the minimum-variance portfolio in §4.1, and then $\sigma_p^2=\kappa$.
Proof. Necessity. Take an asset $j$ that can still be increased ($w_j\lt u_j$) and an asset $k$ that can still be decreased ($w_k\gt l_k$), and move a small amount $\varepsilon\gt0$ from $k$ to $j$: $w(\varepsilon)=w+\varepsilon(e_j-e_k)$ stays feasible. Then $$f(w(\varepsilon))=f(w)+2\varepsilon\big[(\Sigma w)_j-(\Sigma w)_k\big]+\varepsilon^2(\dots).$$ If $(\Sigma w)_j\lt(\Sigma w)_k$ the variance falls for small $\varepsilon$, so at an optimum every increasable asset has marginal risk $\ge$ every decreasable one. Pick $\kappa$ between the largest marginal risk among decreasable assets and the smallest among increasable ones. A free asset is both increasable and decreasable, so its marginal risk is squeezed to equal $\kappa$; assets at a lower bound are increasable, hence $\ge\kappa$; assets at an upper bound are decreasable, hence $\le\kappa$. Sufficiency. For any feasible $w'$ put $d=w'-w$, so $\sum_id_i=0$. From the expansion $f(w')=f(w)+2(\Sigma w)^{\mathsf T}d+d^{\mathsf T}\Sigma d$ $\ge f(w)+2(\Sigma w)^{\mathsf T}d$ and $$(\Sigma w)^{\mathsf T}d=\sum_i\big[(\Sigma w)_i-\kappa\big]d_i\ge0,$$ because each term is $0$ (free asset), or a product of two numbers $\ge0$ (lower bound: $d_i\ge0$), or of two numbers $\le0$ (upper bound: $d_i\le0$). Hence $f(w')\ge f(w)$. ∎
Graphical LP: Two Decision Variables
A variance objective is curved; but some investors express risk through stress scenarios instead — "if this bad year happens, how much do we lose?" A scenario loss is linear in the weights, so maximising expected return under scenario limits is an LP. With three funds and the budget $w_E+w_G+w_D=1$, only two weights are free: write $x=w_E$ (equity), $y=w_G$ (gold), and let debt be the rest, $w_D=1-x-y$. A problem in two variables can be drawn.
Meera's rules, with two illustrative stress scenarios:
| scenario (illustrative) | equity | debt | gold |
|---|---|---|---|
| S1 — equity crash | −30% | 0% | +10% |
| S2 — rate shock and gold slump | −10% | −5% | −20% |
In S1 the portfolio returns $-0.30x+0.10y+0\cdot(1-x-y)$; requiring a loss of at most $L=10\%$ gives $0.30x-0.10y\le0.10$, i.e. $3x-y\le1$. In S2 it returns $-0.10x-0.20y-0.05(1-x-y)$ $=-0.05-0.05x-0.15y$; a loss of at most 10% gives $0.05x+0.15y\le0.05$, i.e. $x+3y\le1$. With the caps (equity ≤ 60%, gold ≤ 25%, debt ≥ 25%, i.e. $x+y\le0.75$) and $x,y\ge0$, the problem is
$$\max\ \ \mu_p=0.07+0.05x+0.02y$$
subject to S1: $3x-y\le1$; S2: $x+3y\le1$; caps: $x\le0.6$, $y\le0.25$, $x+y\le0.75$; and $x,y\ge0$. Here $\mu_p=0.12x+0.09y+0.07(1-x-y)$: each unit of equity adds $12-7=5$ points of expected return over debt, each unit of gold adds 2.
Let an LP maximise $p^{\mathsf T}x$ over a feasible set $F$ defined by finitely many linear inequalities $n_k^{\mathsf T}x\le h_k$.
- If $F$ is non-empty and bounded, a maximum exists and is attained at a corner (vertex) of $F$.
- If two adjacent corners are both optimal, so is every point of the edge between them.
- In two variables, at a corner where exactly two constraints with normals $n_1,n_2$ bind, the corner is optimal if $$p=a\,n_1+b\,n_2\quad\text{with}\quad a\ge0,\ b\ge0,$$ i.e. if the objective direction lies between the two normals. Then raising $h_1$ by a small $\delta$ raises the optimal value by $a\delta$, and raising $h_2$ by $\delta$ raises it by $b\delta$.
Why. (1) A bounded feasible set of this kind is a convex polygon (in higher dimensions a polytope), and each of its points is a weighted average $x=\sum_j\theta_jv_j$ of its corners $v_j$, with $\theta_j\ge0$, $\sum_j\theta_j=1$. Then $p^{\mathsf T}x=\sum_j\theta_j\,p^{\mathsf T}v_j\le\max_jp^{\mathsf T}v_j$: no point beats the best corner. (2) Along an edge the objective is a linear function of position, so if it takes its maximum at both ends it is constant in between. (3) For any feasible $x$, $n_1^{\mathsf T}x\le h_1$ and $n_2^{\mathsf T}x\le h_2$, so $$p^{\mathsf T}x=a\,n_1^{\mathsf T}x+b\,n_2^{\mathsf T}x\le a h_1+b h_2,$$ and the corner $x^\ast$, where both bind, achieves exactly $ah_1+bh_2$. If $h_1$ rises by a small $\delta$, the corner slides along the second line but the same two constraints still bind, so the optimum becomes $a(h_1+\delta)+bh_2$. ∎
The shadow price (dual value) of a constraint is the rate at which the optimal objective value improves per unit increase in that constraint's right-hand side, all other data fixed. A slack constraint has shadow price $0$. A shadow price is valid only over the range of right-hand sides for which the same constraints stay binding; beyond it the optimal corner changes and so does the price.
- Choose the two decision variables and write every rule as a linear inequality in them (eliminate the third weight with the budget).
- Draw each boundary line; test a point such as $(0,0)$ to see which side is allowed. The feasible region is the intersection of all allowed sides — a convex polygon (or empty: the rules conflict).
- Find the corners by solving pairs of boundary equations, keeping only intersections that satisfy all constraints.
- Evaluate the objective at each corner (or slide a line of constant objective, an iso-return line, across the region until it last touches it). The best corner is optimal (Theorem 4.17).
- Read off the binding constraints, then do the sensitivity analysis: how far can an objective coefficient move before the optimal corner changes, and what is each binding constraint's shadow price?
Goal-Based Allocation as a Linear Programme
Meera does not really want "the best portfolio"; she wants three goals funded. Goal-based planning splits the money into buckets, one per goal, each invested according to its horizon. The question "how much money do we need today, and how should each bucket be invested?" is again an LP.
For goals $g=1,\dots,G$ with target $G_g$ (in future rupees, already inflated as in §1.1) due in $T_g$ years, let $x_{g,a}\ge0$ be the rupees invested today in asset $a$ for goal $g$. Each asset has a planning return $c_a$ — a deliberately prudent annual return used for planning, below the expected return — and a per-goal cap $s_{g,a}$ on its share of the bucket (e.g. at most 30% equity for a 5-year goal).
Assuming each bucket is bought and held, bucket $g$ is worth $\sum_ax_{g,a}(1+c_a)^{T_g}$ at its deadline. Its growth factor per rupee is the weighted average $\sum_as_a(1+c_a)^{T_g}$ of the asset growth factors, with $s_a$ the shares in the bucket.
(a) One goal. With caps $s_{a}\le\bar s_{a}$ on the shares, the money needed today is $$x^\ast=\frac{G}{\max_s\sum_as_a(1+c_a)^{T}},$$ and the maximum is reached by filling the asset with the highest planning return up to its cap, then the next, and so on.
(b) Several goals. Minimise the total $\sum_{g,a}x_{g,a}$ subject to, for every goal, $$\sum_ax_{g,a}(1+c_a)^{T_g}\ge G_g,\qquad x_{g,a}\le\bar s_{g,a}\sum_{a'}x_{g,a'},$$ plus any rules that couple the buckets, such as an overall equity limit $\sum_gx_{g,E}\le e\sum_{g,a}x_{g,a}$ or a budget $\sum_{g,a}x_{g,a}\le B$. Every constraint is linear in the $x_{g,a}$, so this is an LP.
Without coupling rules, (b) splits into separate one-goal problems (a). With coupling, the LP decides which goal gives up equity first.
Why (a). A bucket with shares $s_a$ grows by the factor $\sum_as_a(1+c_a)^T$, so the amount needed is $G$ divided by that factor, and we want the largest factor. It is a weighted average of the numbers $(1+c_a)^T$ with weights limited by the caps — like filling a bag with the most valuable item first: any rupee moved from a lower-factor asset to a higher-factor asset with room under its cap raises the average. In (b) each constraint is a sum of constants times variables, which is linear; the cap $x_{g,a}\le\bar s_{g,a}\sum_{a'}x_{g,a'}$ becomes linear once written as $x_{g,a}-\bar s_{g,a}\sum_{a'}x_{g,a'}\le0$. ∎
Data (illustrative). Budget ₹11,00,000. Goals: emergency fund ₹2,00,000 now (liquid fund only, counted at today's value); down payment ₹6,00,000 in 5 years (equity ≤ 30% of the bucket); education ₹12,00,000 in 12 years (equity ≤ 70%). Planning returns: equity 9%, debt 6.5%. Household rule: equity at most 40% of everything invested.
- Variables (₹ today): $x_{1}=2{,}00{,}000$ in the liquid fund; $x_{2E},x_{2D}$ for the down payment; $x_{3E},x_{3D}$ for education.
- Constraints. Goals: $1.53862\,x_{2E}+1.37009\,x_{2D}\ge6{,}00{,}000$ and $2.81266\,x_{3E}+2.12910\,x_{3D}\ge12{,}00{,}000$ (using $1.09^{12}\approx2.81266$, $1.065^{12}\approx2.12910$). Bucket caps: $0.7x_{2E}-0.3x_{2D}\le0$, $\ 0.3x_{3E}-0.7x_{3D}\le0$. Overall equity: $x_{2E}+x_{3E}\le0.4\,X$ with total $X=x_1+x_{2E}+x_{2D}+x_{3E}+x_{3D}$. Objective: minimise the total.
- Without the overall rule the buckets separate (Theorem 4.18): down payment ₹4,22,343 (Example 5); education factor $0.7(2.81266)+0.3(2.12910)\approx2.60759$, so ₹4,60,194 (₹3,22,136 equity, ₹1,38,058 debt). Total ₹10,82,537, of which equity is ₹4,48,839 = 41.5% — the household rule is violated.
- With the rule a solver (Excel Solver "Simplex LP", or
scipy.optimize.linprog) returns: education unchanged; down payment equity cut to ₹1,11,621 and debt raised to ₹3,12,577. Total ₹10,84,392, equity exactly 40%. The rule costs ₹1,855. - Which goal gives up equity, and why? Replacing ₹1 of equity by enough debt to keep the goal's future value costs an extra $1.53862/1.37009-1\approx12.3\%$ in the 5-year bucket but $2.81266/2.12910-1\approx32.1\%$ in the 12-year bucket. The LP takes equity from where it is cheapest to remove — the short-horizon goal — exactly the intuition behind horizon-based investing.
- Tighter rules. Equity ≤ 35%: ₹10,90,786; ≤ 30%: ₹10,97,257 (down-payment equity almost zero). All fit the ₹11 lakh budget.
- Sensitivity to the planning return. With equity planned at 8% instead of 9% (40% rule kept), the plan needs ₹11,30,217 — more than the budget; at 10% it needs ₹10,40,091. One point of assumed return moves the answer by about ₹45,000, roughly three times the ₹15,608 margin left by the 9% plan.
| plan (₹ today) | liquid | down pmt E / D | education E / D | total |
|---|---|---|---|---|
| no overall rule | 2,00,000 | 1,26,703 / 2,95,640 | 3,22,136 / 1,38,058 | 10,82,537 |
| equity ≤ 40% | 2,00,000 | 1,11,621 / 3,12,577 | 3,22,136 / 1,38,058 | 10,84,392 |
| equity ≤ 30% | 2,00,000 | 7,041 / 4,30,021 | 3,22,136 / 1,38,058 | 10,97,257 |
| ≤ 40%, equity planned at 8% | 2,00,000 | 1,02,298 / 3,28,221 | 3,49,789 / 1,49,910 | 11,30,217 |
What they learn. The LP turns a vague worry ("are we saving enough?") into a precise statement: under these planning returns and rules, the goals cost ₹10.84 lakh today and leave a thin margin. The margin vanishes if equity is planned one point lower — so before relying on the plan they should test it with simulated returns (§3.3), add a monthly SIP, or relax a goal. A deterministic LP is the first draft of a goal plan, not the last word; §8.1 builds full plans with withdrawals and uncertainty.
Estimation Error and Robust Choices
Every optimiser in this chapter needs inputs: expected returns $\mu$, volatilities and correlations. None of them is known; they are estimated, usually from a few years of past data, and expected returns are by far the hardest to estimate. The standard error of a mean annual return estimated from $T$ years of data is about $\sigma/\sqrt T$ (§3.1): with a volatility of 18% and ten years of data that is $5.7\%$ — larger than the differences between funds that optimisers act on. And sampling more often (daily instead of yearly) does not help: the precision of an estimated mean depends on the length of the period covered, not on the number of observations in it. To see how such errors reach the weights, study two assets and the mean–variance objective of §4.2, the certainty equivalent $\text{CE}(w)=\mu_p-\tfrac{\lambda}{2}\sigma_p^2$ with risk aversion $\lambda\gt0$.
Two risky assets with weight $w$ in asset 1, volatilities $\sigma_1,\sigma_2$, correlation $\rho$, and $V=\sigma_1^2+\sigma_2^2-2\rho\sigma_1\sigma_2=\operatorname{Var}(r_1-r_2)\gt0$. The weight that maximises $\text{CE}(w)$ is $$w^\ast=w_{\text{GMV}}+\frac{\mu_1-\mu_2}{\lambda V},\qquad w_{\text{GMV}}=\frac{\sigma_2^2-\rho\sigma_1\sigma_2}{V},$$ and the long-only optimum is $w^\ast$ clipped to $[0,1]$. Hence
- a change of $\Delta$ in the estimated return gap $\mu_1-\mu_2$ moves the optimal weight by $\Delta/(\lambda V)$;
- if the gap is estimated by the average of $T$ independent annual return differences, the estimated optimal weight has standard deviation $$\operatorname{sd}(\hat w^\ast)=\frac{1}{\lambda\sqrt{VT}}\quad\text{(before clipping).}$$
Similar assets (high $\rho$, similar $\sigma$) have small $V$, so their optimal weights are the most sensitive.
Derivation. Expanding the two-asset variance of §4.1 in powers of $w$, $$\text{CE}(w)=\mu_2+w(\mu_1-\mu_2)-\tfrac{\lambda}{2}\sigma_p^2,$$ $$\sigma_p^2=\sigma_2^2+2w(\rho\sigma_1\sigma_2-\sigma_2^2)+w^2V.$$ This is a downward parabola in $w$ (the coefficient of $w^2$ is $-\lambda V/2\lt0$). Setting the derivative to zero: $(\mu_1-\mu_2)-\lambda(\rho\sigma_1\sigma_2-\sigma_2^2)-\lambda Vw=0$, which rearranges to the formula; $w_{\text{GMV}}$ is the two-asset minimum-variance weight of §4.1. On $[0,1]$ a downward parabola is maximised at its vertex if the vertex lies inside, otherwise at the nearer end — hence the clipping. The formula is linear in the gap with slope $1/(\lambda V)$, giving (1). For (2), the average of $T$ independent differences $r_1-r_2$, each with variance $V$, has variance $V/T$; multiplying by the slope gives standard deviation $\sqrt{V/T}/(\lambda V)=1/(\lambda\sqrt{VT})$. ∎
If estimates are this noisy, a sensible investor uses rules that need fewer of them. Three such rules are widely used.
- Equal weight ("$1/N$"): $w_i=1/N$. It needs no estimates at all.
- Inverse volatility: $w_i=\dfrac{1/\sigma_i}{\sum_j1/\sigma_j}$. It needs only the volatilities.
- Risk parity (equal risk contribution): the long-only portfolio whose risk contributions $RC_i=w_i(\Sigma w)_i/\sigma_p$ (§4.1) are all equal, so each asset supplies $1/N$ of the portfolio's risk. It needs volatilities and correlations but no expected returns.
Other robust devices: weight caps (they stop the optimiser from betting everything on noise), and shrinking estimated expected returns toward a common value before optimising, which pulls the weights toward the minimum-variance portfolio (which does not depend on $\mu$ at all).
- For two assets with positive weights and any correlation $-1\lt\rho\lt1$, the risk contributions are equal if and only if $w_1\sigma_1=w_2\sigma_2$, i.e. $$w_1=\frac{\sigma_2}{\sigma_1+\sigma_2}.$$
- For $N$ assets with a common pairwise correlation $\rho$, $0\le\rho\lt1$, the long-only risk-parity portfolio is exactly the inverse-volatility portfolio.
Proof. (1) With $\sigma_{12}=\rho\sigma_1\sigma_2$, $\sigma_pRC_1=w_1(w_1\sigma_1^2+w_2\sigma_{12})$ and $\sigma_pRC_2=w_2(w_2\sigma_2^2+w_1\sigma_{12})$. The cross terms $w_1w_2\sigma_{12}$ are identical, so $RC_1=RC_2$ $\iff w_1^2\sigma_1^2=w_2^2\sigma_2^2$ $\iff w_1\sigma_1=w_2\sigma_2$ (both positive). With $w_1+w_2=1$ this gives the formula. (2) Put $z_i=w_i\sigma_i\gt0$ and $S=\sum_jz_j$. Then $(\Sigma w)_i=w_i\sigma_i^2+\rho\sigma_i\sum_{j\ne i}w_j\sigma_j$ $=\sigma_i\big[(1-\rho)z_i+\rho S\big]$, so $$\sigma_pRC_i=z_i\big[(1-\rho)z_i+\rho S\big].$$ For fixed $S$ the function $z\mapsto z[(1-\rho)z+\rho S]$ is strictly increasing for $z\gt0$ (when $0\le\rho\lt1$), so all $RC_i$ are equal exactly when all $z_i=w_i\sigma_i$ are equal — that is, $w_i\propto1/\sigma_i$. ∎
| portfolio | E / D / G weights | return | vol | risk shares E / D / G |
|---|---|---|---|---|
| equal weight | 33.3 / 33.3 / 33.3 | 9.33% | 8.85% | 59.6 / 7.5 / 33.0 |
| inverse vol | 15.8 / 63.2 / 21.1 | 8.21% | 5.99% | 33.3 / 36.1 / 30.6 |
| risk parity | 16.2 / 61.3 / 22.5 | 8.26% | 6.11% | 33.3 / 33.3 / 33.3 |
| minimum variance | 1.3 / 91.2 / 7.5 | 7.22% | 4.86% | 1.3 / 91.2 / 7.5 |
- "The optimiser found the best portfolio." It found the best portfolio for the inputs it was given. Because it overweights whatever looks best, it systematically overweights the assets whose expected returns were overestimated — optimisers are sometimes called "error maximisers" (Example 6, Interactive 2).
- "Maximising expected return under a few rules gives a diversified portfolio." An LP's optimum sits at a corner, typically with as many assets at their limits as the rules allow. Without risk constraints it puts everything in the asset with the highest forecast.
- "Adding constraints can only hurt." On paper, with the inputs taken as true, yes: the optimum can only get worse. With estimated inputs, sensible caps often improve real results because they stop the optimiser from acting on noise.
- "Ten years of daily data pin down the expected return." No — the standard error of the mean is about $\sigma/\sqrt{T}$ with $T$ in years, however often you sample. Volatilities and correlations, in contrast, are estimated much better from frequent data.
- "Risk parity means equal amounts in each asset." It means equal risk contributions; equal amounts let the most volatile asset dominate (Example 7).
- "Infeasible means the software is broken." It usually means the rules contradict each other — e.g. a loss limit below 5% in Example 3, when the all-debt portfolio already loses 5% in scenario S2.
- "A shadow price holds for any change." Only while the same constraints bind (Example 4: 0.35 up to $L=11\%$, then 0.167).
- "A goal plan built with expected returns is safe." Use prudent planning returns, then test the plan with simulated returns; the Market case shows one point of assumed return can erase the margin.
Exercises
Unless stated otherwise use the illustrative §4.1 inputs for equity (E), debt (D) and gold (G): $\mu=(12\%,7\%,9\%)$, $\sigma=(20\%,5\%,15\%)$, $\rho_{ED}=0.2$, $\rho_{EG}=0$, $\rho_{DG}=0.1$. Give weights to one decimal place of a percent.
- 1 A five-stock portfolio holds two banks ($w_1,w_2$), two IT companies ($w_3,w_4$) and one consumer-goods company ($w_5$). Rules: fully invested, long-only, each stock at most 30%, banks at most 40%, IT at least 15%, consumer goods at most 25%. Write all the constraints.
- 2 Is $w=(25,20,10,25,20)\%$ feasible for part 1? If not, repair it with one trade.
- 3 Show that if two portfolios both satisfy the rules of part 1, so does any mix $\theta w+(1-\theta)w'$, $0\le\theta\le1$.
- 4 The unconstrained 11% frontier portfolio is about $(61.2\%,\ -8.3\%,\ 47.1\%)$ with volatility $14.04\%$. A solver says the long-only 11% portfolio of least risk is $(66.7\%,\ 0,\ 33.3\%)$. Verify its return and volatility and state the cost of the no-short rule.
- 5 Find the long-only minimum-variance portfolio when gold is capped at 5%, and verify it with Theorem 4.16.
- 6 Maximise expected return with only the budget, long-only and "each fund at most 50%". What is the answer, its volatility, and why does it have this shape?
- 7 Explain why a constrained minimum-variance problem with positive definite $\Sigma$ has one answer, while an LP can have infinitely many. Give the geometric reason.
- 1 List the corners of the feasible region and the expected return at each.
- 2 With loss limit $L=8\%$ in both scenarios, find the optimal mix and its expected return.
- 3 With $L=12\%$, find the optimal mix, its expected return and the binding constraints. What is the shadow price of $L$ now?
- 4 Show that for $L\lt5\%$ the problem is infeasible. Interpret.
- 5 Keep $L=10\%$ but lower equity's expected return to 7.5%. Find the new optimum.
- 6 A saver has ₹5 lakh: $x$ lakh in an equity fund (expected 11%), $y$ lakh in a debt fund (7%), the rest in a savings account (3%). Rules: $x+y\le5$, $x\le2$, and in a crash (equity −25%, debt −5%, savings 0%) the loss must not exceed ₹60,000. Maximise the expected gain.
- 7 Find expected returns for equity and gold (debt stays 7%) for which every point of the edge from $(0.4,0.2)$ to $(0.25,0.25)$ is optimal.
- 1 A goal of ₹10,00,000 in 8 years allows at most 50% equity. How much is needed today, and how is it split?
- 2 How much would the goal in part 1 need if held entirely in debt? How much does the equity share save?
- 3 Write the LP (variables, objective, constraints) for two goals — ₹4 lakh in 3 years (equity ≤ 20%) and ₹20 lakh in 15 years (equity ≤ 80%) — with an overall equity limit of 50%.
- 4 In the Market case, lowering the overall equity limit from 40% to 30% raises the cost from ₹10,84,392 to ₹10,97,257. Which bucket changes and why?
- 5 Suppose the Menons have only ₹10,00,000. The emergency fund must be fully funded; they want the largest common fraction $t$ of the other two goals that can be guaranteed at the planning returns (40% overall equity rule kept). Formulate this as an LP. A solver gives $t\approx0.906$; interpret.
- 6 Why should planning returns be lower than expected returns, and what does a deterministic goal LP leave out?
- 1 A fund's annual volatility is 16%. What is the standard error of its mean annual return estimated from 25 years of data? Give an approximate 95% range around an estimate of 12%.
- 2 Two funds each have volatility 15% and correlation 0.8; $\lambda=4$. By how much does the optimal weight move per percentage point of estimated return gap?
- 3 In part 2 the gap is estimated from 20 years of data. Find the standard deviation of the estimated optimal weight.
- 4 Compute the inverse-volatility weights for equity, debt and gold and the resulting risk shares, $(33.3,\ 36.1,\ 30.6)\%$ — verify the equity share.
- 5 Show that in a two-asset risk-parity portfolio an asset with twice the volatility of the other gets one third of the money, whatever the correlation.
- 6 For the equal-weight E/D/G mix, show that equity supplies about 60% of the risk.
- 7 In Example 6, shrink the estimated gap halfway toward zero before optimising. What weight results? What happens with full shrinkage?
- 8 Prove that in the (unconstrained) minimum-variance portfolio each asset's share of risk equals its weight.
E1. NISM-style A portfolio manager maximises expected return subject to several linear limits, and the feasible region is non-empty and bounded. The optimal portfolio is found (A) at the centre of the feasible region (B) at a corner point of the feasible region (C) only where every constraint is binding (D) only if the objective is quadratic.
E2. NISM-style A two-asset portfolio holds an equity fund with volatility 20% and a debt fund with volatility 5%, weighted so that each contributes equally to risk. The weight of the debt fund is (A) 20% (B) 50% (C) 75% (D) 80%.
E3. NISM-style A fund's returns have annual volatility 20%. Using 16 years of history, the standard error of its estimated average annual return is about (A) 1.25% (B) 5% (C) 0.31% (D) 20%.
E4. Case study A hypothetical trust has ₹10 lakh. It may put $x$ lakh in an equity fund (expected 12%) and $y$ lakh in a bond fund (expected 7.5%), keeping the rest in a savings account (3%). Rules: $x+y\le10$; at most ₹8 lakh in the bond fund (a credit-risk limit); in a stress scenario (equity −30%, bond fund −5%, savings 0%) the loss must not exceed ₹1.4 lakh. (a) Formulate and solve the LP. (b) Which constraints bind? (c) Find the shadow price of the stress limit and check it by raising the limit to ₹1.5 lakh. (d) Over what range of the bond fund's expected return does the optimal mix stay the same, and what happens at 3.5%?
E5. Case study A model-portfolio team mixes an equity fund (volatility 18%) and a debt fund (6%), correlation 0.1, and uses $\lambda=4$. (a) Find the minimum-variance weight in equity and its volatility. (b) Find the risk-parity weight and the volatility of 50/50 and of risk parity. (c) An analyst estimates the expected-return gap at 5%; another at 3%. Find both mean–variance weights. (d) Compare the sensitivity with Example 6 and explain the difference.
E6. Interview Two assets have the same volatility $\sigma$ and correlation $\rho\lt1$. Without long algebra: what are the minimum-variance and risk-parity portfolios? Then: with $\sigma=20\%$ and $\lambda=4$, how many points of weight does a 1-point difference in expected returns move when $\rho=0.8$, and when $\rho=0.95$?
Suggested plan — 2 lectures × 60 min.
- Constraints and LP. Start from the §4.1 frontier that shorts debt for a 12% target and ask "what would you do with this answer?" Translate Meera's rules into inequalities (Definitions 4.10–4.11, Example 1). State Theorem 4.15 and do Example 2 on the board with Theorem 4.16's "equal marginal risk" test. Then build the stress-scenario LP, find the corners by hand (Example 3) and project Interactive 1: play the iso-return line, then drag $L$ through 6% and 11% and the equity return below 7.67% to show the shadow price and the corner jumps (Example 4).
- Goals and robustness. Goal buckets and Theorem 4.18 with Example 5; walk through the 📈 Market case, letting students guess which bucket loses equity before revealing it. Then estimation error: Theorem 4.19 and Example 6; project Interactive 2 with $\rho=0.9$, $T=10$, then raise $T$ to 60 and lower $\rho$ to 0. Close with risk parity (Definition 4.14, Theorem 4.20, Example 7) and the ⚠️ box.
Class activity. Give each group the E/D/G inputs but a different "estimate" of equity's expected return (10%, 11%, 12%, 13%, 14%). Each group computes its long-only maximum-CE mix with $\lambda=3$ in a spreadsheet. Put the answers side by side, then compute everyone's risk-parity portfolio — the same for all groups.
Discussion questions. (1) Is a sector cap a statement about risk or about ignorance? (2) Why might a regulator prefer simple rules (caps) to a regulated optimiser? (3) Should a goal plan use the same planning return for every horizon?
Misconceptions to watch for. Treating optimiser output as a forecast; expecting LP answers to change smoothly; assuming more frequent data fixes expected-return estimates; confusing equal weight with equal risk; reading a shadow price outside its range.
Suggested homework. I(1, 2, 5, 6), II(1, 2, 4, 6), III(1, 2, 4), IV(1, 2, 5, 8); Practice corner E2, E4, E5.
Project. Build a constrained optimiser for three funds with Excel Solver (or Python), solve a goal LP, and then measure how unstable the optimiser's answer is when its inputs are re-estimated from resampled data.
Why it matters. Every robo-adviser and model portfolio runs some version of these problems. Building one yourself shows both how easy it is to get an answer and how hard it is to get a trustworthy one.
What to do.
- QP. Weights in B2:B4, expected returns in C2:C4, the covariance matrix in E2:G4. Variance in B6:
=SUMPRODUCT(B2:B4,MMULT(E2:G4,B2:B4))(confirm as an array formula in older Excel); return in B7:=SUMPRODUCT(B2:B4,C2:C4). Solver: minimise B6 by changing B2:B4, subject toSUM(B2:B4)=1,B2:B4>=0,B3<=0.6; method "GRG Nonlinear". You should recover Example 2. - LP. In a new sheet put $x$, $y$ in B2:B3 and the scenario returns as formulas; maximise
=0.07+0.05*B2+0.02*B3with the constraints of Example 3, method "Simplex LP". Open Solver's Sensitivity Report and find the shadow prices 0.13 and 0.22 (Excel calls them "Lagrange multipliers" or "shadow prices"). - Goal LP. Reproduce the Market case with five variables; then add a constraint "total ≤ budget" and a variable $t$ to reproduce Exercise III.5.
- Instability. Simulate 10 years of returns for the three funds with the §4.1 inputs (in Python:
R = rng.multivariate_normal(mu, Sigma, size=10)), estimatemu_hat = R.mean(axis=0), and solve the long-only maximum-CE problem $\max\ \hat\mu^{\mathsf T}w-\tfrac{\lambda}{2}w^{\mathsf T}\Sigma w$ (take $\lambda=3$) withscipy.optimize.minimize(..., method='SLSQP', bounds=[(0,1)]*3, constraints=[{'type':'eq','fun':lambda w: w.sum()-1}]). Repeat 500 times and histogram each weight. - Repeat step 4 with risk parity (it does not use
mu_hat, so it never moves) and with the optimiser plus a 50% cap on each fund. Compare the average true certainty equivalent $\mu^{\mathsf T}w-\tfrac{\lambda}{2}w^{\mathsf T}\Sigma w$ of the three rules, using the true $\mu$.
Python LP in one line: from scipy.optimize import linprog; r = linprog(c=[-0.05,-0.02], A_ub=[[0.3,-0.1],[0.05,0.15],[1,0],[0,1],[1,1]], b_ub=[0.10,0.05,0.6,0.25,0.75], bounds=[(0,None)]*2, method='highs'); r.x, r.ineqlin.marginals — the marginals are minus the shadow prices (linprog minimises).
Hand in: your Solver screenshots for steps 1–3, the three histograms from steps 4–5, and one paragraph: which rule would you defend to a client, and why?
Going further. Add a turnover limit from a current portfolio using the helper-variable trick of this section; or replace the scenario limits by a limit on the average loss in the worst scenarios of a simulated set (this "CVaR" constraint is also an LP — see §7.4 for expected shortfall).
🧪 Self-check quiz
Q1. An optimiser maximises expected return subject to a budget, long-only rules and weight caps (no risk constraint). Its answer will typically be
Q2. In an LP the shadow price of a 10% loss limit is 0.35. This means
Q3. Two assets have volatilities 30% and 10%. In the risk-parity portfolio the weight of the 30% asset is
Q4. Switching from 10 years of monthly data to 10 years of daily data mainly
Q5. A goal LP with an overall equity limit must cut equity from one of two buckets: a 5-year goal or a 12-year goal. At the same planning returns it cuts