Suppose that $\mathcal{U}$ is a k-dimensional subspace in $\mathbb{R}^n$, and we have two sets of orthonormal basis vectors for it, collected into the columns of a matrix $A\in\mathbb{R}^{n\times k}$ and a matrix $B\in\mathbb{R}^{n\times k}$. It is easy to show that there exists a matrix $Q\in\mathbb{R}^{k\times k}$ such that $A=BQ$. I would like to show that $Q$ is orthogonal -- that is, I want to show that $Q^TQ=QQ^T=I_k$. To show that $Q^TQ=I$ is easy: from $A=BQ$, we have $B^TA = Q$, since $B$ has orthonormal columns. Then, \begin{equation} Q^TQ = A^TBQ = A^TA = I_k, \end{equation} since the columns of $A$ are orthonormal.
I am having trouble showing that $QQ^T=I_k$ also. Namely, \begin{equation} QQ^T = B^TAA^TB, \end{equation} and I'm having trouble showing that $AA^TB=B$. Some other answers on stack exchange indicate that if a matrix has orthonormal columns, then its rows are automatically also orthonormal. I am not sure why that is the case.
Thank you.