Quadratic Forms
A way of writing 'weighted sums of squares and cross-products' — like portfolio variance — as a single matrix expression, whose sign and shape are governed entirely by the matrix's eigenvalues.
Prerequisites: Eigenvalues & Eigenvectors
Portfolio variance isn't just a sum of each asset's individual variance — it also depends on how every pair of assets moves together. Writing that out term by term for even a modest portfolio produces a sprawling expression full of covariance terms. A quadratic form is the compact way to package all of that: one matrix, one vector, one expression, and — crucially — a guarantee that the result behaves sensibly (never negative, for a real variance) that falls straight out of the matrix's eigenvalues.
An analogy: a bowl versus a saddle
Picture the graph of a function of two variables as a landscape. Some landscapes are bowls — every direction you walk from the bottom, you go up. Some are saddles — walk one way and you go up, walk another and you go down. A quadratic form is the algebraic recipe behind that landscape's shape, and whether it's a bowl (always positive), an upside-down bowl (always negative), or a saddle (mixed) is fixed entirely by the eigenvalues of the underlying matrix — no need to trace out the whole landscape to know which one you have.
The math, one symbol at a time
For a symmetric matrix and a vector , the quadratic form is the scalar
In words: multiply every pair of entries by the matrix entry that links them, and add everything up. When is a covariance matrix and is a vector of portfolio weights, is exactly the portfolio's variance — diagonal terms are each asset's own variance contribution, off-diagonal terms capture how pairs move together.
The matrix's eigenvalues classify the shape: if every eigenvalue is positive, is positive definite and for every nonzero (a bowl); if eigenvalues are mixed in sign, can go either way (a saddle); if some eigenvalue is exactly zero, can be zero for a nonzero (positive semidefinite — the flat direction of a valley floor).
Worked example 1: portfolio variance by hand
Two assets with variances , and covariance give covariance matrix . For weights :
Portfolio variance is 0.0432, so volatility is . Every piece of that number came directly from the quadratic form — no separate variance-of-a-sum derivation needed.
Worked example 2: checking positive definiteness
Is a valid covariance-style matrix? Its eigenvalues solve , giving and . One eigenvalue is negative, so is not positive definite — indeed gives , a negative "variance." A matrix like this could never legitimately arise as a covariance matrix; if you ever compute one and it looks like , it signals a data or estimation error, not a real risk structure.
Adjust the coefficient and watch the parabola flip from a bowl to an upside-down bowl as the leading sign changes — the one-dimensional version of what eigenvalue sign does to a quadratic form in many dimensions.
What this means in practice
Portfolio variance, quadratic penalty terms in regularized regression, and the second-order (curvature) term in a Taylor expansion of any risk or loss function are all quadratic forms. Optimizers rely on positive definiteness to guarantee a unique minimum exists; risk systems rely on it to guarantee variance estimates are never nonsensically negative. When a covariance matrix is estimated from limited historical data, it can come out only positive semidefinite or even mildly indefinite due to estimation noise — a problem addressed by the The Nearest Correlation Matrix Problem repair technique.
A quadratic form packages all pairwise interaction terms into one expression, and its sign behavior — always positive, always negative, or mixed — is decided entirely by the signs of 's eigenvalues.
Don't assume a matrix built from real-world data is automatically positive semidefinite just because it "should" represent a variance. Sample covariance matrices estimated from too few observations relative to the number of assets routinely pick up small negative eigenvalues from noise, producing a mathematically invalid negative "variance" for some portfolio. This is a data-quality symptom, not a paradox — it means the matrix needs repair (shrinkage or projection to the nearest valid matrix) before being used in optimization.
Related concepts
Practice in interviews
Further reading
- Strang, Introduction to Linear Algebra, ch. 6