Solution (source code)

= Solution

If $A$ is a <Hermitian matrix>, then $(BAB^*)^*=BAB^*$, so $M_B$ preserves $W$. Addition and multiplication by real <scalars> commute with this operation, making $T_B$ a real <linear map>.

A real <basis> of $W$ consists of $E_{ii}$ and, for $i<j$, $E_{ij}+E_{ji}$ and $i(E_{ij}-E_{ji})$. It has $n^2$ elements and is also a complex <basis> of all matrices. Indeed every matrix is uniquely $H+iK$ with $H,K$ <Hermitian matrices>, by taking
$$
H=\frac{A+A^*}{2},\qquad K=\frac{A-A^*}{2i}.
$$
Real linear independence of the displayed <basis> therefore implies complex linear independence. Since its images under $M_B$ are <Hermitian matrices>, the matrix of $M_B$ in this complex <basis> has exactly the same real entries as the matrix of $T_B$ in the real <basis>. Their <determinants> are equal. \b[There is no further squaring when passing to this real subspace:]
$$
\boxed{\det T_B=|\det B|^{2n}.}
$$
This is the <determinant of Hermitian congruence>, including the case of singular $B$.