Say I'm working in the space of linear transformations from $\mathbb R^n$ to $\mathbb R^n$ and I've picked a basis so I can identify with any operator a component matrix in $\mathbb R^{n\times n}$. Transposing an operator swaps components $(i,j)$ and $(j,i)$. In this setting, the transpose operation is itself a linear map from $\mathbb R^{n\times n}$ to $\mathbb R^{n\times n}$.


What does the transpose operator's component representation look like for, say, $n=2$ or $n=3$? Not what does it do when applied, but in what space does it live and what are its actual components?


How does one speak about applying this representation to a matrix? Say $T$ is the transpose representation and I'm applying it to a matrix $A$ to get $TA=A^{T}$. What is precise way to discuss this linear algebra operation in the context of the component representations of both tensors?


Big bonus points for the two lines of Mathematica or Sage to demonstrate the mechanics.



What are the components of a transpose operator from $\mathbb R^{n\times n}$ to $\mathbb R^{n\times n}$?
A linear map from R^{n\*n} to itself can be written as a matrix where its rows and columns are both indexed by pairs (i,j) where i,j are in {1,2,...,n}. The transpose operation is given by the matrix which has a 1 in position ((i,j),(j,i)) and a zero elsewhere. For the 2x2 case we can order the basis on R^(2\*2} as (1,1), (1,2), (2,1), (2,2) and write the matrix as



```
(1 0 0 0)
(0 0 1 0)
(0 1 0 0)
(0 0 0 1)

```

So, we get



```
(a b) -> (a c)
(c d)    (b d)

```

because



```
(a)   (1 0 0 0) (a)
(c) = (0 0 1 0) (b)
(b)   (0 1 0 0) (c)
(d)   (0 0 0 1) (d)

```

