Matrices congruence Let $A, B \in \mathbb{C^{n^2}}$ be hermitian matrices.
If $A$ is positive-definite, then there exists an invertible matrix $S\in \mathbb{C}^{n^2}$ such that $S^*AS=I_n$ and $S^*BS$ is a diagonal matrix.
I'm assuming we're supposed to use Sylvester's law of inertia (SLI). In fact finding $S$ which satisfies $S^*AS=I_n$ follows from SLI. But I see no reason why the same $S$ should diagonalize $B$.
Any ideas?
Thanks.
 A: This is more subtle than SLI. The fact in your question is equivalent to the spectral theorem for Hermitian matrices. I will use this formulation of this theorem:
If $X \in \mathbb{C}^{n^2}$ is a Hermitian matrix, then there exists a unitary matrix $Y \in \mathbb{C}^{n^2}$ such that $Y^{-1} X Y$ is a diagonal matrix.
You can see that the theorem can be obtained as a consequence from your statement if you take $A=I$ and $B=X$. It can also be reverted: you can prove your statement using this theorem. Can you see how?
As for the spectral theorem itself, it should be proved in the book you're reading (or the course you're attending, or whatever other resources you're using).
UPDATE: OK, here are a few details on how to derive the statement in the question from the spectral theorem.
First, there exists an invertible matrix $P$ such that $P^*AP=I$. Consider matrix $B'=P^*BP$. Clearly, $B'$ is Hermitian. By the spectral theorem, there is a unitary matrix $Q$ such that $Q^*B'Q=D$ is diagonal. Now we say that matrix $S=PQ$ has the required properties. Indeed:
$$
    S^*AS=Q^*P^*APQ = Q^*Q = I,
$$
(here we used that $Q$ is unitary), and
$$
   S^*BS=Q^*P^*BPQ = Q^*B'Q = D.
$$
A: What you mentioned is a standard result in matrix theory. If $A$ is positive definite, it can be unitarily diagonalized as $A=UDU^\ast$, where $D$ is a positive diagonal matrix. So, $A$ has a Hermitian square root $A^{1/2}:=UD^{1/2}U^\ast$, where $D^{1/2}$ is the entrywise square root of $D$.
Now consider $A^{-1/2}BA^{-1/2}$. This is Hermitian. Hence it can be unitarily diagonalized as $A^{-1/2}BA^{-1/2} = V\Lambda V^\ast$, where $\Lambda$ is a real diagonal matrix. Now take $S = A^{-1/2}V$ (hence $S^\ast=V^\ast A^{-1/2}$) and the result follows.
Both this result and Sylvester's law of inertia follow from unitary diagonalization of Hermitian matrices, but each of these two results does not depend on the other.
