# What Is the Inertia of a Matrix?

The inertia of a real symmetric $n\times n$ matrix $A$ is a triple, written $\mathrm{In}(A) = (i_+(A),i_-(A),i_0(A))$, where $i_+(A)$ is the number of positive eigenvalues of $A$, $i_-(A)$ is the number of negative eigenvalues of $A$, and $i_0(A)$ is the number of zero eigenvalues of $A$.

The rank of $A$ is $i_+(A) + i_-(A)$. The difference $i_+(A) - i_-(A)$ is called the signature.

In general it is not possible to determine the inertia by inspection, but some deductions can be made. If $A$ has both positive and negative diagonal elements then $i_+(A) > 1$ and $i_-(A) > 1$. But in general the diagonal elements do not tell us much about the inertia. For example, here is a matrix that has positive diagonal elements but only one positive eigenvalue (and this example works for any $n$):

>> n = 4; A = -eye(n) + 2*ones(n), eigA = eig(sym(A))'
A =
1     2     2     2
2     1     2     2
2     2     1     2
2     2     2     1
eigA =
[-1, -1, -1, 7]


A congruence transformation of a symmetric matrix $A$ is a transformation $A \to X^T\!AX$ for a nonsingular matrix $X$. The result is clearly symmetric. Sylvester’s law of inertia (1852) says that the inertia is preserved under congruence transformations.

Theorem 1 (Sylvester’s law of inertia).

If $A\in\mathbb{R}^{n\times n}$ is symmetric and $X\in\mathbb{R}^{n\times n}$ is nonsingular then $\mathrm{In}(A) = \mathrm{In}(X^T\!AX)$.

Sylvester’s law gives a way to determine the inertia without computing eigenvalues: find a congruence transformation that transforms $A$ to a matrix whose inertia can be easily determined. A factorization $PAP^T = LDL^T$ does the job, where $P$ is a permutation matrix, $L$ is unit lower triangular, and $D$ is diagonal Then $\mathrm{In}(A) = \mathrm{In}(D)$, and $\mathrm{In}(D)$ can be read off the diagonal of $D$. This factorization does not always exist, and if it does exist is can be numerically unstable. A block $LDL^T$ factorization, in which $D$ is block diagonal with diagonal blocks of size $1$ or $2$, always exists, and its computation is numerically stable with a suitable pivoting strategy such as symmetric rook pivoting.

For the matrix above we can compute a block $LDL^T$ factorization using the MATLAB ldl function:

>> [L,D,P] = ldl(A); D
D =
1.0000e+00   2.0000e+00            0            0
2.0000e+00   1.0000e+00            0            0
0            0  -1.6667e+00            0
0            0            0  -1.4000e+00


Since the leading 2-by-2 block of $D$ has negative determinant and hence one positive eigenvalue and one negative eigenvalue, it follows that $A$ has one positive eigenvalue and three negative eigenvalues.

A congruence transformation preserves the signs of the eigenvalues but not their magnitude. A result of Ostrowski (1959) bounds the ratios of the eigenvalues of the original and transformed matrices. Let the eigenvalues of a symmetric matrix be ordered $\lambda_n \le \cdots \le \lambda_1$.

Theorem (Ostrowski).

For a symmetric $A\in \mathbb{R}^{n\times n}$ and $X\in\mathbb{R}^{n\times n}$,

$\lambda_k(X^*AX) = \theta_k \lambda_k(A), \quad k=1\colon n,$

where $\lambda_n(X^*X) \le \theta_k \le \lambda_1(X^*X)$.

The theorem shows that the further $X$ is from being orthogonal the greater the potential change in the eigenvalues.

Finally, we note that everything here generalizes to complex Hermitian matrices by replacing transpose by conjugate transpose.