Linear Algebra

Sylvester’s Law of Inertia

Compare eigenvalue sign counts and quadratic forms under an invertible congruence.

By Riano · Published · Updated · Report a correction

Signs survive a change of coordinates

For a real symmetric matrix, inertia is the ordered triple of positive, negative and zero eigenvalue counts. A congruence A = STDS with invertible S preserves those counts. It need not preserve the eigenvalues themselves, unlike similarity.

A shear of an indefinite form

Take D = diag(1,−1) and S = [[1,1],[0,1]]. Its determinant is 1, so S is invertible.

  1. First DS = [[1,1],[0,−1]]. Multiplying on the left by ST gives A = [[1,1],[1,0]].
  2. The characteristic polynomial is λ2 − λ − 1, so the eigenvalues are (1 − √5)/2 and (1 + √5)/2, approximately −0.618034 and 1.618034.
  3. One eigenvalue is negative and one positive. Both A and D have inertia (1,1,0), although D has eigenvalues −1 and 1.
  4. For x = [1,1], Sx = [2,1]. Thus (Sx)TD(Sx) = 22 − 12 = 3 and xTAx = 1 + 2 = 3.

Reproduce the coordinate change

Open Sylvester’s Law of Inertia and compare the matrices and quadratic-form cards.

  1. Click Reset. The controls d1 = 1, d2 = −1, S11 = 1, S12 = 1, S21 = 0, S22 = 1 and x1 = x2 = 1 reproduce the worked example: A inertia (1,1,0), both forms 3.
  2. Set d1 to 0 and d2 to −2. Set S11 to 2 and S21 to 1, leaving S12 = S22 = 1. A becomes [[−2,−2],[−2,−2]], with eigenvalues −4 and 0 and inertia (0,1,1).
  3. Set x1 to 0 and x2 to 2. Sx = [2,2] and both quadratic forms equal −8. Changing x tests equality without changing inertia.
  4. Set S11 to 1, S12 to 2, S21 to 1 and S22 to 2. The rows coincide and det S = 0; the app stops asserting inertia preservation.
  5. Click Reset, then set d1 = d2 = 0. A is the zero matrix, inertia is (0,0,2), and both forms vanish.

Invertibility matters

This is a real symmetric 2×2 experiment with diagonal D and bounded integer S. Singular S is outside the theorem’s coordinate-change domain. Singular D is allowed: zero directions are preserved when S is invertible. A zero matrix is not positive definite. The view computes the small matrix explicitly, rather than implementing an LDL factorization for arbitrary input matrices. Eigenvalue displays are rounded; exact integer trace and determinant determine sign counts.

The congruence theorem

Nick Higham, What Is the Inertia of a Matrix? defines the ordered sign counts and states Sylvester’s law for nonsingular congruence transformations. It also explains that magnitudes need not survive. The shear, vector calculations and bounded controls above are this module’s own example.

Experience it interactively

Adjust parameters, observe in real time, and build deep intuition with Riano’s interactive Sylvester’s Law of Inertia module.

Try Sylvester’s Law of Inertia on Riano →

More in Linear Algebra