Tutorials › Linear Algebra › Classifying Symmetric Forms Under Congruence

Dual Spaces and Bilinear Forms · Tutorial 899 of 1000

Classifying Symmetric Forms Under Congruence

Use diagonal forms and inertia to decide when real symmetric matrices are congruent and to build a matrix that carries one form to the other.

Advanced 10 min read

What You'll Learn

  • Reduce a real symmetric matrix to diagonal form by congruence.
  • Read its inertia by counting positive, negative, and zero diagonal entries.
  • Use Sylvester’s law to decide whether two symmetric matrices are congruent.
  • Construct an explicit congruence transformation when the inertia indices match.
  • Recognize why equal rank alone does not guarantee congruence.

Classification by Congruence

A real symmetric matrix represents a symmetric bilinear form, and changing coordinates in that form acts on the matrix by congruence. This is different from changing coordinates in a linear transformation: the matrix expression is \(\mathbf{P}^{\top}\mathbf{A}\mathbf{P}\), with the same change-of-basis matrix on both sides, transposed on the left. For classifying forms, diagonal entries matter through their signs, not their particular nonzero magnitudes. The aim here is to use a diagonalization to identify those signs and, when two matrices have matching sign counts, construct an explicit transformation between them.

All matrices and changes of coordinates in this tutorial are over \(\mathbb{R}\). A congruence transformation uses an invertible matrix \(\mathbf{P}\). If \(\mathbf{A}\) is symmetric, then \(\mathbf{P}^{\top}\mathbf{A}\mathbf{P}\) is symmetric as well, since \((\mathbf{P}^{\top}\mathbf{A}\mathbf{P})^{\top}=\mathbf{P}^{\top}\mathbf{A}^{\top}\mathbf{P}=\mathbf{P}^{\top}\mathbf{A}\mathbf{P}\).

Definition: Two real symmetric \(n\times n\) matrices \(\mathbf{A}\) and \(\mathbf{B}\) are congruent if there is an invertible \(\mathbf{P}\in\mathbb{R}^{n\times n}\) such that \(\mathbf{P}^{\top}\mathbf{A}\mathbf{P}=\mathbf{B}\). If a real symmetric matrix is diagonalized by congruence, its inertia is the triple \((p,q,r)\), where \(p\), \(q\), and \(r\) count its positive, negative, and zero diagonal entries, respectively. These counts do not depend on the choice of diagonalization, by Sylvester’s Law of Inertia.

The diagonalization theorem for real symmetric forms by congruence and Sylvester’s Law of Inertia are standard results established earlier in the course. Thus, for any real symmetric \(\mathbf{A}\), there is an invertible \(\mathbf{P}\) for which \(\mathbf{P}^{\top}\mathbf{A}\mathbf{P}\) is diagonal, and the three sign counts are invariant under congruence. We will use both results; the classification criterion below also explains how these facts combine and how to construct the transformation.

Reducing a Matrix and Reading Its Inertia

For a matrix \(\mathbf{A}\), the associated quadratic form is \(q_{\mathbf{A}}(\mathbf{x})=\mathbf{x}^{\top}\mathbf{A}\mathbf{x}\). If \(\mathbf{P}\) is invertible and \(\mathbf{x}=\mathbf{P}\mathbf{y}\), then \(q_{\mathbf{A}}(\mathbf{P}\mathbf{y})=\mathbf{y}^{\top}(\mathbf{P}^{\top}\mathbf{A}\mathbf{P})\mathbf{y}\). Consequently, diagonalizing by congruence expresses the same form in new coordinates. For a diagonal matrix with entries \(d_1,\ldots,d_n\), the quadratic form is \(\sum_i d_i y_i^2\); a positive, negative, or zero diagonal entry contributes one positive, negative, or zero direction.

In a calculation, the columns of \(\mathbf{P}\) are the new basis vectors. It is not enough to row-reduce \(\mathbf{A}\): row operations alone generally do not preserve the quadratic form’s congruence class. Instead, compute the products in \(\mathbf{P}^{\top}\mathbf{A}\mathbf{P}\), or use a sequence of congruence changes whose combined basis matrix is \(\mathbf{P}\).

Worked Example: Diagonalizing and Classifying a Symmetric Matrix

Diagonalize by congruence and find the inertia of \(\mathbf{A}=\begin{bmatrix}1&1&0\\1&2&1\\0&1&0\end{bmatrix}\). Choose the columns of \(\mathbf{P}=\begin{bmatrix}1&-1&1\\0&1&-1\\0&0&1\end{bmatrix}\) as the new basis vectors. This matrix is invertible because it is upper triangular with diagonal entries \(1,1,1\).

First multiply \(\mathbf{A}\) by each column of \(\mathbf{P}\). The three results are \((1,1,0)^{\top}\), \((0,1,1)^{\top}\), and \((0,0,-1)^{\top}\), so

$$ \mathbf{A}\mathbf{P} = \begin{bmatrix}1&1&0\\1&2&1\\0&1&0\end{bmatrix} \begin{bmatrix}1&-1&1\\0&1&-1\\0&0&1\end{bmatrix} = \begin{bmatrix}1&0&0\\1&1&0\\0&1&-1\end{bmatrix}. $$

Now multiply on the left by \(\mathbf{P}^{\top}\). Equivalently, take the dot products of the columns of \(\mathbf{P}\) with the columns of \(\mathbf{A}\mathbf{P}\). These give diagonal entries \(1,1,-1\) and off-diagonal entries \(0\):

$$ \mathbf{P}^{\top}\mathbf{A}\mathbf{P} = \begin{bmatrix}1&0&0\\0&1&0\\0&0&-1\end{bmatrix}. $$

Thus the inertia is \((2,1,0)\): there are two positive entries, one negative entry, and no zero entries. Check: the first column of \(\mathbf{P}\), dotted with the three columns of \(\mathbf{A}\mathbf{P}\), gives \((1,0,0)\); the second gives \((0,1,0)\); the third gives \((0,0,-1)\). These rows are exactly the displayed congruence matrix.

When Two Forms Are Congruent

Theorem (Congruence classification for real symmetric matrices): Two real symmetric \(n\times n\) matrices are congruent if and only if they have the same inertia \((p,q,r)\). In particular, every such matrix is congruent to the canonical diagonal matrix \(\operatorname{diag}(I_p,-I_q,O_r)\), where \(I_p\) is the \(p\times p\) identity matrix, \(-I_q\) is the negative \(q\times q\) identity matrix, and \(O_r\) is the \(r\times r\) zero matrix. A block of size zero is omitted.

Proof. First suppose that \(\mathbf{A}\) and \(\mathbf{B}\) are congruent, so \(\mathbf{B}=\mathbf{P}^{\top}\mathbf{A}\mathbf{P}\) for an invertible \(\mathbf{P}\). They are then two congruent representatives of the same symmetric form. Sylvester’s Law of Inertia says their positive, negative, and zero counts agree. This proves the forward implication.

Conversely, suppose both matrices have inertia \((p,q,r)\). By the diagonalization theorem for real symmetric forms by congruence, choose invertible matrices \(\mathbf{P}_A,\mathbf{P}_B\) such that \(\mathbf{P}_A^{\top}\mathbf{A}\mathbf{P}_A=\mathbf{D}_A\) and \(\mathbf{P}_B^{\top}\mathbf{B}\mathbf{P}_B=\mathbf{D}_B\), with both diagonal. Reorder the diagonal entries, if necessary, so the positive entries come first, then the negative entries, then the zero entries. Write the positive entries of \(\mathbf{D}_A,\mathbf{D}_B\) as \(a_i,b_i>0\), and the negative entries as \(-c_j,-d_j\), where \(c_j,d_j>0\). Define a diagonal matrix \(\mathbf{S}\) with entries \(\sqrt{b_i/a_i}\) in the positive positions, \(\sqrt{d_j/c_j}\) in the negative positions, and \(1\) in the zero positions. Every diagonal entry of \(\mathbf{S}\) is nonzero, so \(\mathbf{S}\) is invertible, and direct multiplication gives \(\mathbf{S}^{\top}\mathbf{D}_A\mathbf{S}=\mathbf{D}_B\). Set \(\mathbf{Q}=\mathbf{P}_A\mathbf{S}\mathbf{P}_B^{-1}\), which is invertible. Then \(\mathbf{Q}^{\top}\mathbf{A}\mathbf{Q}=\mathbf{P}_B^{-\top}\mathbf{S}^{\top}\mathbf{D}_A\mathbf{S}\mathbf{P}_B^{-1}=\mathbf{P}_B^{-\top}\mathbf{D}_B\mathbf{P}_B^{-1}=\mathbf{B}\). Thus \(\mathbf{A}\) and \(\mathbf{B}\) are congruent. Scaling each nonzero diagonal entry to \(1\) or \(-1\) by the same construction proves the canonical-form statement. \(\square\)

The construction in the proof is useful in practice. Diagonalize each matrix, then rescale the diagonal coordinates so that every positive entry becomes \(1\) and every negative entry becomes \(-1\). If the inertias match, both matrices reach the same canonical diagonal matrix. Composing those changes of coordinates gives a congruence between the original matrices.

Constructing a Congruence Explicitly

Worked Example: Build a Transformation Between Matching Inertias

Use the matrix \(\mathbf{A}\) from the previous example and find an invertible \(\mathbf{Q}\) for which \(\mathbf{Q}^{\top}\mathbf{A}\mathbf{Q}=\mathbf{B}\), where \(\mathbf{B}=\operatorname{diag}(4,9,-25)\). Both matrices have inertia \((2,1,0)\). From the previous reduction, \(\mathbf{P}^{\top}\mathbf{A}\mathbf{P}=\operatorname{diag}(1,1,-1)\). Rescale its three diagonal coordinates by \(2,3,5\), respectively, by setting \(\mathbf{Q}=\mathbf{P}\operatorname{diag}(2,3,5)\):

$$ \mathbf{Q} = \begin{bmatrix}1&-1&1\\0&1&-1\\0&0&1\end{bmatrix} \begin{bmatrix}2&0&0\\0&3&0\\0&0&5\end{bmatrix} = \begin{bmatrix}2&-3&5\\0&3&-5\\0&0&5\end{bmatrix}. $$

This matrix is invertible because it is upper triangular with nonzero diagonal entries. By associativity of multiplication and the diagonalization already checked,

$$ \mathbf{Q}^{\top}\mathbf{A}\mathbf{Q} = \begin{bmatrix}2&0&0\\0&3&0\\0&0&5\end{bmatrix} \begin{bmatrix}1&0&0\\0&1&0\\0&0&-1\end{bmatrix} \begin{bmatrix}2&0&0\\0&3&0\\0&0&5\end{bmatrix} = \begin{bmatrix}4&0&0\\0&9&0\\0&0&-25\end{bmatrix} =\mathbf{B}. $$

Check: the first two diagonal entries are \(2\cdot1\cdot2=4\) and \(3\cdot1\cdot3=9\); the third is \(5\cdot(-1)\cdot5=-25\). Every off-diagonal entry stays zero because the middle matrix is diagonal. Hence the constructed \(\mathbf{Q}\) gives the claimed congruence.

For a more general pair, the same idea works even if neither matrix is already diagonal. If \(\mathbf{X}_A^{\top}\mathbf{A}\mathbf{X}_A=\mathbf{J}\) and \(\mathbf{X}_B^{\top}\mathbf{B}\mathbf{X}_B=\mathbf{J}\), where \(\mathbf{J}=\operatorname{diag}(I_p,-I_q,O_r)\), then \(\mathbf{Q}=\mathbf{X}_A\mathbf{X}_B^{-1}\) satisfies \(\mathbf{Q}^{\top}\mathbf{A}\mathbf{Q}=\mathbf{B}\). Indeed, substituting the two equalities gives \(\mathbf{Q}^{\top}\mathbf{A}\mathbf{Q}=\mathbf{X}_B^{-\top}\mathbf{J}\mathbf{X}_B^{-1}=\mathbf{B}\). The inverse is essential: it maps from the coordinates used for \(\mathbf{B}\) back to the common canonical coordinates.

Worked Example: A Form with a Zero Direction

Classify \(\mathbf{C}=\begin{bmatrix}1&1&0\\1&1&0\\0&0&-2\end{bmatrix}\). Take \(\mathbf{P}=\begin{bmatrix}1&-1&0\\0&1&0\\0&0&1\end{bmatrix}\). It is invertible, since it is triangular with diagonal entries \(1,1,1\). Multiplication by its columns gives

$$ \mathbf{C}\mathbf{P} = \begin{bmatrix}1&1&0\\1&1&0\\0&0&-2\end{bmatrix} \begin{bmatrix}1&-1&0\\0&1&0\\0&0&1\end{bmatrix} = \begin{bmatrix}1&0&0\\1&0&0\\0&0&-2\end{bmatrix}. $$

Now \(\mathbf{P}^{\top}\mathbf{C}\mathbf{P}\) is diagonal:

$$ \begin{bmatrix}1&0&0\\-1&1&0\\0&0&1\end{bmatrix} \begin{bmatrix}1&0&0\\1&0&0\\0&0&-2\end{bmatrix} = \begin{bmatrix}1&0&0\\0&0&0\\0&0&-2\end{bmatrix}. $$

The inertia is \((1,1,1)\). Check: the first column of \(\mathbf{P}\) pairs with itself under \(\mathbf{C}\) to give \(1\); the second is \((-1,1,0)^{\top}\), and \(\mathbf{C}(-1,1,0)^{\top}=\mathbf{0}\); the third pairs with itself to give \(-2\). All three cross-pairings are zero, as the displayed product confirms.

What the Classification Does—and Does Not—Say

Inertia is a complete invariant for congruence of real symmetric matrices: matching indices guarantee a transformation, and differing indices rule one out. Rank only counts the nonzero diagonal entries, so it records \(p+q\) but does not distinguish positive from negative directions. For example, \(\operatorname{diag}(1,1)\) and \(\operatorname{diag}(1,-1)\) both have rank \(2\), but their inertias are \((2,0,0)\) and \((1,1,0)\). Sylvester’s Law therefore rules out congruence.

Common mistake: confuse congruence with row reduction. Starting from \(\mathbf{A}=\operatorname{diag}(1,-1)\), the row operation \(R_2\to -R_2\) changes the matrix to \(\operatorname{diag}(1,1)\). It may look like this proves the matrices are equivalent, but it is not a congruence calculation: the required operation is \(\mathbf{P}^{\top}\mathbf{A}\mathbf{P}\), with the same invertible \(\mathbf{P}\) on both sides. The two matrices have different inertia, so no such \(\mathbf{P}\) exists. Always verify the full congruence product, not just a row-reduced matrix.

There is also no requirement that the diagonal entries of congruent matrices match in magnitude. The previous construction carries \(\operatorname{diag}(1,1,-1)\) to \(\operatorname{diag}(4,9,-25)\), because the rescaling factors multiply each diagonal entry on both sides. What cannot be changed is the number of positive, negative, and zero directions. This distinction is the practical point of the classification: normalize magnitudes freely, but preserve and compare the three sign counts.

Check Your Understanding

For each question, use congruence products and sign counts rather than row operations alone.

  1. What is the inertia of \(\operatorname{diag}(-3,0,2,5)\), and what canonical diagonal matrix has that inertia?
  2. Can \(\operatorname{diag}(1,-1,0)\) be congruent to \(\operatorname{diag}(4,9,0)\)? Explain using inertia.
  3. Find a diagonal rescaling that carries \(\operatorname{diag}(2,-3)\) to \(\operatorname{diag}(8,-12)\) by congruence.
  4. If \(\mathbf{P}^{\top}\mathbf{A}\mathbf{P}=\mathbf{J}\) and \(\mathbf{Q}^{\top}\mathbf{B}\mathbf{Q}=\mathbf{J}\), verify that \(\mathbf{P}\mathbf{Q}^{-1}\) carries \(\mathbf{A}\) to \(\mathbf{B}\).
  5. Why does equality of ranks alone fail to classify real symmetric matrices under congruence?

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon