characterize all matrices $X$ such that $BA = X$ whenever $AB = X$ It is clear that if $A$ and $B$ are $n\times n$ matrices (over a field) with $AB = I$ then $BA = I$. I like to characterize all matrices $X$ such that $BA = X$ whenever $AB = X$. 
 A: If $AB=X$ then we have $BAB=BX$. So $BA=X$ can only follow if $BX=XB$ for all $B$. Therefore $X$ has to be in the center of the general linear group which is all multiples of the identity matrix $I$.
A: Hint: Let $a\ne 0,a\ne 1, \ 1\le k\le n$, $A=(a_{ij})$ where 
$$a_{ij}=0 \ {\rm for} \ i\ne j,$$ 
$$a_{kk}=a, $$ 
$$a_{ii}=1 \ {\rm for} \ i\ne k.$$ 
We can find $B$ such that $X=AB$. Then from $X=BA$ we get that $X$ is diagonal.
A: Hint. Suppose $n>1$ (the case $n=1$ is trivial and the answer is a bit different from that for $n>1$). The given condition implies that $AX=XA$ whenever $AB=X$. Now consider $A=I+E_{ij}$, where $i\ne j$ and $E_{ij}$ is the matrix whose $(i,j)$-th entry is $1$ and all other entries are zero. From the above discussion, argue that $E_{ij}X=XE_{ij}$. Entrywise, this means $x_{ii}=x_{jj}$ and all off-diagonal entries on row $j$ or column $i$ of $X$ are zero. Hence conclude that $X$ is a scalar multiple of the identity matrix. Finally, identify which scalar multiples of $I_n$ satisfy the given condition (not all of them do). This should be easy.
A: From mathworld.wolfram
"matrix multiplication is not, in general, commutative (although it is commutative if A and B are diagonal and of the same dimension)."
So if for example
$$A=\left(\begin{array}{ccc} 1 & 0 & 0\\ 0 & 2 & 0\\ 0 & 0 & 3 \end{array}\right)$$
and
$$B=\left(\begin{array}{ccc} 4 & 0 & 0\\ 0 & 5 & 0\\ 0 & 0 & 6 \end{array}\right)$$
then 
$$AB=BA=\left(\begin{array}{ccc} 4 & 0 & 0\\ 0 & 10 & 0\\ 0 & 0 & 18 \end{array}\right)$$
