Assume $ A,B\in M_{m,n}\left(\mathbb{F}\right)$. I want to ask about the following theorem:

$ \operatorname{rank}\left(A\right)=\operatorname{rank}\left(B\right)\iff $ There exists $ X\in M_{m}\left(\mathbb{F}\right),Y\in M_{n}\left(\mathbb{F}\right) $ so that $ B=XAY $

The direction $\Leftarrow$ is clear since multipication by nonsingular matrix does not change the rank, but I want to ask about the direction $\Rightarrow$.

Assume that the ranks of $A,B $ are equal, basically it means that by elementary operations (such as adding a constant times line to another line, exchanging lines etc) we can get from $A$ to $B$. Now, elemntary operations can be translated to a multipication by nonsingular matrix (the same matrix we get by using the same operations on the identity matrix), so why the equivalent condition is that $ B=XAY $ and not $ B=XA $ where $ X $ is the matrix we get by using the elementary operations on the identity?

(If my explanation is not the actual proof for the second direction, I'd really appreciate an explanation for the correct proof).

Thanks in advance.

## Best Answer

You forgot the column operations. In general, it is

nottrue that two matrices $A$ and $B$ of same rank can be obtained from each other using only row operations.Example.Let $A=\begin{pmatrix}0 & 1 \cr 0 & 0\end{pmatrix}$. If $X=\begin{pmatrix}a & b \cr c & d\end{pmatrix}$, then $XA=\begin{pmatrix}0 & a \cr 0 & c\end{pmatrix}$.In particular, if $B=\begin{pmatrix}1 & 0 \cr 0 & 0\end{pmatrix}$, you have $B\neq XA$ for all $X\in \mathrm{M}_2(K)$ (where $K$ is any field), while $rank(A)=rank(B)=1$.