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" is the symmetric matrix that defines the quadratic form, and "S" is any invertible matrix such that "D" = "SAS"T is diagonal, then the number of negative elements in the diagonal of "D" is always the same, for all such "S"; and the same goes for the number of positive elements.