# How do I know if a matrix is diagonalizable by congruence?

Let V be a unitary space over $$\mathbb{C}^n$$ with an orthonormal basis $$K$$.
Let $$A: V \times V \rightarrow \mathbb{C}$$ be a sesquilinear form.

If there exists a basis $$B$$ in $$V$$ such that $$[A]_B$$ is diagonal, what does that mean for the matrix $$[A]_K$$? What are the necessary conditions for $$B$$ to exist? And is there a general algorithm to find one?

I know that if $$[A]_K$$ is hermitian, or more generally normal, there always exists an orthonormal base $$B$$ which satisfies this. But what if $$[A]_K$$ isn't normal?

Just to be clear, I'm asking about the diagonalization by congruence, rather than by similarity. The diagonal matrix $$[A]_B$$ has to meet this condition: $$[A]_K = R^+ \; [A]_B \; R,$$ where $$R$$ is a regular matrix and $$R^+$$ its conjugate transpose.

If $$[A]_B$$ is diagonalisable by congruence, of course $$[A]_K$$ is also diagonalisable by congruence, because the matrices of a sequilinear form are related by congruences.
So, the basic question is, when is a complex square matrix diagonalisable by congruence? Note that this is not always possible. E.g. if $$e_1e_2^T=\pmatrix{0&1\\ 0&0}$$ is diagonalisable by congruence, there will exist an invertible $$P$$ and some $$z\ne 0$$ such that $$(P^\ast e_1)(P^\ast e_2)^\ast=P^\ast e_1e_2^TP=\pmatrix{z\\ &0}=ze_1e_1^T\ne0,$$ meaning that both $$P^\ast e_1$$ and $$P^\ast e_2$$ are scalar multiples of $$e_1$$. But this is impossible because $$P$$ is invertible. Thus $$e_1e_2^T$$ is not diagonalisable by congruence.
In general, let $$M=H_1+iH_2$$, where $$H_1$$ and $$H_2$$ are Hermitian. Then $$M$$ diagonalisable by congruence if and only if $$H_1$$ and $$H_2$$ are simultaneously diagonalisable by congruence.
Here is a known result. When at least one of $$H_1$$ and $$H_2$$ is nonsingular, they are simultaneously diagonalisable by congruence (and hence $$M$$ is diagonalisable by congruence) if and only if $$H_k^{-1}H_{3-k}$$ is similar to a real diagonal matrix. For details, see the section on "Congruence and simultaneous diagonalization" or more specifically, theorem 4.5.15 of Horn and Johnson, Matrix Analysis, first edition, 1985, p.228 (theorem or page numbers may be different in the second edition).
• Thanks for the answer. I'm not sure how the first paragraph is relevant, since I'm not asking for $[A]_B$ to be diagonalizable, but diagonal, so the question really is about the diagonalizability of $[A]_K$, trivially so. Also, I don't understand what $H_k$ and $H_{3-k}$ are. I'll look into Congruence and simultaneous diagonalization, but the answer should be clear on its own.
• @m93a (1) Diagonal matrices are diagonalisable (because they are already diagonal). So, if $[A]_B$ is diagonal, then $[A]_K$ is diagonalisable by congruence. (2) $H_k^{-1}H_{3-k}$ is $H_1^{-1}H_2$ (when $k=1$) or $H_2^{-1}H_1$ (when $k=2$), depending on which $H_k$ is invertible. Jun 17, 2019 at 12:57