Sylvester's law of inertia is a theorem in matrix algebra about certain properties of the coefficient matrix of a real quadratic form that remain invariant under a change of basis. Namely, if A {\displaystyle A} is a symmetric matrix, then for any invertible matrix S {\displaystyle S} , the number of positive, negative and zero eigenvalues (called the inertia of the matrix) of D = S A S T {\displaystyle D=SAS^{\mathrm {T} }} is constant. This result is particularly useful when D {\displaystyle D} is diagonal, as the inertia of a diagonal matrix can easily be obtained by looking at the sign of its diagonal elements.
This property is named after James Joseph Sylvester who published its proof in 1852.