Let $M$ be a $d$-dimensional submanifold of $\mathbb{R}^n$ that verifies $M=\{x\in\mathbb{R}^n:q(x)=0\}$. Now we can show that the normal space of $M$ at $x$ is given by $N_xM=span(Dq(x)^T)$ where $Dq$ is the jacobian of $q$. Then we can recover an orthonormal basis of the tangent space and the normal space by doing a $QR$ decomposition $QR = Dq(x)^T$ (the first d columns gives the basis of $T_xM$ and the last $n-d$ columns give a basis of $N_xM$). Now I was wondering if it was possible to do the same thing if we have a submanifold of $\mathbb{R}^{m\times n}$. For example the orthogonal matrices $O(n)\subset \mathbb{R}^{n\times n}$. Then \begin{align} q:\mathbb{R}^{n\times n}&\to \mathbb{R}^{n\times n}\\ X &\mapsto X^TX \end{align}
and \begin{align} Dq(X) : T_XO(n)&\to T_xO(n)\\ H&\mapsto H^TX+X^TH \end{align}
Now I was wondering if we could use the qr decomposition to compute somehow an orthonormal basis of $T_XO(n)$ and $N_XO(n)$.