$\operatorname{rank}(A) = \operatorname{rank}(B)$, Prove there exist $U, V$ invertible matrices such that: $A = UBV$ $\DeclareMathOperator{\rank}{rank}$$\DeclareMathOperator{\Mat}{Mat}$Given two matrices $A, B \in \Mat_{m \times n}$ , as $\rank(A) = \rank(B)$. 
Prove there exist two invertible matrices: $$U \in \Mat_{m \times m}, V \in \Mat_{n \times n}$$ 
such that: $$A = UBV$$
My attempt: 
this question essentially is to prove that multiplying a matrix of the left side is equivalent to be preforming operations on the rows, and multiplying a matrix to the right side is  equivalent to be preforming operations on the columns.
I don't know how to prove this - so I tried using Linear maps and to prove that using linear mapps, which was so effective - as this does not "proves" that for every $A, B$ with an equal rank, there exist $U, V$ so that $A = UBV$.
 A: Linear maps make this easier (in my opinion).
As $\operatorname{rank}(A)=\operatorname{rank}(B)$, the "column" subspaces $A(\mathbb{R}^n)$ and $B(\mathbb{R}^n)$ have the same dimension. Let $U$ be any linear isomorphism from $A(\mathbb{R}^n)$ to $B(\mathbb{R}^n)$. Extend $U$ to a linear isomorphism of $\mathbb{R}^m$.
Now let $v_1,\ldots,v_k\in\mathbb{R}^n$ such that $Av_1,\ldots,Av_k$ form a basis for $A(\mathbb{R}^n)$. Then $UAv_1,\ldots,UAv_k$ form a basis for $B(\mathbb{R}^n)$. Choose $w_1,\ldots,w_k\in\mathbb{R}^n$ such that $Bw_i=UAv_i$.
Both $\ker(A)$ and $\ker(B)$ have dimension $n-\dim(\operatorname{rank}(A))=n-k$. Let $v_{k+1},\ldots,v_n$ be a basis for $\ker(A)$, and $w_{k+1},\ldots,w_n$ be a basis for $\ker(B)$. Then $\left\{v_1,\ldots,v_n\right\}$ and $\left\{w_1,\ldots,w_n\right\}$ are bases of $\mathbb{R}^n$. Define a linear isomorphism $V:\mathbb{R}^n\to\mathbb{R}^n$ on the basis as $Av_i=w_i$. Then $A=U^{-1}BV$.
A: If $r$ is the common rank, pushing just a little bit more the RREF you get that there are invertibile $U_{1}, V_{1}$ such that
$$
U_{1} A V_{1}
=
C_{r}
=
\begin{bmatrix}
1 \\
& 1\\
&&&\ddots\\
&&&&1\\
&&&&&0\\
&&&&&&\ddots\\
&&&&&&&0& \dots\\
\end{bmatrix},
$$
where there are $r$ ones in $C_{r}$, and unnamed entries are zero.
Similarly, there are invertibile $U_{2}, V_{2}$ such that
$$
U_{2} B V_{2}
=
C_{r}.
$$
Now the two expressions are equal, so that...
A: Hint: prove that any matrix $A$ of rank $r$ can be transformed to
$$
A=U\begin{bmatrix}I_r & 0\\0 & 0\end{bmatrix}V
$$
by invertible $U$, $V$. (One way to do it quickly is SVD).
