Swap elements of a diagonal matrix

linear algebralinear-transformationsmatrices

Suppose you have a diagonal matrix, e.g.,

$$\begin{bmatrix}
3 & 0 & 0 & 0 \\
0 & 2 & 0 & 0 \\
0 & 0 & 9 & 0 \\
0 & 0 & 0 & 1
\end{bmatrix}$$

What linear transformation (or any method, really) could you apply to get a different matrix, e.g.,

$$\begin{bmatrix}
2 & 0 & 0 & 0 \\
0 & 3 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 9
\end{bmatrix}$$

Where we swap every odd indexed diagonal with the element at (that index + 1)

I think this problem is equivalent to rearranging the eigenvalues and eigenvectors of a matrix with each other. For example moving the eigenvalue $3$ from the vector $$\begin{bmatrix} 1 \\ 0 \\ 0 \\ 0\end{bmatrix}$$ to $$\begin{bmatrix} 0 \\ 1 \\ 0 \\ 0\end{bmatrix}$$

This seems like a trivial question, but I can't find a solution myself.

Best Answer

To swap the $i$th and $j$th entires along the diagonal of a diagonal matrix: Using $E_{ij}$ to denote the matrix with $1$ in the $i$th row and $j$th column and $0$ in all other positions, multiply your matrix on both sides by $I - E_{ii} - E_{jj} + E_{ij} + E_{ji}$. (Since this matrix is involutory, this can be viewed as conjugation.)

The matrix for swapping adjacent entries in pairs would look like \begin{pmatrix} A & 0 & \cdots & 0 \\ 0 & A & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & A \end{pmatrix} in block form, where $A = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$.

Related Question