Congruency of permuted diagonal matrices I have been working on this problem: "Prove that if the diagonal entries of a diagonal matrix are permuted, then the resulting diagonal matrix is congruent to the original one."
I'm hoping someone can just point out a good direction to go in with it.  Here's what I have tried (and failed at) so far: I have tried sandwiching a $2 \times 2$ matrix between a matrix and its transpose and worked out the product to try to find a matrix that could be generalized to the $n \times n$ case.
I also briefly hoped that any diagonal matrix and one obtained by permuting its elements would both be congruent to a matrix with $1$'s, $-1$'s, and $0$'s along the diagonal (described by my book as a canonical form for the real symmetric matrices), and congruence would then follow by congruency forming an equivalence relation and then transitivity, but this only applies (as I just said) to real symmetric matrices and does not hold for all fields.
I have also tried treating the matrix as a bilinear form and then finding a basis for which the matrix representation is a permuted version of the matrix, in which case the two matrices are congruent by the appropriate change-of-basis matrix.  I got this to work out, but it involves division by the original diagonal entry and thus falls apart when that entry is zero.
I haven't found a solution yet, and not for lack of trying...  Can someone point me in the right direction?
 A: Hint 1. If $A$ has diagonal entries $d_1,\ldots,d_n$, and $B$ has diagonal entries $d_{\tau(1)},\ldots,d_{\tau(n)}$, where $\tau$ is a permutation of $\{1,\ldots,n\}$, and if $\mathbf{e}_1,\ldots,\mathbf{e}_n$ are the standard basis vectors, then $A\mathbf{e}_i = d_i\mathbf{e}_i$, and $B\mathbf{e}_{\tau(i)} = d_i\mathbf{e}_{\tau(i)}$. What if we try shuffling the standard basis?
Hint 2. Consider first the case in which we exchange only two diagonal entries; then remember something about permutations vs. transpositions.
A: Permuting the diagonal entries of a diagonal matrix $D$ amounts to permuting the rows of that matrix and permuting its columns in the same way (thus keeping the original diagonal entries someplace on the diagonal).
Now those elementary row operations/elementary column operations amount to multiplying D on the left by $P$ and on the right by $Q$, where $P$ is the result of permuting the rows of identity matrix $I$ and $Q$ the result of permuting the columns of $I$, using the same permutation needed above.
Now $P$ turns out to be the transpose (and inverse) of $Q$ (these permutation matrices are orthogonal matrices).  It's easy to verify this since applying both row and column permutations to $I$ gives back diagonal matrix $I$.
So $PDQ = Q^T DQ$ is indeed congruent to $D$.
