Quadratic Forms

A quadratic form is the matrix way of writing a pure-quadratic polynomial — every term has total degree exactly two. Built from a symmetric matrix M and a vector \vec{x}, it is the single number

Q(\vec{x}) = \vec{x}^{\mathsf{T}} M\, \vec{x}.

Sandwiching a vector on both sides of a matrix turns the matrix into a machine that eats a vector and returns a scalar. We take M symmetric (M = M^{\mathsf{T}}) — and the next page will show that costs us nothing, because every quadratic form already is a symmetric one.

Expanding the 2×2 case

Let's see what Q actually computes. Take the symmetric matrix and a general vector

M = \begin{bmatrix} a & b \\ b & c \end{bmatrix}, \qquad \vec{x} = \begin{bmatrix} x \\ y \end{bmatrix}.

Step 1 — apply M to \vec{x}. Multiply the matrix by the vector:

M\vec{x} = \begin{bmatrix} a & b \\ b & c \end{bmatrix}\begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} ax + by \\ bx + cy \end{bmatrix}.

Step 2 — dot with \vec{x}^{\mathsf{T}} on the left. Row vector times column vector is a plain dot product:

Q = \begin{bmatrix} x & y \end{bmatrix}\begin{bmatrix} ax + by \\ bx + cy \end{bmatrix} = x(ax + by) + y(bx + cy).

Step 3 — multiply out and collect. The two cross terms bxy are identical (that's the symmetry at work), so they merge into one:

Q(x, y) = ax^2 + bxy + bxy + cy^2 = ax^2 + 2bxy + cy^2.

So a symmetric M encodes exactly three numbers — the x^2 coefficient a, the y^2 coefficient c, and half the xy coefficient sitting in the off-diagonal b.

Every quadratic polynomial is a symmetric matrix

Run the correspondence backwards. Given any pure-quadratic polynomial \alpha x^2 + \beta xy + \gamma y^2, match it against ax^2 + 2bxy + cy^2: set a = \alpha, c = \gamma, and split the cross term in half, b = \beta/2. The matrix

\alpha x^2 + \beta xy + \gamma y^2 = \begin{bmatrix} x & y \end{bmatrix}\begin{bmatrix} \alpha & \beta/2 \\ \beta/2 & \gamma \end{bmatrix}\begin{bmatrix} x \\ y \end{bmatrix}

is automatically symmetric. Splitting the cross term evenly across the two off-diagonal slots is precisely what forces M = M^{\mathsf{T}} — so working with a symmetric matrix loses no generality at all.

For a symmetric matrix M, the form Q(\vec{x}) = \vec{x}^{\mathsf{T}} M\vec{x} satisfies:

The level set is a conic

Geometry makes a quadratic form intuitive. Ask which points have a fixed height, say Q(\vec{x}) = 1. The equation ax^2 + 2bxy + cy^2 = 1 is the equation of a conic section. Because M is symmetric, the spectral theorem gives it real eigenvalues \lambda_1, \lambda_2 along perpendicular eigenvectors. Rotate into that perpendicular eigenframe — call the new coordinates (u, v) — and the cross term vanishes:

Q = \lambda_1 u^2 + \lambda_2 v^2.

Now the shape reads straight off the signs of the eigenvalues:

The eigenvectors are exactly the principal axes of the conic. Diagonalizing a symmetric matrix and finding the axes of its level curve are one and the same act.

Morph the conic

Turn the sliders a, b, c and watch the level curve ax^2 + 2bxy + cy^2 = 1 change shape. The readout shows the two eigenvalues of M = \begin{bmatrix} a & b \\ b & c \end{bmatrix}: when both are positive you get an ellipse; push one negative (try a large b, or a negative c) and it snaps into a hyperbola. The off-diagonal b tilts the principal axes away from horizontal and vertical.

A quadratic form is the simplest non-linear thing a matrix can produce, and it is everywhere a "size" or "energy" is measured. The squared length of a vector, \vec{x}^{\mathsf{T}}\vec{x}, is the quadratic form of the identity matrix. The variance captured by a covariance matrix, the kinetic energy of a spinning body, the squared error of a least-squares fit — each is a quadratic form. Reading its eigenvalues tells you the shape of that landscape: a bowl, a saddle, or a trough. The next page chases the most important shape of all — the bowl that curves up in every direction.