Skip to content

Quadratic form

Read a quadratic form as a symmetric matrix expression, count cross terms correctly, and connect portfolio variance to exposure scaling and positive semidefiniteness.

A quadratic form is a homogeneous polynomial of degree two: every term is a squared variable or a product of two variables, with no linear or constant terms. Over real vectors it can be written
q(x)=x⊤Ax,x∈Rn,q(\mathbf x)=\mathbf x^\top A\mathbf x, \qquad \mathbf x\in\mathbb R^n,
where AA is an n×nn\times n symmetric matrix and x\mathbf x is a column vector. The result is one scalar. For example, 3x12+4x1x2+5x223x_1^2+4x_1x_2+5x_2^2 is a quadratic form; adding 7x1−27x_1-2 gives a more general quadratic function. The zero form, with A=0A=0, is included by convention.
In finance, portfolio variance is a quadratic form in the holdings or weights. This explains both why doubling an exposure quadruples its variance and why a risk calculation needs the interaction between assets, not just their individual risks.

The off-diagonal entries appear twice

For two variables, matrix multiplication gives
(x1x2)(ab\bc)(x1\x2)=ax12+2bx1x2+cx22.\begin{pmatrix}x_1&x_2\end{pmatrix} \begin{pmatrix}a&b\b&c\end{pmatrix} \begin{pmatrix}x_1\x_2\end{pmatrix} =ax_1^2+2bx_1x_2+cx_2^2.
The two off-diagonal entries contribute bx1x2bx_1x_2 and bx2x1bx_2x_1. Consequently, the coefficient of x1x2x_1x_2 in the polynomial is twice the off-diagonal matrix entry. To represent the opening example, put 2 in each off-diagonal position, not 4. Sutherland’s MIT notes make this coefficient convention explicit in Definition 9.1 and its footnote.

Requiring symmetry loses nothing over the reals. For any square matrix BB,

x⊤Bx=x⊤(B+B⊤2)x.\mathbf x^\top B\mathbf x =\mathbf x^\top\left(\frac{B+B^\top}{2}\right)\mathbf x.

The skew-symmetric part contributes zero: its scalar quadratic expression equals its own negative after transposing. Thus different nonsymmetric matrices can describe the same form, but its symmetric matrix representation is unique. This convention also makes derivatives simple: ∇q(x)=2Ax\nabla q(\mathbf x)=2A\mathbf x and the Hessian is 2A2A.

A 60/40 allocation with a covariance term

Suppose two fictional assets have simple returns RA,RBR_A,R_B over a common one-year horizon, expressed as decimals. Stipulate the population covariance matrix
Σ=(0.040.010.010.09),w=(0.60.4).\Sigma=\begin{pmatrix}0.04&0.01\\0.01&0.09\end{pmatrix}, \qquad \mathbf w=\begin{pmatrix}0.6\\0.4\end{pmatrix}.
For a fully invested allocation held over that period, Rp=0.6RA+0.4RBR_p=0.6R_A+0.4R_B. The variance is
Var(Rp)=w⊤Σw=0.62(0.04)+2(0.6)(0.4)(0.01)+0.42(0.09)=0.0144+0.0048+0.0144=0.0336.\begin{aligned} \text{Var}(R_p) &=\mathbf w^\top\Sigma\mathbf w\\ &=0.6^2(0.04)+2(0.6)(0.4)(0.01)+0.4^2(0.09)\\ &=0.0144+0.0048+0.0144\\ &=0.0336. \end{aligned}
The one-year standard deviation is 0.0336≈0.183303\sqrt{0.0336}\approx0.183303, or 18.3303%. The variance is in decimal-return squared; it is not 3.36% volatility. The covariance cross term is positive here because both weights and the stipulated covariance are positive. Negative covariance or signed holdings can change that term’s sign, while a valid total variance remains nonnegative.
This formula needs finite second moments, not normally distributed returns. Penn State’s linear-combinations notes derive the variance identity and the paired cross terms. In an empirical application, the inputs must also match the instruments, return convention and horizon of the position being measured.
Synthetic one-year portfolio variance decomposes into asset A term 0.0144, covariance term 0.0048 and asset B term 0.0144, totalling 0.0336. Scaling both exposures by t gives variance 0.0336 times t squared: 0 at t=0, 0.0084 at 0.5, 0.0336 at 1 and 0.1344 at 2.
Synthetic one-year portfolio variance decomposes into asset A term 0.0144, covariance term 0.0048 and asset B term 0.0144, totalling 0.0336. Scaling both exposures by t gives variance 0.0336 times t squared: 0 at t=0, 0.0084 at 0.5, 0.0336 at 1 and 0.1344 at 2.
Original synthetic example. The left panel separates the three terms; the right keeps the exposure mix fixed and scales its size. Variance uses one-year decimal-return squared units.

Scale the position, then square the scale

Homogeneity means that for every real scalar tt,

q(tx)=t2q(x).q(t\mathbf x)=t^2q(\mathbf x).

For the example, exposures 2w=(1.2,0.8)⊤2\mathbf w=(1.2,0.8)^\top have variance 4(0.0336)=0.13444(0.0336)=0.1344. Their standard deviation doubles to approximately 36.6606%. Reversing every exposure leaves variance unchanged because q(−w)=q(w)q(-\mathbf w)=q(\mathbf w); expected return and other economic consequences need not be unchanged.

The vector (1.2,0.8)(1.2,0.8) sums to 2. It describes leveraged risky-asset exposures relative to a capital base, rather than fully invested weights summing to 1. Borrowing, cash and financing costs must be specified separately. Deterministic financing changes the mean but adds no variance; uncertain financing can add variance and covariance terms. The scaling identity alone is not a complete financed-portfolio model.

Which forms can represent risk?

A general quadratic form can be positive, zero or negative. A covariance matrix must instead be positive semidefinite:
x⊤Σx≥0for every real x.\mathbf x^\top\Sigma\mathbf x\ge0 \quad\text{for every real }\mathbf x.
This is a condition on all directions, not on the signs of individual entries. The matrix with rows (1,2)(1,2) and (2,1)(2,1) has positive entries, yet its form at (1,−1)⊤(1,-1)^\top equals 1−4+1=−21-4+1=-2. It cannot be a covariance matrix. Conversely, negative off-diagonal covariances are perfectly compatible with nonnegative variance.

The example’s form can be written

w⊤Σw=0.04(wA+0.25wB)2+0.0875wB2.\mathbf w^\top\Sigma\mathbf w =0.04(w_A+0.25w_B)^2+0.0875w_B^2.
Both coefficients are positive, and both squared terms vanish together only at the zero vector. This proves the example is positive definite. Positive semidefiniteness also permits nonzero zero-variance directions, such as those created by duplicate return series.
More generally, eigenvalue decomposition of symmetric A=QΛQ⊤A=Q\Lambda Q^\top, with orthogonal QQ, transforms the form into q=∑iλiyi2q=\sum_i\lambda_i y_i^2, where y=Q⊤x\mathbf y=Q^\top\mathbf x. Nonnegative eigenvalues give a nonnegative form; mixed positive and negative eigenvalues give an indefinite form. This is the bridge from portfolio risk to curvature and quadratic programming. In optimisation, check whether the objective is written as x⊤Ax\mathbf x^\top A\mathbf x or 12x⊤Qx\tfrac12\mathbf x^\top Q\mathbf x: their Hessians are 2A2A and QQ, respectively.
For the full sign classification and principal-axis geometry, continue with Quadratic Forms and Their Classification (public preview; full lesson requires membership).

Sources

  • Gilbert Strang, Introduction to Linear Algebra, 5th edition, §6.5, “Positive Definite Matrices”: quadratic expressions, the doubled cross term, positivity tests and sums of squares.
  • Andrew V. Sutherland, 18.782 Introduction to Arithmetic Geometry, Lecture 9, Fall 2013, Definition 9.1: homogeneous quadratic polynomials and their symmetric matrix representation.
  • Penn State STAT 505, Linear Combinations of Random Variables, §2.3: variance as a covariance quadratic form.
Last updated
  • linear algebra
  • quadratic form
  • portfolio risk
  • covariance
  • optimisation
← Back to the glossaryBack to top ↑