deformation retract of $GL_n^{+}(\mathbb{R})$

Here is a geometric way to see this. To any ordered basis $(v_1,v_2,\ldots,v_n)$ of your vector space $V$ associate the "flag" of subspaces $V_0=\{0\}$, $V_1=\langle v_1\rangle$, $V_2=\langle v_1,v_2\rangle$, ... $V_n=\langle v_1,v_2,\ldots,v_n\rangle=V$. The Gram-Schmidt algorithm turns any such basis into an orthonormal basis $(b_1,\ldots,b_n)$ that gives rise to the same flag of subspaces. It is moreover the unique such basis (orthonomal and with the same flag) for which in addition each $b_i$, inside $V_i$, is on the same side of the hyperplane $V_{i-1}$ as the original basis vector $v_i$.

Now taking $V=\Bbb R^n$ we can identify $GL_n^+(\Bbb R)$ with the set of ordered bases $(v_1,v_2,\ldots,v_n)$ with $\det(v_1,v_2,\ldots,v_n)>0$, and $SO(n)$ with the set of ordered orthonormal bases $(b_1,b_2,\ldots,b_n)$ with $\det(b_1,b_2,\ldots,b_n)>0$. Now for such a basis $(v_1,v_2,\ldots,v_n)$ let $(b_1,\ldots,b_n)$ be the orthonormal basis associated to it under Gram-Schmidt, and simultaneously (or successively if you prefer) deform every $v_i$ linearly to $b_i$, as $t\mapsto (1-t)v_i+tb_i$. The intermediate vectors stay inside $V_i$, and since $b_i$ is on the same side as $v_i$, they never enter $V_{i-1}$. This means the deformed vectors stay linearly independent at all times, so the deformation takes place inside $GL_n(\Bbb R)$. As the determinant cannot vanish anywhere we have $\det(v_1,v_2,\ldots,v_n)>0\implies \det(b_1,b_2,\ldots,b_n)>0$ and we have a deformation retract of $GL_n^+(\Bbb R)$ to $SO(n)$. It is in fact a strong deformation retract: elements of $SO(n)$ remain fixed.


By QR decomposition you can write any $A \in \textrm{GL}_n^+ (\Bbb{R})$ as an orthogonal matrix $Q$ times an upper triangular matrix $R$ which you can arrange to be such that $\det Q = 1$. Clearly you can homotope $R$ to the identity matrix and thus $\textrm{GL}_n^+(\Bbb{R})$ deformation retracts onto $\textrm{SO}(n)$.

If you want an explicit deformation retract, you can take the function $F : \textrm{GL}_n^+(\Bbb{R}) \times I \to \textrm{SO}(n)$ given as follows. Write any $A$ in the connected component of the identity as $A= QR$ with $R = (a_{ij})$ upper triangular with entries on the diagonal all positive. Then

$$F(A,t) = Q\times \left(\begin{array}{ccccc} (t) + (1-t)a_{11} & (1-t)a_{12} & \ldots & (1-t)a_{1n} \\ 0 & (t) + (1-t)a_{22} & \ldots & (1-t) a_{2n} \\ & \ddots& \vdots \\ &&\ddots \\ && &t + (1-t)a_{nn} \end{array}\right)$$

is the required deformation retract.

You should note that the same proof shows that $\textrm{GL}_n(\Bbb{C})$ deformation retracts onto $\textrm{U}(n)$.