Quant Memo
Core

Second-Order Cone Programming

A step up from linear programming that lets constraints and objectives involve a length or a risk term shaped like a distance — exactly the shape a portfolio's volatility constraint naturally has.

Prerequisites: Linear Programming and the Simplex Method, Convex Sets and Convex Functions

A linear program can cap a portfolio's total capital or any single position's size, but it cannot naturally express "keep the portfolio's volatility under 10%" — volatility involves a square root of a sum of squares, which is not a straight-line relationship no matter how you slice it. Second-order cone programming (SOCP) is exactly the extension of linear programming built to handle constraints and objectives shaped like a length or distance — a Euclidean norm — while staying just as tractable to solve reliably and fast. It's the natural home for risk-constrained portfolio optimization, robust optimization under uncertainty, and any problem where "keep some vector's size under control" is a real constraint.

The analogy: capping how far you can wander, not just where

A linear constraint is like a set of straight fences: don't cross this line, don't cross that one. A second-order cone constraint is different — it's like being tied to a stake by a rope of fixed length: you can move in any direction, but your total distance from the stake (measured the ordinary way, as a straight-line distance, not city-block distance) can't exceed some limit. That "distance from a stake" shape — a norm — is precisely the geometry of an ice-cream cone in higher dimensions, which is where the name comes from: the constraint traces out a cone-shaped region.

The mechanics, one symbol at a time

A second-order cone constraint takes the form

Ax+b2cx+d,\|A\mathbf{x} + \mathbf{b}\|_2 \le \mathbf{c}^\top \mathbf{x} + d,

where 2\|\cdot\|_2 denotes the ordinary Euclidean norm (length) of a vector. In words: the length of some linear combination of the decision variables must stay below some other linear combination of them — a "budget" for how big a certain vector quantity is allowed to get, expressed through a square root of a sum of squares rather than a plain straight-line bound.

A key example: a portfolio variance constraint wΣwσmax2\mathbf{w}^\top \Sigma \mathbf{w} \le \sigma_{\max}^2 (weights w\mathbf{w}, covariance matrix Σ\Sigma, volatility cap σmax\sigma_{\max}) can be rewritten, using Σ=LL\Sigma = L L^\top (a Cholesky factorization), as

Lw2σmax,\|L^\top \mathbf{w}\|_2 \le \sigma_{\max},

exactly a second-order cone constraint. In plain English: instead of capping variance directly (a quadratic, awkward form), you cap the length of a transformed weight vector — same constraint, geometrically cleaner, and solvable by the same efficient algorithms used for linear programs (interior-point methods), because SOCP retains the crucial convexity property that makes those solvers reliable.

Worked example 1: a volatility-capped two-asset portfolio

Two assets have volatilities σ1=20%, σ2=10%\sigma_1=20\%,\ \sigma_2=10\%, uncorrelated (ρ=0\rho=0), so Σ=(0.04000.01)\Sigma = \begin{pmatrix}0.04 & 0\\0&0.01\end{pmatrix} and L=(0.2000.1)L = \begin{pmatrix}0.2&0\\0&0.1\end{pmatrix}. Cap portfolio volatility at σmax=12%\sigma_{\max}=12\% with weights w1+w2=1w_1+w_2=1. The SOCP constraint is (0.2w1,0.1w2)20.12\|(0.2w_1, 0.1w_2)\|_2 \le 0.12. Try w1=0.4, w2=0.6w_1=0.4,\ w_2=0.6: (0.08,0.06)2=0.0064+0.0036=0.01=0.100.12\|(0.08, 0.06)\|_2 = \sqrt{0.0064+0.0036} = \sqrt{0.01} = 0.10 \le 0.12 — feasible, with headroom. Try w1=0.6, w2=0.4w_1=0.6,\ w_2=0.4: (0.12,0.04)2=0.0144+0.0016=0.0160.1265>0.12\|(0.12, 0.04)\|_2 = \sqrt{0.0144+0.0016}=\sqrt{0.016}\approx0.1265 > 0.12 — infeasible, breaching the volatility cap.

Worked example 2: comparing to a naive linear cap

A tempting shortcut is capping each weight's contribution linearly, e.g. 0.2w1+0.1w20.120.2w_1 + 0.1w_2 \le 0.12. At w1=0.6,w2=0.4w_1=0.6,w_2=0.4: 0.2(0.6)+0.1(0.4)=0.12+0.04=0.16>0.120.2(0.6)+0.1(0.4)=0.12+0.04=0.16 > 0.12 — this linear proxy also flags infeasibility here, but the two constraints don't agree in general. At w1=0.5,w2=0.5w_1=0.5,w_2=0.5: the linear proxy gives 0.1+0.05=0.15>0.120.1+0.05=0.15>0.12 (flagged infeasible), while the true SOCP volatility is (0.1,0.05)2=0.01250.11180.12\|(0.1,0.05)\|_2=\sqrt{0.0125}\approx0.1118 \le 0.12 — actually feasible. The linear shortcut is systematically too conservative because it ignores diversification (the square-root-of-sum-of-squares shrinks total risk below the sum of individual risks); only the genuine SOCP constraint captures that correctly.

Function explorer
-224.4
x = 1.00f(x) = 1.000

A norm constraint like x2r\|x\|_2 \le r traces a circle (or, in the general linear-combination form above, a tilted ellipse) rather than a straight boundary — picture the boundary curving smoothly rather than kinking at corners, which is exactly what separates a cone constraint from a linear one.

linear (polygon) proxy: too conservative true SOCP region: smooth cone boundary
A genuine second-order cone (volatility) constraint traces a smooth, larger feasible region than a linear proxy that ignores diversification benefits.

What this means in practice

SOCP is the standard formulation for volatility-constrained and risk-parity-flavored portfolio optimization, robust optimization (where uncertainty in expected returns is itself modeled as a norm ball), and any problem needing a "keep this vector's size bounded" constraint alongside otherwise linear objectives and constraints. Because it remains convex, SOCP inherits the reliable global-optimality guarantees and fast interior-point solvers of linear programming, unlike general nonconvex quadratic problems.

Second-order cone programming extends linear programming to allow constraints shaped like a Euclidean length — most importantly, a volatility or risk-budget constraint — while remaining convex and just as solvable via interior-point methods.

The common mistake is approximating a genuine norm (volatility) constraint with a linear proxy — like capping the sum of absolute risk contributions instead of the true portfolio volatility — because it seems simpler to set up. As the second worked example shows, this proxy is neither exactly right nor uniformly conservative in a useful sense: it ignores diversification and can reject perfectly good portfolios while occasionally still needing careful checking near the boundary. If the actual risk measure is a norm, formulate it as one.

Related concepts

Practice in interviews

Further reading

  • Boyd & Vandenberghe, Convex Optimization, ch. 4.4
  • Alizadeh & Goldfarb, Second-Order Cone Programming (survey), 2003
ShareTwitterLinkedIn