I came across an interesting problem in a linear algebra problem book. This is the very first paragraph in the problem book, it deals with basic operations with matrices: multiplication by a number, addition, matrix multiplication, transposition. I solved all the previous problems without much trouble, but I can't do anything with this problem.
Problem. Let $X$ be a matrix of a general form. Is it always possible to find matrices $A$ and $B$ such that $AXB=X^T$?
I used two approaches:
Using a general formula for matrix multiplication. This is a complete nightmare. Double sums come out - a dead end.
Using some specific matrices as $X$. Matrix units seem to be a good option, they are very easy to multiply. But for any matrix unit there will always be $A$ and $B$ such that $AXB=X^T$. Dead end again.
I've seen the questions Is it possible to transpose a square matrix by multiplication? and Can you transpose a matrix using matrix multiplication? but the answers there are not really relevant to my question, I think.
The question is given a real $X$, are there $A,B$ such that $AXB= X^T$?
If $X$ is square then https://math.stackexchange.com/a/94617/27978 shows that $X,X^T$ are similar. This is the tricky part, the rest is straightforward.
If $AXB = X^T$ then $B^T X^T A^T = X$, hence we can assume that $n>m$ (more rows than columns).
Using elementary row operations, we may write $PX = \begin{bmatrix} U \\ 0 \end{bmatrix}$ for some invertible $P$ and $U$ is square & upper triangular. There is some $V$ such that $V U V^{-1} = U^T$.
Then $\begin{bmatrix} V & 0 \end{bmatrix} PX \begin{bmatrix} V^{-1} & 0\end{bmatrix} = \begin{bmatrix} V & 0 \end{bmatrix} \begin{bmatrix} U \\ 0 \end{bmatrix} \begin{bmatrix} V^{-1} & 0\end{bmatrix} = \begin{bmatrix} U^T & 0 \end{bmatrix} = X^T P^T$.
Choosing $A=\begin{bmatrix} V & 0 \end{bmatrix} P$ and $B=\begin{bmatrix} V^{-1} & 0\end{bmatrix} P^{-T}$ gives the desired result.
Original answer (I thought the question was to determine if $A,B$ exist so that $AXB = X^T$ for all $X$.)
It is vacuously true for $1 \times 1$ matrices :-). So suppose we are dealing with $n \times m$ where either $m$ or $n$ are greater than one.
Choose $X= e_i e_j^T$. If we compute the $ab$ entry of $Ae_i e_j^TB=e_j e_i^T$ we get $A_{ai} B_{jb} = \delta_{aj} \delta_{bi}$.
Choosing $a=j, b=i$ gives $A_{ji} B_{ji} = 1$ and so all elements of $A,B$ are non zero. Now suppose either $a \neq j$ or $b \neq i$ (at least one of these possibilities exists) we get $A_{ai} B_{jb} = 0$, a contradiction.