Connected components of real matrices in $M_n(\mathbb R)$ with constant rank $k$ Let $E = \{A \in M_n(\mathbb R): \text{rank}(A) = k\}$. I would like to determine the connected components of $E$. There is a similar question asked here, but the underlying field is $\mathbb C$. 
For $A \in E$, let $A = U\Sigma V^T$ be the singular value decomposition. If we don't require $U, V$ to be orthogonal, then
\begin{align*}
A = M \begin{pmatrix}
I_{k \times k} & 0 \\
0 & 0
\end{pmatrix} N =: M\hat{I}N,
\end{align*}
where $M,N \in GL_n(\mathbb R)$. But $GL_n(\mathbb R)$ has two connected components defined by the sign of determinants, does this mean there are four connected components in $E$ by enumerating all the possibilities of sign of determinants of $M,N$?
If the dimension $n$ is odd, then I think there should be two connected components. Let $\phi: GL_n(\mathbb R) \times GL_n(\mathbb R) \to M_n(\mathbb R)$ be given by $S \times T \mapsto S \hat{I} T$. We can view $E$ as the continuous image of $\phi$. Since $A = M \hat{I} N = (-M) \hat{I} (-N)$ and $\det(-M) = (-1)^{n}\det(M) = -\det(M)$, then the four cases mentioned above should correspond to two connected images.
 A: Let us write $E_k=\{A\in \mathcal M_n(\mathbb R) : \textrm{rank}(A)=k \}$ and and $I_k$ the $k\times k$ identity matrix. 


*

*If $k=0$, $E_k=\{0\}$.

*If $k=n$, then $E_k=GL_n(\mathbb R)$ and you already know that $GL_n(\mathbb R)$ has two connected components given by the sign of the determinant : $$GL_n(\mathbb R) = \{A\in \mathcal M_n(\mathbb R) : \det(A)>0\}\sqcup \{A\in \mathcal M_n(\mathbb R) : \det(A)<0\}$$

*If $k<n$, then one can use the usual decomposition, as mentened by the OP : for any matrix $A$ of rank $k$, there exist $P,Q\in GL_n(\mathbb R)$ such that : $$A=PJQ \quad \text{ with } \ J=\begin{pmatrix} I_k & 0 \\ 0 & 0\end{pmatrix}$$ 
Let's write $\varepsilon=\det(P)$ and $\varepsilon'=\det(Q)$.
By the first case, one has two continuous paths $t\in [0;1] \mapsto P_t\in GL_n(\mathbb R)$ and $t\in [0,1] \mapsto Q_t\in GL_n(\mathbb R)$ satisfying : $$\left\{\begin{array}{l} P_0=P \\ P_1=\begin{pmatrix}1 & & & \\ & \ddots & & \\ & & 1\\ & & & \varepsilon \end{pmatrix} \end{array}\right. \quad \text{ and } \quad \left\{\begin{array}{l} Q_0=Q \\ Q_1=\begin{pmatrix}1 & & & \\ & \ddots & & \\ & & 1\\ & & & \varepsilon' \end{pmatrix} \end{array}\right.$$
Now, consider the continuous path $\gamma:t\in [0,1] \mapsto \mathcal M_n(\mathbb R)$ given by : 
$$\gamma(t)=P_tJQ_t.$$
For any $t\in [0,1]$, $\gamma(t)\in E_k$, $\gamma(0)=A$ and $\gamma(1)=J$: as a consequence, there is only one connected component in $E_k$, it is a connected set.

