have the same number of positive, negative and zero eigenvalues if and only if they are congruent (, for some non-singular ). The positive and negative indices of a symmetric matrix A are also the number of positive and negative eigenvalues of A. Any symmetric real matrix A has an eigendecomposition of the form QEQT where E is a diagonal matrix containing the eigenvalues of A, and Q is an orthonormal square matrix containing the eigenvectors. The matrix E can be written E = WDWT where D is diagonal with entries 0, +1, or −1, and W is diagonal with Wii = √|Eii|. The matrix S = QW transforms D to A. Law of inertia for quadratic forms In the context of quadratic forms, a real quadratic form Q in n variables (or on an n-dimensional real vector space) can by a suitable change of basis (by non-singular linear transformation from x to y) be brought to the diagonal form with each ai ∈ {0, 1, −1}. Sylvester's law of inertia states that the number of coefficients of a given sign is an invariant of Q, i.e., does not depend on a particular choice of diagonalizing basis. Expressed geometrically, the law of inertia says that all maximal subspaces on which the restriction of the quadratic form is positive definite (respectively, negative definite) have the same dimension. These dimensions are the positive and negative indices of inertia. Generalizations Sylvester's law of inertia is also valid if A and B have complex entries. In this case, it is said that A and B are *-congruent if and only if there exists a non-singular complex matrix S such that , where * denotes the conjugate transpose. In the complex scenario, a way to state Sylvester's law of inertia is that if A and B are Hermitian matrices, then A and B are *-congruent if and only if they have the same inertia, the definition of which is still valid as the eigenvalues of Hermitian matrices are always real numbers. Ostrowski proved a quantitative generalization of Sylvester's law of inertia: if A and B are *-congruent with , then their eigenvalues λi are related by where θi are such that λn(SS*) ≤ θi ≤ λ1(SS*). A theorem due to Ikramov generalizes the law of inertia to any normal matrices A and B: If A and B are normal matrices, then A and B are