$A^TA=B^TB$ implies $\exists P \in M_{m\times m}(\Bbb{R})$. such that $A=PB$,where $P$ is an orthogonal matrix Assume $A,B \in M_{n\times m}(\Bbb{R})$,and $A^TA=B^TB$,show that there exists an orthogonal matrix $P$, such that $A=PB$. 
 A: Note that the condition implies $\langle x, A^TAy \rangle = \langle Ax, Ay \rangle = \langle x, B^TBy \rangle = \langle Bx, By \rangle$ for all $x,y$. Letting $x=y$ shows that $\|Ax\| = \|Bx\|$, hence we have $\ker A = \ker B$.
Let $\alpha_1,...,\alpha_r$ be an orthonormal basis for $ {\cal R} A$. Now choose  $v_i \in (\ker A)^\bot$ such that $A v_i = \alpha_i$.
Define $\beta_i = B v_i$. I claim that the $\beta_i $ form an orthonormal basis for ${\cal R} B$. The above shows that $ \langle Av_i, Av_j \rangle =  \langle Bv_i, Bv_j \rangle$, from which we get $ \langle \alpha_i, \alpha_j \rangle =  \langle \beta_i, \beta_j \rangle$, from which it follows that the $\beta_i $ are orthonormal.
Since $\ker A = \ker B$, we have $\dim {\cal R} A = \dim {\cal R} B$, from which it follows that the $\beta_i $ are orthonormal basis for ${\cal R} B$.
Now complete the respective bases so that $\alpha_1,...,,\alpha_n$ and $\beta_1,...,\beta_n$ form orthonormal bases for $\mathbb{R}^n$,
and define $P$ by $P \beta_i = \alpha_i$.
Then we have $\langle \alpha_i, \alpha_j \rangle = \langle P \beta_i, P \beta_j \rangle = \langle \beta_i, P^TP \beta_j \rangle = \langle \beta_i, \beta_j \rangle$, $i=1,...,n$. This shows
that $P^T Px = x$ for all $x$, hence we have $P^T P = I$.
