# What are the components of a transpose operator from $\mathbb R^{n\times n}$ to $\mathbb R^{n\times n}$?

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.

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)

• What you describe looks like a 2x2x2x2 tensor. What's the way to talk about applying this 2x2x2x2 object to the 2x2 matrix? Neither a simple inner or outer product gives the right resulting 2x2 dimension for the transpose. – Rhys Ulerich Nov 5 '09 at 16:56
• It's an inner product, but contracting over two indices. So if you write the transpose matrix as T_{ijkl} and b is the transpose of a, then b_{ij} = T_{ijkl}a_{kl} where T is as I describe. – Dan Piponi Nov 5 '09 at 17:29
• Also known as perfect shuffle or commutation matrix – Federico Poloni Nov 19 '18 at 23:34

Would it help for you to think of a matrix as a "big vector"? To see what I mean, if your matrix has components $$a_{ij}$$, then you could write $$A = \sum_{i,j} a_{i,j} E_{ij}$$, where $$E_{ij}$$ is a matrix which has all entries as zeros, except having a unity at position $$(i,j)$$. Then your matrix space can be identified with a real Euclidean space $$R^{n\times n}$$, where your matrix $$A$$ would have its counterpart, call it $$a = (a_{11}, ..., a_{1n}, a_{21}, ..., a_{nn})$$. In effect, you are just "stacking" rows/columns of the matrix on top of each other. The transposition operator would then be a linear operator $$T: \mathbb R^{n\times n} \to \mathbb{R}^{n\times n}$$, i.e., a matrix with $$n^4$$ entries, and it would be a permutation matrix. Then you could transpose your original matrix by passing through this representation as $$A \to a \to Ta \to A^T$$. The switch from the first (A) to the second representation (a), and back, could be done via the "reshape" command in Matlab.

There is no linear operator that acts via left multiplication to produce a transposition. What you ask for is impossible. You require the notion of "superoperator", i.e. an operator that acts on operators. EDIT: upon a second read, perhaps you are asking for the superoperator itself?

• Yes, I'm looking for the higher order superoperator. – Rhys Ulerich Nov 4 '09 at 23:41

The previous answer is the simplest way, it will represent transpose by an $$n^2$$ by $$n^2$$ permutation matrix $$P$$, where $$P^2 = I$$. I think the matlab command you need is vec(A), which converts $$A$$ to a vector.

For another viewpoint we "recall" that each linear map from the vector space $$M$$ of $$n \times n$$ matrices to itself is determined by two sequences of $$n$$ by $$n$$ matrices $$A_1,\dots, A_r$$ and $$B_1,\dots ,B_r$$, where $$r \le n$$. The corresponding linear map sends a matrix $$X$$ to

$$\sum_i A_i XB_i^T.$$

(This is what a physicist would call a super-operator.) This is all basic tensor algebra, but you could prove my claim by showing the maps just defined form a vector space of dimension $$n^4$$, and so must coincide with the the space of linear maps from $$M$$ to itself.

If the map is invertible and preserves multiplication, only one term is needed in the sum. The trace map is invertible but does not preserve multiplication, so more than one term is needed. Now your problem to choose the $$A_i$$'s and $$B_i$$'s so that the matrix $$E_{i,j}$$ is mapped to $$E_{j,i}$$. I am afraid I am leaving this an exercise.