$\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$.
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$.