Prove A and B are congruent
where $i_1i_2\text{...}i_n$ is a permutation of $1,2,\text{...},n$


My proof.
Swapping two elements in the diagonal of Matrix A is identical to swapping two rows, and then swapping two columns, thus the same to the effect that multiply A with a elementary matrix from left and right meanwhile.
so an arbitrary permutation of diagonal could be composed by several manipulations above. And the composition matrix of elementary matrices are invertible. Hence there exists invertible matrix $C=C'$ such that $A=C'\text{BC}$
Correct? Welcome alternatives.
In fact, if we let $A=(A_{ij})$ where $$ A=\begin{bmatrix} \lambda_1 & & & \\ & \lambda_2 & & \\ & & \ddots & \\ & & & \lambda_n \\ \end{bmatrix} $$ and $B=(B_{ij})$ where $$ B=\begin{bmatrix} \lambda_{\sigma(1)} & & & \\ & \lambda_{\sigma(2)} & & \\ & & \ddots & \\ & & & \lambda_{\sigma(n)} \\ \end{bmatrix} $$ for some permutation $\sigma$ of $\{1,2,\ldots,n\}$, then $$PAP^T=B$$ where $P=(P_{ij})$ is the permutation matrix for $\sigma$.
To prove this, we see \begin{align*} (PA)_{ij} &= P_{i1}A_{1j}+P_{i2}A_{2j}+\cdots+P_{in}A_{nj} \\ &= A_{\sigma(i)j} \end{align*} since $P_{ij}=1$ if $j=\sigma(i)$ and $P_{ij}=0$ otherwise. Hence \begin{align*} B_{ij} &= (PAP^T)_{ij} \\ &= (PA)_{i1}(P^T)_{1j}+(PA)_{i2}(P^T)_{2j}+\cdots+(PA)_{in}(P^T)_{nj} \\ &= (PA)_{i\sigma(j)} \\ &= A_{\sigma(i)\sigma(j)}. \end{align*} We conclude that $$B_{ii}=A_{\sigma(i)\sigma(i)}=\lambda_{\sigma(i)}$$ for $i \in \{1,2,\ldots,n\}$ and $$B_{ii}=A_{\sigma(i)\sigma(j)}=0$$ for $i,j \in \{1,2,\ldots,n\}$ such that $i \neq j$.
We can see that $P$ is invertible for a range of reasons, e.g., its inverse is the permutation matrix for $\sigma^{-1}$, or it's row equivalent to the identity matrix via swapping rows.
Thus $A$ and $B$ are congruent.