Unit 6, lesson 27

Quadratic Forms and Sylvester's Law of Inertia

How a real symmetric or complex Hermitian form reduces by congruence to a diagonal of ones, minus ones and zeros, why these counts, the inertia, never change, and what makes a form indefinite.

  • Video 27
  • Inertia and Positive Definite Factorization

The form x12−x22x_1^2 - x_2^2 on R2\mathbb{R}^2 is positive along the first axis and negative along the second, so its graph is a saddle. Rescaling, shearing or rotating the coordinates can change its coefficients, and it is fair to ask whether some clever choice could make every value positive. This lesson shows that no invertible change of coordinates can do it. Every real symmetric or complex Hermitian form can be brought to a diagonal form with entries 11, −1-1 and 00, and the number of entries of each kind is the same for every such change.

Key terms

Conjugate congruence

Definition Let A∈Cn×nA \in \mathbb{C}^{n \times n} be Hermitian, so A∗=AA^{*} = A. Its quadratic form is the function x↦x∗Axx \mapsto x^{*}Ax on Cn\mathbb{C}^n. It takes only real values, because the scalar x∗Axx^{*}Ax equals its own conjugate (x∗Ax)∗=x∗A∗x=x∗Ax(x^{*}Ax)^{*} = x^{*}A^{*}x = x^{*}Ax. Under an invertible change of coordinates x=Syx = Sy with S∈Cn×nS \in \mathbb{C}^{n \times n},

x∗Ax=(Sy)∗A(Sy)=y∗(S∗AS) y,\begin{aligned} x^{*}Ax &= (Sy)^{*}A(Sy) \\[0.4em] &= y^{*}(S^{*}AS)\,y, \end{aligned}

so in the new coordinates the same form has the matrix S∗ASS^{*}AS. Two matrices AA and BB are conjugate congruent when B=S∗ASB = S^{*}AS for some invertible SS. This is an equivalence relation, it sends Hermitian matrices to Hermitian matrices, and it preserves rank, because multiplying by invertible matrices does not change rank. Over R\mathbb{R}, with AA real symmetric and SS real invertible, S∗=STS^{*} = S^{\mathsf{T}} and the relation B=STASB = S^{\mathsf{T}}AS is ordinary congruence. Congruence is not similarity. Similarity S−1ASS^{-1}AS describes one operator in a new basis and keeps the eigenvalues, while congruence describes one form in new coordinates and in general changes them. The two formulas agree for every AA exactly when S∗=S−1S^{*} = S^{-1}, that is, when SS is unitary or real orthogonal.

In plain words A quadratic form takes one vector and returns a number. The vector enters twice, so a change of coordinates acts on both sides of the matrix, with S∗S^{*} on the left and SS on the right. In the complex case the left factor must carry the conjugate.

Example Take

A=[1i−i2].A = \begin{bmatrix} 1 & i \\ -i & 2 \end{bmatrix}.

Its form is ∣x1∣2+i x1‾x2−i x2‾x1+2∣x2∣2\lvert x_1 \rvert^2 + i\,\overline{x_1}x_2 - i\,\overline{x_2}x_1 + 2\lvert x_2 \rvert^2, and expanding ∣x1+ix2∣2\lvert x_1 + ix_2 \rvert^2 shows that this equals ∣x1+ix2∣2+∣x2∣2\lvert x_1 + ix_2 \rvert^2 + \lvert x_2 \rvert^2. The new coordinates y1=x1+ix2y_1 = x_1 + ix_2 and y2=x2y_2 = x_2 mean x=Syx = Sy with

S=[1−i01],S∗AS=[1001].\begin{gathered} S = \begin{bmatrix} 1 & -i \\ 0 & 1 \end{bmatrix}, \\[0.4em] S^{*}AS = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}. \end{gathered}

The transpose without the conjugate gives STASS^{\mathsf{T}}AS with upper right entry 00 and lower left entry −2i-2i. That matrix is not Hermitian and does not describe this form.

Diagonalization by congruence

Definition Let F\mathbb{F} be R\mathbb{R} or C\mathbb{C}, and let A∈Fn×nA \in \mathbb{F}^{n \times n} be real symmetric when F=R\mathbb{F} = \mathbb{R} or Hermitian when F=C\mathbb{F} = \mathbb{C}. Then there are an invertible S∈Fn×nS \in \mathbb{F}^{n \times n} and whole numbers p,q,z≥0p, q, z \ge 0 with p+q+z=np + q + z = n such that

S∗AS=[Ip000−Iq0000z].S^{*}AS = \begin{bmatrix} I_p & 0 & 0 \\ 0 & -I_q & 0 \\ 0 & 0 & 0_z \end{bmatrix}.

To build SS, use the spectral theorem to write A=QΛQ∗A = Q\Lambda Q^{*}, with QQ unitary (real orthogonal when F=R\mathbb{F} = \mathbb{R}) and Λ\Lambda real diagonal, ordering the orthonormal eigenvectors so that the positive eigenvalues come first, then the negative ones, then the zeros. Let DD be the real diagonal matrix with dii=1/∣λi∣d_{ii} = 1/\sqrt{\lvert \lambda_i \rvert} when λi≠0\lambda_i \ne 0 and dii=1d_{ii} = 1 when λi=0\lambda_i = 0. Then S=QDS = QD is invertible and S∗AS=DΛDS^{*}AS = D\Lambda D, whose diagonal entries are λi/∣λi∣=±1\lambda_i / \lvert \lambda_i \rvert = \pm 1 when λi≠0\lambda_i \ne 0 and 00 when λi=0\lambda_i = 0. In this construction pp and qq are the numbers of positive and negative eigenvalues counted with multiplicity, and z=dim⁡ker⁡Az = \dim \ker A. The matrix SS is far from unique. Completing squares, for instance, gives other choices.

In plain words First pass to an orthonormal eigenbasis, where the form has no cross terms. Then stretch each axis so that every nonzero coefficient becomes 11 or −1-1. After that only the signs are left.

Example For

A=[1221]A = \begin{bmatrix} 1 & 2 \\ 2 & 1 \end{bmatrix}

the eigenvalues are 33 and −1-1, with unit eigenvectors (1,1)/2(1, 1)/\sqrt{2} and (1,−1)/2(1, -1)/\sqrt{2}. Let QQ have these columns, in this order, and let D=diag⁡(1/3,1)D = \operatorname{diag}(1/\sqrt{3}, 1). Then

S=QD=[1/61/21/6−1/2],STAS=[100−1],\begin{aligned} S = QD &= \begin{bmatrix} 1/\sqrt{6} & 1/\sqrt{2} \\ 1/\sqrt{6} & -1/\sqrt{2} \end{bmatrix}, \\[0.4em] S^{\mathsf{T}}AS &= \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}, \end{aligned}

so p=1p = 1, q=1q = 1 and z=0z = 0.

Inertia

Definition Let A∈Fn×nA \in \mathbb{F}^{n \times n} be real symmetric or complex Hermitian, and let S∗AS=diag⁡(Ip,−Iq,0z)S^{*}AS = \operatorname{diag}(I_p, -I_q, 0_z) for an invertible SS. The inertia of AA, and of its quadratic form, is the triple (p,q,z)(p, q, z) of the numbers of positive, negative and zero diagonal entries. Sylvester’s law of inertia, below, shows that this triple does not depend on which SS is used. Consequently pp and qq are the numbers of positive and negative eigenvalues of AA counted with multiplicity, and

z=n−p−q=dim⁡ker⁡A=n−rank⁡A.\begin{aligned} z &= n - p - q \\[0.4em] &= \dim \ker A \\[0.4em] &= n - \operatorname{rank} A. \end{aligned}

In plain words Once the form is diagonal, the inertia counts how many coordinate axes make it go up, how many make it go down, and how many it ignores completely.

Example On R3\mathbb{R}^3 the form x12+2x1x2+x22−x32x_1^2 + 2x_1x_2 + x_2^2 - x_3^2 equals (x1+x2)2−x32(x_1 + x_2)^2 - x_3^2. Put u=x1+x2u = x_1 + x_2, v=x3v = x_3 and w=x2w = x_2. This change is invertible, since x1=u−wx_1 = u - w, x2=wx_2 = w and x3=vx_3 = v, and in the new coordinates the form is u2−v2u^2 - v^2 with no ww term. The inertia is (1,1,1)(1, 1, 1). The matrix

A=[11011000−1]A = \begin{bmatrix} 1 & 1 & 0 \\ 1 & 1 & 0 \\ 0 & 0 & -1 \end{bmatrix}

has rank 22 and kernel spanned by (1,−1,0)(1, -1, 0), the direction in which ww changes while uu and vv stay 00. Its eigenvalues 22, −1-1 and 00 show the same signs.

Maximal positive subspace

Definition Let A∈Fn×nA \in \mathbb{F}^{n \times n} be real symmetric or complex Hermitian. A subspace LL of Fn\mathbb{F}^n is positive for AA if x∗Ax>0x^{*}Ax > 0 for every nonzero x∈Lx \in L, and negative if x∗Ax<0x^{*}Ax < 0 for every nonzero x∈Lx \in L. A positive subspace of the largest possible dimension is a maximal positive subspace. If AA has inertia (p,q,z)(p, q, z), this largest dimension is exactly pp. To see it, take SS with S∗AS=diag⁡(Ip,−Iq,0z)S^{*}AS = \operatorname{diag}(I_p, -I_q, 0_z) and columns s1,…,sns_1, \dots, s_n. For x=Syx = Sy,

x∗Ax=∣y1∣2+⋯+∣yp∣2−∣yp+1∣2−⋯−∣yp+q∣2.\begin{aligned} x^{*}Ax &= \lvert y_1 \rvert^2 + \cdots + \lvert y_p \rvert^2 \\[0.4em] &\quad - \lvert y_{p+1} \rvert^2 - \cdots - \lvert y_{p+q} \rvert^2. \end{aligned}

So the span of s1,…,sps_1, \dots, s_p is positive and has dimension pp. The span NN of sp+1,…,sns_{p+1}, \dots, s_n has dimension n−pn - p, and x∗Ax≤0x^{*}Ax \le 0 on it. If a positive subspace LL had dim⁡L>p\dim L > p, the dimension formula dim⁡(L+N)+dim⁡(L∩N)=dim⁡L+dim⁡N\dim(L + N) + \dim(L \cap N) = \dim L + \dim N together with dim⁡(L+N)≤n\dim(L + N) \le n would give

dim⁡(L∩N)≥dim⁡L+(n−p)−n>0.\begin{aligned} &\dim(L \cap N) \\[0.4em] &\quad \ge \dim L + (n - p) - n > 0. \end{aligned}

A nonzero vector of L∩NL \cap N would have a value both positive and at most 00, which is impossible. The same argument applied to −A-A shows that qq is the largest dimension of a negative subspace. A positive subspace that is not contained in any larger positive subspace also turns out to have dimension pp, so the word maximal can be read either way. When 0<p<n0 < p < n, maximal positive subspaces are not unique, only their dimension is. When p=np = n the only one is Fn\mathbb{F}^n, and when p=0p = 0 it is {0}\{0\}.

In plain words The number pp can be read without any coordinates. It is the largest number of independent directions you can choose so that every nonzero combination of them gives a positive value.

Example The form x12+x22−x32x_1^2 + x_2^2 - x_3^2 on R3\mathbb{R}^3 has inertia (2,1,0)(2, 1, 0). The plane x3=0x_3 = 0 is positive. So is the tilted plane x3=x1/2x_3 = x_1/2, spanned by (2,0,1)(2, 0, 1) and (0,1,0)(0, 1, 0), because on it the form equals x12+x22−x12/4=34x12+x22x_1^2 + x_2^2 - x_1^2/4 = \tfrac{3}{4}x_1^2 + x_2^2, which vanishes only when x1=x2=0x_1 = x_2 = 0. Both are maximal positive subspaces. The plane x1=0x_1 = 0 is not positive, since it contains (0,0,1)(0, 0, 1) with value −1-1, and no subspace of dimension 33 is positive, since R3\mathbb{R}^3 itself contains that vector.

Sylvester’s law of inertia

Definition Let F\mathbb{F} be R\mathbb{R} or C\mathbb{C}, and let A,B∈Fn×nA, B \in \mathbb{F}^{n \times n} both be real symmetric or both be complex Hermitian. Then B=S∗ASB = S^{*}AS for some invertible S∈Fn×nS \in \mathbb{F}^{n \times n} if and only if AA and BB have the same inertia. In particular, whenever an invertible SS makes S∗ASS^{*}AS diagonal, with any real diagonal entries, the numbers of positive, negative and zero entries are pp, qq and zz. If B=S∗ASB = S^{*}AS, then y∗By=(Sy)∗A(Sy)y^{*}By = (Sy)^{*}A(Sy), so SS carries each subspace that is positive for BB onto a subspace of the same dimension that is positive for AA, and S−1S^{-1} does the reverse. The largest such dimension pp is therefore the same for both matrices, the same holds for qq with negative subspaces, and z=n−p−qz = n - p - q agrees as well. Conversely, if both have inertia (p,q,z)(p, q, z), choose invertible S1S_1 and S2S_2 with S1∗AS1=N=S2∗BS2S_1^{*}AS_1 = N = S_2^{*}BS_2, where N=diag⁡(Ip,−Iq,0z)N = \operatorname{diag}(I_p, -I_q, 0_z). Then

B=(S1S2−1)∗A (S1S2−1).B = (S_1S_2^{-1})^{*}A\,(S_1S_2^{-1}).

So the inertia classifies these forms completely under congruence.

In plain words Coordinate changes that remove the cross terms can make the nonzero coefficients as large or as small as you like, but every one of them leaves the same numbers of positive, negative and zero coefficients. Those three counts are the whole story, so two forms with the same counts are one form seen in two coordinate systems.

Example For the matrix AA with rows (1,2)(1, 2) and (2,1)(2, 1), completing the square gives

x12+4x1x2+x22=(x1+2x2)2−3x22,\begin{aligned} &x_1^2 + 4x_1x_2 + x_2^2 \\[0.4em] &\quad = (x_1 + 2x_2)^2 - 3x_2^2, \end{aligned}

which is the congruence by

S=[1−201],STAS=[100−3].\begin{gathered} S = \begin{bmatrix} 1 & -2 \\ 0 & 1 \end{bmatrix}, \\[0.4em] S^{\mathsf{T}}AS = \begin{bmatrix} 1 & 0 \\ 0 & -3 \end{bmatrix}. \end{gathered}

The orthonormal eigenvectors give diag⁡(3,−1)\operatorname{diag}(3, -1), and the scaled construction gives diag⁡(1,−1)\operatorname{diag}(1, -1). The three diagonal forms have different entries, and each has exactly one positive and one negative entry, as the law requires. The inertia is (1,1,0)(1, 1, 0).

Indefinite form

Definition Let A∈Fn×nA \in \mathbb{F}^{n \times n} be real symmetric or complex Hermitian with inertia (p,q,z)(p, q, z). Its form is positive definite if x∗Ax>0x^{*}Ax > 0 for every x≠0x \ne 0, which happens exactly when p=np = n, and positive semidefinite if x∗Ax≥0x^{*}Ax \ge 0 for every xx, which happens exactly when q=0q = 0. Negative definite and negative semidefinite forms have the inequalities reversed and correspond to q=nq = n and p=0p = 0. The form is indefinite if it takes both a positive and a negative value, which happens exactly when p≥1p \ge 1 and q≥1q \ge 1. A nonzero vector with x∗Ax=0x^{*}Ax = 0 need not lie in ker⁡A\ker A. Every indefinite form has such vectors, for instance s1+sp+1s_1 + s_{p+1} in the notation above, even when AA is invertible.

In plain words An indefinite form is a saddle. Some directions go up, some go down, and in between lie nonzero directions where the value is exactly zero, even though the matrix need not send them to zero.

Example The form x12−x22x_1^2 - x_2^2 of A=diag⁡(1,−1)A = \operatorname{diag}(1, -1) is indefinite, with value 11 at e1e_1 and −1-1 at e2e_2. At (1,1)(1, 1) its value is 00, yet A(1,1)=(1,−1)A(1, 1) = (1, -1) and ker⁡A={0}\ker A = \{0\}. The substitution x1=2y1x_1 = 2y_1, x2=y2x_2 = y_2 uses S=diag⁡(2,1)S = \operatorname{diag}(2, 1) and gives STAS=diag⁡(4,−1)S^{\mathsf{T}}AS = \operatorname{diag}(4, -1). The eigenvalues changed from 11 and −1-1 to 44 and −1-1, but one negative direction remains, and by Sylvester’s law no invertible substitution can remove it. The saddle never becomes a bowl.

Check yourself

  1. Find the inertia of the real form x12+4x1x2+3x22x_1^2 + 4x_1x_2 + 3x_2^2 and decide whether it is indefinite.
Show the answer

Completing the square gives

x12+4x1x2+3x22=(x1+2x2)2−x22.\begin{aligned} &x_1^2 + 4x_1x_2 + 3x_2^2 \\[0.4em] &\quad = (x_1 + 2x_2)^2 - x_2^2. \end{aligned}

With y1=x1+2x2y_1 = x_1 + 2x_2 and y2=x2y_2 = x_2, an invertible change, the form is y12−y22y_1^2 - y_2^2. The inertia is (1,1,0)(1, 1, 0), so the form is indefinite. For instance its value is 11 at (1,0)(1, 0) and 4−8+3=−14 - 8 + 3 = -1 at (−2,1)(-2, 1). As a check, the matrix with rows (1,2)(1, 2) and (2,3)(2, 3) has determinant −1-1, the product of one positive and one negative eigenvalue.

  1. Over R\mathbb{R}, are diag⁡(1,−1)\operatorname{diag}(1, -1) and diag⁡(5,−2)\operatorname{diag}(5, -2) congruent? Are they similar? Is the identity diag⁡(1,1)\operatorname{diag}(1, 1) congruent to diag⁡(1,−1)\operatorname{diag}(1, -1)?
Show the answer

Both diag⁡(1,−1)\operatorname{diag}(1, -1) and diag⁡(5,−2)\operatorname{diag}(5, -2) have inertia (1,1,0)(1, 1, 0), so Sylvester’s law says they are congruent. Explicitly, S=diag⁡(5,2)S = \operatorname{diag}(\sqrt{5}, \sqrt{2}) gives STdiag⁡(1,−1)S=diag⁡(5,−2)S^{\mathsf{T}}\operatorname{diag}(1, -1)S = \operatorname{diag}(5, -2). They are not similar, because similar matrices have the same eigenvalues, and 1,−11, -1 differ from 5,−25, -2.

The identity has inertia (2,0,0)(2, 0, 0), so it is not congruent to diag⁡(1,−1)\operatorname{diag}(1, -1). Directly, every matrix congruent to II is STSS^{\mathsf{T}}S for an invertible SS, and its form yTSTSy=∥Sy∥2y^{\mathsf{T}}S^{\mathsf{T}}Sy = \lVert Sy \rVert^2 is positive for every y≠0y \ne 0, so it has no negative direction.

  1. Consider the real form x12+2x1x2+2x22+2x2x3−x32x_1^2 + 2x_1x_2 + 2x_2^2 + 2x_2x_3 - x_3^2. Find its inertia and a positive subspace of the largest possible dimension. Then find a nonzero vector at which the form is 00, and decide whether that vector lies in the kernel of the matrix.
Show the answer

Completing squares twice,

x12+2x1x2+2x22+2x2x3−x32=(x1+x2)2+(x2+x3)2−2x32.\begin{aligned} &x_1^2 + 2x_1x_2 + 2x_2^2 \\[0.4em] &\quad + 2x_2x_3 - x_3^2 \\[0.4em] &\quad = (x_1 + x_2)^2 \\[0.4em] &\qquad + (x_2 + x_3)^2 - 2x_3^2. \end{aligned}

The substitution y1=x1+x2y_1 = x_1 + x_2, y2=x2+x3y_2 = x_2 + x_3, y3=x3y_3 = x_3 is triangular with ones on the diagonal, hence invertible, and gives y12+y22−2y32y_1^2 + y_2^2 - 2y_3^2. The inertia is (2,1,0)(2, 1, 0).

On the plane x3=0x_3 = 0 the form is (x1+x2)2+x22(x_1 + x_2)^2 + x_2^2, which is positive unless x1=x2=0x_1 = x_2 = 0. So this plane is a positive subspace of dimension 2=p2 = p, the largest possible.

Choosing y=(1,1,1)y = (1, 1, 1) makes y12+y22−2y32=0y_1^2 + y_2^2 - 2y_3^2 = 0. Going back, x3=1x_3 = 1, x2=0x_2 = 0 and x1=1x_1 = 1, and indeed the form at (1,0,1)(1, 0, 1) is 1−1=01 - 1 = 0. The matrix is

A=[11012101−1],A = \begin{bmatrix} 1 & 1 & 0 \\ 1 & 2 & 1 \\ 0 & 1 & -1 \end{bmatrix},

and A(1,0,1)=(1,2,−1)≠0A(1, 0, 1) = (1, 2, -1) \ne 0, so the vector is not in the kernel. In fact z=0z = 0 and det⁡A=−2\det A = -2, so the kernel is {0}\{0\}. For an indefinite form, a zero value does not by itself put a vector in the kernel.

How this lesson connects