Congruence and Inertia
A real symmetric matrix represents a symmetric bilinear form, and a change of basis changes its matrix by congruence: \(\mathbf{B}=\mathbf{P}^{\top}\mathbf{A}\mathbf{P}\), where \(\mathbf{P}\) is invertible. The diagonal entries can change under this operation, so the entries themselves are not the classification. What survives is their sign pattern: the counts of positive, negative, and zero diagonal entries. Sylvester’s law of inertia says that these counts do not depend on the chosen diagonalization or basis. In fact, they give a complete classification: two real symmetric matrices of the same size are congruent exactly when their three counts agree.
All matrices and vector spaces in this tutorial are over \(\mathbb{R}\). For a real symmetric matrix \(\mathbf{A}\in\mathbb{R}^{n\times n}\), its quadratic form is \(q_{\mathbf{A}}(\mathbf{x})=\mathbf{x}^{\top}\mathbf{A}\mathbf{x}\). The change of variables \(\mathbf{x}=\mathbf{P}\mathbf{y}\) gives \(q_{\mathbf{A}}(\mathbf{P}\mathbf{y})=\mathbf{y}^{\top}\mathbf{P}^{\top}\mathbf{A}\mathbf{P}\mathbf{y}\), which explains why congruence describes a change of coordinates for the form.
The earlier diagonalization result used here states that for every real symmetric \(\mathbf{A}\), there is an invertible matrix \(\mathbf{S}\) such that \(\mathbf{S}^{\top}\mathbf{A}\mathbf{S}=\mathbf{D}_{p,q,z}\), where \(\mathbf{D}_{p,q,z}=\operatorname{diag}(\mathbf{I}_p,-\mathbf{I}_q,\mathbf{O}_z)\). The zero-sized blocks are omitted when an index is zero. The result ensures that such a diagonal form exists; Sylvester’s law proves that its three counts are intrinsic, rather than dependent on which diagonalization is chosen.
Indices as Maximal Definite Dimensions
A subspace \(U\subseteq\mathbb{R}^n\) is positive definite for \(q_{\mathbf{A}}\) if \(q_{\mathbf{A}}(\mathbf{x})>0\) for every nonzero \(\mathbf{x}\in U\). Negative definite means \(q_{\mathbf{A}}(\mathbf{x})<0\) for every nonzero \(\mathbf{x}\in U\). The following argument identifies the positive and negative indices without relying on a particular choice of diagonalizing basis.
Proof. It is enough to prove the statements for \(\mathbf{D}_{p,q,z}\), because an invertible change of variables maps subspaces bijectively to subspaces of the same dimension and preserves the value of the form after the corresponding change of coordinates. Write a vector in the diagonal coordinates as \(\mathbf{x}=(\mathbf{x}_+,\mathbf{x}_-,\mathbf{x}_0)\), with coordinates in the positive, negative, and zero blocks. Then \(q_{\mathbf{D}_{p,q,z}}(\mathbf{x})=\|\mathbf{x}_+\|^2-\|\mathbf{x}_-\|^2\). The subspace supported only in the positive coordinates has dimension \(p\) and is positive definite, so a positive definite subspace of dimension \(p\) exists. Now let \(U\) be any positive definite subspace. Project its vectors onto their positive coordinates. This projection restricted to \(U\) is injective: if \(\mathbf{x}\in U\) has \(\mathbf{x}_+=\mathbf{0}\), then \(q_{\mathbf{D}_{p,q,z}}(\mathbf{x})=-\|\mathbf{x}_-\|^2\leq 0\), which is incompatible with positive definiteness unless \(\mathbf{x}=\mathbf{0}\). An injective linear map from \(U\) into \(\mathbb{R}^p\) implies \(\dim U\leq p\), including when \(p=0\). For the negative index, the subspace supported only in the negative coordinates has dimension \(q\) and is negative definite. For any negative definite subspace, projection onto the negative coordinates is injective: a vector with \(\mathbf{x}_-=\mathbf{0}\) has \(q_{\mathbf{D}_{p,q,z}}(\mathbf{x})=\|\mathbf{x}_+\|^2\geq 0\), so it must be zero. Therefore its dimension is at most \(q\). Both maximum dimensions have been established. \(\square\)
For a congruent matrix \(\mathbf{B}=\mathbf{P}^{\top}\mathbf{A}\mathbf{P}\), the map \(\mathbf{x}\mapsto\mathbf{P}\mathbf{x}\) sends subspaces to subspaces of the same dimension, and \(q_{\mathbf{B}}(\mathbf{x})=q_{\mathbf{A}}(\mathbf{P}\mathbf{x})\). Its inverse uses \(\mathbf{P}^{-1}\), so it gives a bijection between subspaces of each dimension. Consequently, positive definite subspaces for one form correspond exactly to positive definite subspaces for the other; the same holds for negative definite subspaces. The lemma therefore already shows that congruent matrices have the same positive and negative indices.
Sylvester’s Law of Inertia
Proof. Suppose \(\mathbf{B}=\mathbf{P}^{\top}\mathbf{A}\mathbf{P}\) for an invertible \(\mathbf{P}\). The correspondence \(\mathbf{x}\mapsto\mathbf{P}\mathbf{x}\) preserves the value of the quadratic form and the dimensions of subspaces. By the lemma, the largest dimensions of positive definite and negative definite subspaces are therefore the same for \(\mathbf{A}\) and \(\mathbf{B}\). These dimensions are their positive and negative indices, so those indices agree. To compare the zero indices, observe that \(\mathbf{B}\mathbf{x}=\mathbf{0}\) if and only if \(\mathbf{P}^{\top}\mathbf{A}\mathbf{P}\mathbf{x}=\mathbf{0}\), if and only if \(\mathbf{A}\mathbf{P}\mathbf{x}=\mathbf{0}\), because \(\mathbf{P}^{\top}\) is invertible. Hence \(\ker\mathbf{B}=\mathbf{P}^{-1}(\ker\mathbf{A})\), and the two kernels have equal dimension. In the diagonal form \(\mathbf{D}_{p,q,z}\), the kernel consists exactly of the vectors supported in the zero coordinates, so its dimension is the zero index. Thus the zero indices agree as well. \(\square\)
Worked Example: A Nondiagonal Matrix with the Same Inertia
Verify that \(\mathbf{A}=\begin{bmatrix}2&0&0\\0&-3&0\\0&0&0\end{bmatrix}\) is congruent to a nondiagonal matrix, and identify the shared inertia.
Take \(\mathbf{P}=\begin{bmatrix}1&1&0\\0&1&1\\0&0&1\end{bmatrix}\). It is invertible; for example, its inverse is \(\begin{bmatrix}1&-1&1\\0&1&-1\\0&0&1\end{bmatrix}\). First multiply on the right:
Then multiply by \(\mathbf{P}^{\top}\) on the left:
The calculation verifies the congruence directly. The diagonal matrix \(\mathbf{A}\) has one positive, one negative, and one zero diagonal entry, so its inertia is \((1,1,1)\). By Sylvester’s law, \(\mathbf{B}\) has the same inertia even though its diagonal entries do not display that information by inspection.
Check: The intermediate products give \(\mathbf{P}^{\top}(\mathbf{A}\mathbf{P})=\begin{bmatrix}2&2&0\\2&-1&-3\\0&-3&-3\end{bmatrix}\), exactly the stated \(\mathbf{B}\).
The Indices Give a Complete Classification
Invariance says that congruent forms must have matching indices. The converse also holds: if two real symmetric matrices have the same inertia, their diagonal forms by congruence are the same matrix \(\mathbf{D}_{p,q,z}\). The following result proves both directions, so “same inertia” is not merely a necessary test.
Proof. If the matrices are congruent, Sylvester’s law gives equality of their inertias. Conversely, suppose \(\mathbf{A}\) and \(\mathbf{B}\) have the same inertia \((p,q,z)\). By diagonalization by congruence, choose invertible matrices \(\mathbf{S}\) and \(\mathbf{T}\) such that \(\mathbf{S}^{\top}\mathbf{A}\mathbf{S}=\mathbf{D}_{p,q,z}\) and \(\mathbf{T}^{\top}\mathbf{B}\mathbf{T}=\mathbf{D}_{p,q,z}\). Set \(\mathbf{Q}=\mathbf{S}\mathbf{T}^{-1}\), which is invertible. From the first equality, \(\mathbf{A}=\mathbf{S}^{-\top}\mathbf{D}_{p,q,z}\mathbf{S}^{-1}\). Therefore \(\mathbf{Q}^{\top}\mathbf{A}\mathbf{Q}=\mathbf{T}^{-\top}\mathbf{S}^{\top}\mathbf{S}^{-\top}\mathbf{D}_{p,q,z}\mathbf{S}^{-1}\mathbf{S}\mathbf{T}^{-1}=\mathbf{T}^{-\top}\mathbf{D}_{p,q,z}\mathbf{T}^{-1}=\mathbf{B}\). Thus \(\mathbf{B}\) is congruent to \(\mathbf{A}\). \(\square\)
Worked Example: Constructing a Congruence from Matching Indices
Show directly that \(\mathbf{A}=\begin{bmatrix}4&0&0\\0&-9&0\\0&0&0\end{bmatrix}\) and \(\mathbf{B}=\begin{bmatrix}1&1&0\\1&0&0\\0&0&0\end{bmatrix}\) are congruent.
Both can be related to \(\mathbf{D}=\operatorname{diag}(1,-1,0)\). Let \(\mathbf{S}=\operatorname{diag}(2,3,1)\). Then \(\mathbf{S}^{\top}\mathbf{D}\mathbf{S}=\mathbf{A}\), as is checked by multiplying the diagonal entries: \(2^2=4\), \(-3^2=-9\), and \(0\cdot1^2=0\). Let \(\mathbf{R}=\begin{bmatrix}1&1&0\\0&1&0\\0&0&1\end{bmatrix}\). Direct multiplication gives
Because both transformations are invertible, the two matrices have the same inertia \((1,1,1)\). For an explicit congruence from \(\mathbf{A}\) to \(\mathbf{B}\), take \(\mathbf{Q}=\mathbf{S}^{-1}\mathbf{R}=\begin{bmatrix}\tfrac12&\tfrac12&0\\0&\tfrac13&0\\0&0&1\end{bmatrix}\). Verify it directly:
Check: The product has rows \((1,1,0)\), \((1,0,0)\), and \((0,0,0)\), so it is exactly the stated matrix \(\mathbf{B}\).
What Inertia Does—and Does Not—Remember
The indices are a compact description of the sign behavior of a symmetric form under arbitrary invertible changes of coordinates. They tell whether the form is positive definite (\(p=n\)), negative definite (\(q=n\)), or degenerate (\(z>0\)); they also record mixed positive and negative directions. But they do not record the sizes of nonzero entries, nor do they record eigenvalues. Congruence and similarity are different transformations: similarity uses \(\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\), while congruence uses \(\mathbf{P}^{\top}\mathbf{A}\mathbf{P}\). An eigenvalue-based test for similarity cannot be substituted for Sylvester’s law.
Worked Example: Congruence Does Not Preserve Eigenvalues
Let \(\mathbf{A}=\begin{bmatrix}1&0\\0&2\end{bmatrix}\) and \(\mathbf{P}=\begin{bmatrix}2&0\\0&1\end{bmatrix}\). Compute the congruent matrix and compare the eigenvalues.
The matrix \(\mathbf{P}\) is invertible, and multiplication gives
Thus \(\mathbf{B}=\mathbf{P}^{\top}\mathbf{A}\mathbf{P}\) is congruent to \(\mathbf{A}\). Their diagonal entries show eigenvalues \(1,2\) for \(\mathbf{A}\) and \(4,2\) for \(\mathbf{B}\), so the eigenvalue lists differ. Both matrices nevertheless have inertia \((2,0,0)\), as the law requires.
Check: \(\mathbf{P}^{\top}(\mathbf{A}\mathbf{P})=\begin{bmatrix}2&0\\0&1\end{bmatrix}\begin{bmatrix}2&0\\0&2\end{bmatrix}=\begin{bmatrix}4&0\\0&2\end{bmatrix}\).
Common Pitfall
A common error is to claim that congruent matrices must have the same eigenvalues. In the preceding example, a student might write, “\(\mathbf{B}=\mathbf{P}^{\top}\mathbf{A}\mathbf{P}\), so \(\mathbf{A}\) and \(\mathbf{B}\) are similar and have the same eigenvalues.” The first equation proves congruence, not similarity: it has \(\mathbf{P}^{\top}\) on the left, not \(\mathbf{P}^{-1}\). Indeed, the actual eigenvalues are \(1,2\) and \(4,2\), respectively. The correct conclusion is that the inertia is the same, here \((2,0,0)\). Always check which transformation is being used before deciding what quantity is preserved.
The law is useful because it replaces a potentially complicated choice of basis with three integers. Once a symmetric form has been diagonalized by congruence, those integers describe exactly which signs and degeneracies remain under every invertible coordinate change. The maximal-subspace interpretation explains why the positive and negative counts cannot be altered, and the kernel argument accounts for the zero count. Together, these facts establish both invariance and completeness.
Check Your Understanding
Use the definitions and results above to answer each question; when you compute a congruence, verify the matrix product.
- What is the inertia of \(\operatorname{diag}(5,-2,-7,0)\)?
- Explain why an invertible change of variables preserves the dimension of a positive definite subspace.
- For \(\mathbf{A}=\begin{bmatrix}0&1\\1&0\end{bmatrix}\), use \(\mathbf{P}=\begin{bmatrix}1&1\\1&-1\end{bmatrix}\) to find \(\mathbf{P}^{\top}\mathbf{A}\mathbf{P}\) and state the inertia.
- Two real symmetric \(4\times4\) matrices both have inertia \((2,1,1)\). What does the classification theorem imply?
- Why does equality of eigenvalues not serve as the defining invariant in Sylvester’s law?