# Finding a matrix representation of the transpose transformation

Define $T : M_{n×n}(\mathbb{R}) → M_{n×n}(\mathbb{R})$ by $T(A) := A^t$.

I know this transformation is linear and just takes a matrix and spits out it's transpose. I also know that the transpose is just a matrix with it's columns and rows swapped; however, I don't know how to form a matrix representation of this transformation for arbitrary $n$.

Any help to get me started would be appreciated!

• Linear transformations only operate on vector spaces Not on a matrix .right? – Shubham Ugare May 26 '15 at 18:49
• @ShubhamUgare $M_{n \times n}(\Bbb R)$ is the vector space of real $(n \times n)$-matrices. – aexl May 26 '15 at 18:50
• I hesitate to call this a duplicate, but this answer is certainly relevant. – Ben Grossmann May 26 '15 at 18:52
• I saw this post also but it didn't answer my question exactly. – David South May 26 '15 at 19:09

Let $e_{ij}$ be the matrix with a value of $1$ at entry $(i,j)$ and zero elsewhere. This is a basis for the space $M_{n \times n}$. Then you can define your transpose operation on that space as follows:

$$T(e_{ij}) = e_{ji}$$

If you want to display this as a matrix you will need to come up with an arbitrary ordering of $\{e_{ij}\}$. Then you can use the above definition to find out which entries are $0$ or $1$.

• Will this transformation matrix change depending upon A ? – Shubham Ugare May 26 '15 at 19:03
• It will not. $A$ is an element of the space on which it acts. – muaddib May 26 '15 at 19:04

$\newcommand{\R}{\mathbb R}$ Just write what you would do for any linear transformation: write a basis for $M(n,\R)$ then find the "effect" of the transformation on its elements. In this case you'll formally have to go through an isomorphism between $M(n,\R)$ and $\R^{n^2}$: you want to represent it as a matrix, so it has to multiply some vectors. These vectors will represent the matrix in a given basis.

I'll make an example just in $M(2,\R)$, for the sake of simplicity. A general matrix in this space is $$M= \begin{pmatrix} a & b \\ c & d \end{pmatrix}.$$ Now, let's choose a basis for the vector space: the obvious (but not the best*) choice is the standard basis $\mathcal S=\{E_{11},E_{12},E_{21},E_{22}\}$ given by $(E_{\mu\nu})_{ij}=\delta_{i\mu}\delta_{j\nu}$, so $$S=\left\{ \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}, \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix}, \begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix}, \begin{pmatrix} 0 & 0 \\ 0 & 1 \end{pmatrix} \right\}.$$ In this basis, the matrix $M$ can be written as $aE_{11}+bE_{12}+cE_{21}+dE_{22}$ so it's easily represented as the vector in $\R^{2^2}=\R^4$ $$v= \begin{pmatrix} a \\ b \\ c \\ d \end{pmatrix}.$$ Now, the transposition (I'll call it $T$) acts on the elements of the basis $\mathcal S$ as follows: $$T(E_{11})=E_{11},\ T(E_{12})=E_{21},\ T(E_{21})=E_{12},\ T(E_{22})=E_{22}.$$ Therefore the matrix associated with $T$ is just $$\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}.$$

* The calculations were simple anyway, but there's a nicer way to do it (according to me, of course); it just requires a bit of knowledge a priori. The matrix vector space $M(n,\R)$ is a direct sum of the space $S(n,\R)$ of symmetric matrices and $A(n,\R)$ of antisymmetric ones: $$M(n,\R)=S(n,\R)\oplus A(n,\R)$$ so a basis of $M(n,\R)$ can be found from these two subspaces. Moreover, $\dim A(n,\R)=\frac12(n-1)n$ and $\dim S(n,\R)=\frac12n(n+1)$.

Now, if $x\in A(n,\R)$ then $T(x)=-x$, and if $y\in S(n,\R)$ then $T(y)=y$, and this is obviously true for the elements of their bases too. So, we form a basis of $M(n,\R)$ consisting of $\frac12n(n+1)$ linearly independent elements from $S(n,\R)$ and $\frac12n(n-1)$ elements from $A(n,\R)$.

The matrix representing $T$ is diagonal in this basis, since symmetric and antisymmetric matrices are all "eigenvectors" of $T$ (and we have a basis of them). So $M$ will have 1 as the first $\frac12n(n+1)$ elements on the diagonal, and $-1$ on the remaining $\frac12n(n-1)$ ones.

I like this method because it is already general for any order $n$ of the matrices, without doing any calculations.

• What would you say is the best choice for the basis? – David South May 26 '15 at 19:10
• I'd say a basis in which the matrix is already diagonal. I'm editing the answer right now to include this ;-) – yellon May 26 '15 at 19:14
• Why is the transformation $4 \times 4$ if the range of the transformation is supposed to be $M_{2\times 2}$? – mavavilj Feb 28 '16 at 19:40
• The vector space of 2x2 matrix has four dimensions (roughly, "one for each component of the matrices), so the transposition is an endomorphisms of a 4-dimensionale vector space, and is represented by a 4x4 matrix. – yellon Feb 29 '16 at 15:23
• But if you were to apply T(x) by T(x) = Ax then you would do (4x4)*(2x2) right? – Wouter Vandenputte Sep 5 '18 at 17:34

Let's consider the case $n = 2$. We have the linear transformation \begin{align*}T: M_{2 \times 2}(\Bbb R) &\to M_{2 \times 2}( \Bbb R) \\ A &\mapsto A^{\mathrm T} \end{align*} \; Now we can identify the vector space $M_{2 \times 2}(\Bbb R)$ with $\Bbb R^{4} = \Bbb R^{2 \cdot 2}$ by identifiying $$\begin{bmatrix} a & b \\ c & d \end{bmatrix} \in M_{2 \times 2}(\Bbb R) \quad \text{with} \quad \begin{bmatrix} a \\ b \\ c \\ d \end{bmatrix} \in \Bbb R^4 \; .$$ Now, we just have to find the images of the standard basis of $\Bbb R^4$: $$\begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix} \mapsto \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix} \, , \quad \begin{bmatrix} 0 \\ 1 \\ 0 \\ 0 \end{bmatrix} \mapsto \begin{bmatrix} 0 \\ 0 \\ 1 \\ 0 \end{bmatrix} \, , \quad \begin{bmatrix} 0 \\ 0 \\ 1 \\ 0 \end{bmatrix} \mapsto \begin{bmatrix} 0 \\ 1 \\ 0 \\ 0 \end{bmatrix} \, , \quad \begin{bmatrix} 0 \\ 0 \\ 0 \\ 1 \end{bmatrix} \mapsto \begin{bmatrix} 0 \\ 0 \\ 0 \\ 1 \end{bmatrix} \; .$$

So now we can represent the linear trasformation $T$ with the representation matrix $$M_T := \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \; .$$

So for $A = \begin{bmatrix} a & b \\ c & d \end{bmatrix} \in M_{2 \times 2}(\Bbb R)$, we get the image of $A$ under $T$ by using our tranformation matrix $A$ by calculating $$\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} a \\ b \\ c \\ d \end{bmatrix} = \begin{bmatrix} a \\ c \\ b \\ d \end{bmatrix} \; ,$$ and this vector is identified with $\begin{bmatrix} a & c \\ b & d \end{bmatrix} = A^{\mathrm T}$.

You can generalize this method for an arbitrary $n \in \Bbb N$.

The transformation can as you said be written as a linear transformation, but in the vector representation of the matrix: $$T(\mathrm{vec}(\mathbf(A))) = \mathbf{P}\mathrm{vec}(\mathbf(A))$$ where $\mathbf{P}\in\mathbb{R}^{n^2\times n^2}$. The matrix $\mathbf{P}$ is a permutation matrix known as a stride permutation or a perfect shuffle matrix. It's a bit more complicated for $\mathbf{A}\in\mathbb{R}^{m\times n}$, but for the $2\times 2$ case this matrix is $$\begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 0 & 1 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 1 \end{pmatrix}.$$ In general the matrix can be written as $\mathbf{I}_m\boxtimes \mathbf{I}_n$ where $\boxtimes$ is the box-product that for $\mathbf{C}\in\mathbb{R}^{m_1\times n_1}$ and $\mathbf{D}\in\mathbb{R}^{m_2\times n_2}$ is defined by $$\mathbf{\mathbf{C}\boxtimes\mathbf{D}}_{(i-1)m_2+j,(k-1)n_1+l}=c_{il}d_{jk}.$$ The box-product is very similar to the Kronecker product.

• @ Peder , you want to write $vec(T(A))=P(vec(A))$. Your remark about the box-product is very interesting; yet , the index $l$ does not appear in the LHS. – user91684 May 26 '15 at 19:59
• Sorry, my mistake. I had mistakenly typed $(k-1)n_1+i$ instead of $(k-1)n_1+l$. The entries on the LHS $(i-1)m_2+j$ can be thought of as the index of $X_{ij}$ in $\mathrm{vec}(X_{i,j})$, and perhaps a better way to write the LHS is $[\mathbf{C}\boxtimes\mathbf{D}]_{(ij),(kl)}$. I hope that makes it clearer. – Peder May 30 '15 at 3:54