Source: /cirosantilli/sylvester-s-law-of-inertia

= Sylvester's law of inertia
{c}
{wiki}

The main interest of this theorem is in <classifying (mathematics)> the <indefinite orthogonal groups>, which in turn is fundamental because the <Lorentz group> is an <indefinite orthogonal groups>, see: <all indefinite orthogonal groups of matrices of equal metric signature are isomorphic>.

It also tells us that a \x[change of basis]{magic} does not the alter the <metric signature> of a <bilinear form>, see <matrix congruence can be seen as the change of basis of a bilinear form>.

The theorem states that the number of 0, 1 and -1 in the <metric signature> is the same for two <symmetric matrices> that are <congruent matrices>.

For example, consider:
$$
A = \begin{bmatrix}2 & \sqrt{2} \\ \sqrt{2} & 3 \\\end{bmatrix}
$$

The <eigenvalues> of $A$ are $1$ and $4$, and the associated eigenvectors are:
$$
v_1 = [-\sqrt{2}, 1]^T
v_4 = [\sqrt{2}/2, 1]^T
$$
<symPy> code:
``
A = Matrix([[2, sqrt(2)], [sqrt(2), 3]])
A.eigenvects()
``
and from the <eigendecomposition of a real symmetric matrix> we know that:
$$
A = PDP^T =
\begin{bmatrix}-\sqrt{2} & \sqrt{2}/2 \\ 1 & 1\\\end{bmatrix}
\begin{bmatrix}1 & 0 \\ 0 & 4\\\end{bmatrix}
\begin{bmatrix}-\sqrt{2} & 1 \\ \sqrt{2}/2 & 1\\\end{bmatrix}
$$

Now, instead of $P$, we could use $PE$, where $E$ is an arbitrary <diagonal matrix> of type:
$$
\begin{bmatrix}e_1 & 0 \\ 0 & e_2\\\end{bmatrix}
$$
With this, would reach a new matrix $B$:
$$
B = (PE)D(PE)^T = P(EDE^T)P^T = P(EED)P^T
$$
Therefore, with this congruence, we are able to multiply the eigenvalues of $A$ by any positive number $e_1^2$ and $e_2^2$. Since we are multiplying by two arbitrary positive numbers, we cannot change the signs of the original eigenvalues, and so the <metric signature> is maintained, but respecting that any value can be reached.

Note that the <matrix congruence> relation looks a bit like the <eigendecomposition of a matrix>:
$$
D = SMS^T
$$
but note that $D$ does not have to contain <eigenvalues>, unlike the <eigendecomposition of a matrix>. This is because here $S$ is not fixed to having <eigenvectors> in its columns.

But because the matrix is symmetric however, we could always choose $S$ to actually diagonalize as mentioned at <eigendecomposition of a real symmetric matrix>. Therefore, the <metric signature> can be seen directly from <eigenvalues>.

Also, because $D$ is a <diagonal matrix>, and thus symmetric, it must be that:
$$
S^T = S^{-1}
$$

What this does represent, is a general \x[change of basis]{magic} that maintains the matrix a <symmetric matrix>.

Related:
* https://math.stackexchange.com/questions/1817906/sylvesters-law-of-inertia
* https://math.stackexchange.com/questions/1284601/what-is-the-lie-group-that-leaves-this-matrix-invariant
* https://physics.stackexchange.com/questions/24495/metric-signature-explanation