# Chapter 58. Sylvester's Law of Inertia

# Chapter 58. Sylvester's Law of Inertia

Sylvester's law of inertia is a classification theorem for real quadratic forms and real symmetric matrices. It says that although a quadratic form may have many different matrix representations in different bases, the numbers of positive, negative, and zero square terms are invariant. These numbers are called the inertia of the form or matrix. The theorem states that real symmetric matrices related by a congruence transformation have the same numbers of positive, negative, and zero eigenvalues.

## 58.1 Quadratic Forms

A quadratic form on \(\mathbb{R}^n\) is a function

$$
q:\mathbb{R}^n\to\mathbb{R}
$$

of the form

$$
q(x)=x^T A x,
$$

where \(A\) is a real symmetric \(n\times n\) matrix.

For example, if

$$
A=
\begin{bmatrix}
2&1\\
1&3
\end{bmatrix},
$$

then

$$
q(x,y) =
\begin{bmatrix}
x&y
\end{bmatrix}
\begin{bmatrix}
2&1\\
1&3
\end{bmatrix}
\begin{bmatrix}
x\\
y
\end{bmatrix}.
$$

Multiplying gives

$$
q(x,y)=2x^2+2xy+3y^2.
$$

The cross term \(2xy\) appears because the off-diagonal entries of \(A\) contribute symmetrically.

## 58.2 Diagonal Quadratic Forms

A diagonal quadratic form has the form

$$
q(x)=d_1x_1^2+d_2x_2^2+\cdots+d_nx_n^2.
$$

Its behavior is easy to read from the signs of the coefficients.

| Coefficient type | Meaning |
|---|---|
| \(d_i>0\) | Positive square direction |
| \(d_i<0\) | Negative square direction |
| \(d_i=0\) | Null direction |

For example,

$$
q(x,y,z)=3x^2-2y^2
$$

has one positive square, one negative square, and one zero direction. The variable \(z\) does not appear, so the quadratic form vanishes in the \(z\)-direction.

The inertia is

$$
(n_+,n_-,n_0)=(1,1,1).
$$

## 58.3 Congruence

Two real symmetric matrices \(A\) and \(B\) are congruent if there exists an invertible matrix \(S\) such that

$$
B=S^TAS.
$$

This is the matrix transformation induced by a change of basis in a quadratic form.

If

$$
x=Sy,
$$

then

$$
q(x)=x^TAx=(Sy)^TA(Sy).
$$

Thus

$$
q(Sy)=y^T(S^TAS)y.
$$

So the same quadratic form has matrix \(A\) in the \(x\)-coordinates and matrix

$$
B=S^TAS
$$

in the \(y\)-coordinates.

Congruence differs from similarity. Similarity has the form

$$
B=S^{-1}AS
$$

and preserves eigenvalues. Congruence has the form

$$
B=S^TAS
$$

and preserves inertia.

## 58.4 Statement of the Law

Let \(A\) be a real symmetric \(n\times n\) matrix. Then there exists an invertible matrix \(S\) such that

$$
S^TAS =
\operatorname{diag}(
\underbrace{1,\ldots,1}_{n_+},
\underbrace{-1,\ldots,-1}_{n_-},
\underbrace{0,\ldots,0}_{n_0}
).
$$

The numbers

$$
n_+,\qquad n_-,\qquad n_0
$$

are independent of the choice of \(S\). They are invariants of the quadratic form. They satisfy

$$
n_+ + n_- + n_0 = n.
$$

This is Sylvester's law of inertia. It says that a real quadratic form can be reduced to a sum of positive squares, negative squares, and zero terms, and the number of each kind is intrinsic.

## 58.5 Inertia

The inertia of a real symmetric matrix \(A\) is the triple

$$
\operatorname{In}(A)=(n_+,n_-,n_0),
$$

where:

| Symbol | Meaning |
|---|---|
| \(n_+\) | Number of positive eigenvalues |
| \(n_-\) | Number of negative eigenvalues |
| \(n_0\) | Number of zero eigenvalues |

Eigenvalues are counted with algebraic multiplicity.

For a diagonal matrix, the inertia is read directly from the diagonal entries.

For example,

$$
D=
\begin{bmatrix}
4&0&0&0\\
0&-2&0&0\\
0&0&0&0\\
0&0&0&7
\end{bmatrix}
$$

has

$$
\operatorname{In}(D)=(2,1,1).
$$

There are two positive diagonal entries, one negative diagonal entry, and one zero diagonal entry.

## 58.6 Signature and Rank

The signature of a real symmetric matrix is often defined as

$$
\operatorname{sig}(A)=n_+-n_-.
$$

The rank is

$$
\operatorname{rank}(A)=n_+ + n_-.
$$

The nullity is

$$
\operatorname{nullity}(A)=n_0.
$$

Thus inertia contains signature, rank, and nullity.

For example, if

$$
\operatorname{In}(A)=(4,2,1),
$$

then

$$
\operatorname{sig}(A)=2,
$$

$$
\operatorname{rank}(A)=6,
$$

and

$$
\operatorname{nullity}(A)=1.
$$

## 58.7 Canonical Form

Sylvester's law says that every real quadratic form can be written in the canonical form

$$
q(y)=y_1^2+\cdots+y_{n_+}^2
-y_{n_++1}^2-\cdots-y_{n_++n_-}^2.
$$

The remaining variables, if any, do not appear.

More explicitly,

$$
q(y) =
\sum_{i=1}^{n_+} y_i^2 -
\sum_{j=n_++1}^{n_++n_-} y_j^2.
$$

This form gives the complete classification of real quadratic forms under invertible linear changes of variables.

Two real quadratic forms are equivalent under a change of coordinates exactly when they have the same inertia.

## 58.8 Example: Removing a Cross Term

Consider

$$
q(x,y)=x^2+2xy+y^2.
$$

This can be rewritten as

$$
q(x,y)=(x+y)^2.
$$

Let

$$
u=x+y,
\qquad
v=y.
$$

Then

$$
q=u^2.
$$

The canonical form is

$$
q(u,v)=u^2+0v^2.
$$

Thus the inertia is

$$
(1,0,1).
$$

The form has one positive direction, no negative direction, and one null direction. The null direction corresponds to vectors satisfying

$$
x+y=0.
$$

## 58.9 Example: Indefinite Form

Consider

$$
q(x,y)=x^2-y^2.
$$

This is already diagonal. Its inertia is

$$
(1,1,0).
$$

It is positive in the direction

$$
(1,0),
$$

negative in the direction

$$
(0,1),
$$

and zero on the nonzero vectors satisfying

$$
x^2-y^2=0.
$$

These are the lines

$$
x=y
$$

and

$$
x=-y.
$$

An indefinite quadratic form may vanish on nonzero vectors even when its matrix is nonsingular.

## 58.10 Definite, Semidefinite, and Indefinite Forms

Inertia classifies definiteness.

| Inertia | Type |
|---|---|
| \((n,0,0)\) | Positive definite |
| \((0,n,0)\) | Negative definite |
| \((n_+,0,n_0)\), \(n_0>0\) | Positive semidefinite |
| \((0,n_-,n_0)\), \(n_0>0\) | Negative semidefinite |
| \(n_+>0\) and \(n_->0\) | Indefinite |

Thus a quadratic form is positive definite precisely when all its inertia is positive:

$$
\operatorname{In}(A)=(n,0,0).
$$

It is indefinite precisely when it has both positive and negative directions.

## 58.11 Relation to Eigenvalues

Because \(A\) is real symmetric, the spectral theorem gives

$$
A=Q\Lambda Q^T,
$$

where \(Q\) is orthogonal and \(\Lambda\) is diagonal with real eigenvalues.

Then

$$
q(x)=x^TAx.
$$

Set

$$
x=Qy.
$$

Since \(Q^TQ=I\),

$$
q(Qy) =
y^TQ^TAQy =
y^T\Lambda y.
$$

Therefore

$$
q(Qy)=\lambda_1 y_1^2+\cdots+\lambda_n y_n^2.
$$

The signs of the eigenvalues give the inertia:

$$
n_+=\#\{i:\lambda_i>0\},
$$

$$
n_-=\#\{i:\lambda_i<0\},
$$

$$
n_0=\#\{i:\lambda_i=0\}.
$$

This proves that inertia can be computed from eigenvalues. It also explains why inertia is stable under congruence, not because eigenvalues themselves are preserved, but because their signs are.

## 58.12 Congruence Does Not Preserve Eigenvalues

Congruent matrices generally do not have the same eigenvalues.

For example, let

$$
A=
\begin{bmatrix}
1&0\\
0&1
\end{bmatrix}
$$

and let

$$
S=
\begin{bmatrix}
2&0\\
0&3
\end{bmatrix}.
$$

Then

$$
S^TAS =
\begin{bmatrix}
4&0\\
0&9
\end{bmatrix}.
$$

The eigenvalues changed from

$$
1,1
$$

to

$$
4,9.
$$

But the inertia stayed the same:

$$
(2,0,0).
$$

Congruence preserves the signs of the diagonalized form, not the actual eigenvalue magnitudes.

## 58.13 Completing Squares

Sylvester's law can be understood by completing squares.

Consider

$$
q(x,y)=2x^2+4xy+5y^2.
$$

Complete the square in \(x\):

$$
q(x,y)=2(x^2+2xy)+5y^2.
$$

Since

$$
x^2+2xy=(x+y)^2-y^2,
$$

we get

$$
q(x,y)=2(x+y)^2-2y^2+5y^2.
$$

Thus

$$
q(x,y)=2(x+y)^2+3y^2.
$$

Let

$$
u=x+y,
\qquad
v=y.
$$

Then

$$
q=2u^2+3v^2.
$$

Both coefficients are positive, so

$$
\operatorname{In}(q)=(2,0,0).
$$

The quadratic form is positive definite.

## 58.14 A Three-Dimensional Example

Let

$$
q(x,y,z)=x^2+2xy+y^2-z^2.
$$

Since

$$
x^2+2xy+y^2=(x+y)^2,
$$

we have

$$
q(x,y,z)=(x+y)^2-z^2.
$$

Let

$$
u=x+y,
\qquad
v=y,
\qquad
w=z.
$$

Then

$$
q(u,v,w)=u^2-w^2.
$$

The variable \(v\) does not appear. Therefore the inertia is

$$
(1,1,1).
$$

This means the form has one positive direction, one negative direction, and one null direction.

## 58.15 Maximal Positive and Negative Subspaces

The positive index \(n_+\) has a geometric meaning. It is the largest possible dimension of a subspace on which the quadratic form is positive definite.

Similarly, \(n_-\) is the largest possible dimension of a subspace on which the quadratic form is negative definite.

For example, if

$$
q(x,y,z)=x^2+y^2-z^2,
$$

then

$$
n_+=2,
\qquad
n_-=1.
$$

The \(xy\)-plane is a two-dimensional positive definite subspace. The \(z\)-axis is a one-dimensional negative definite subspace. There cannot be a three-dimensional positive definite subspace because the form is negative in the \(z\)-direction.

This gives a coordinate-free interpretation of inertia.

## 58.16 Relation to Positive Definite Matrices

A real symmetric matrix \(A\) is positive definite if and only if

$$
\operatorname{In}(A)=(n,0,0).
$$

Equivalently, all eigenvalues are positive.

It is positive semidefinite if and only if

$$
n_-=0.
$$

It is nonsingular if and only if

$$
n_0=0.
$$

Thus Sylvester's law gives a compact classification:

| Matrix property | Inertia condition |
|---|---|
| Positive definite | \(n_+=n\) |
| Negative definite | \(n_-=n\) |
| Positive semidefinite | \(n_-=0\) |
| Negative semidefinite | \(n_+=0\) |
| Nonsingular | \(n_0=0\) |
| Indefinite | \(n_+>0\) and \(n_->0\) |

## 58.17 LDLT Factorization and Inertia

For a symmetric matrix, a factorization of the form

$$
A=LDL^T
$$

can be used to compute inertia.

Here \(L\) is lower triangular and invertible, and \(D\) is block diagonal or diagonal, depending on pivoting. Since

$$
A=LDL^T,
$$

the matrices \(A\) and \(D\) are congruent. Therefore they have the same inertia.

When \(D\) is diagonal, inertia is read from the signs of the diagonal entries.

This is important in numerical computation. Computing all eigenvalues may be expensive. Factorization methods often give inertia more directly.

## 58.18 Law of Inertia for Hermitian Matrices

There is a complex analogue.

If \(A\) is Hermitian, then its eigenvalues are real. Under an invertible complex change of variables,

$$
B=S^*AS,
$$

the numbers of positive, negative, and zero eigenvalues remain unchanged.

Thus Hermitian matrices are classified under congruence by inertia in the same way as real symmetric matrices.

## 58.19 Applications

Sylvester's law of inertia appears wherever quadratic behavior must be classified.

| Area | Use |
|---|---|
| Optimization | Classify Hessians at critical points |
| Differential geometry | Classify metric signatures |
| Numerical linear algebra | Determine definiteness and inertia |
| Quadratic forms | Classify forms under coordinate changes |
| Conic and quadric geometry | Classify second-degree surfaces |
| Stability analysis | Count positive and negative energy directions |

In multivariable calculus, if the Hessian matrix at a critical point has inertia \((n,0,0)\), the point is a local minimum. If it has inertia \((0,n,0)\), the point is a local maximum. If it has both positive and negative directions, the point is a saddle point.

## 58.20 Summary

Sylvester's law of inertia classifies real quadratic forms under invertible linear changes of variables.

Every real symmetric matrix \(A\) is congruent to a diagonal matrix with entries only

$$
1,\quad -1,\quad 0.
$$

The numbers of these entries are invariant. They form the inertia

$$
\operatorname{In}(A)=(n_+,n_-,n_0).
$$

These numbers equal the counts of positive, negative, and zero eigenvalues of \(A\).

The law separates what changes under coordinates from what does not. Coefficients and eigenvalue magnitudes may change under congruence. The numbers of positive, negative, and null directions do not.
