Just a little warning: my english is not that good so the text below can be really confusing.
How can I proof that every hermitian matrix, $H\in C^{n\times n}$, is congruent to a matrix: \begin{align} D_0= \begin{pmatrix} I_{s} & 0 & 0 \\ 0 & -I_{r-s} & 0 \\ 0 & 0 & 0_{n-r} \end{pmatrix} \end{align} where $r = \text{rank}H$ and s is the number of positive eigenvalues.
In the book that I am reading there is a proof that starts using that $H$ is unitarily similar to a diagonal, $H = UDU^{*}$, and, so, it uses a permutation, $U_1$, to move the columns of $U$ so that $H = UU_1D_1U_1^*U^*$ where the positive eigenvalues are in the first $s$ rows of $D_1$, the negative in the next $r-s$ rows and the $0$s in the $n-r$ last rows. At the end, it remembers that if $D_2 = diag[\sqrt{|\lambda_i|}]$ then $D_1 = D_2D_0D_2$ and so $H = (UU_1D_2)D_0(UU_1D_2)^* = PD_0P^*$.
The proof looks good, but if $H$ is singular then $D_2$ and $P$ are singular, so what I think that should resolve this is just replace the $0$s in the $D_2$ diagonal by $1$s.
I want to know who is wrong in this history: me, the book or both.