How many connected components does $\mathrm{GL}_n(\mathbb R)$ have? I've noticed that $\mathrm{GL}_n(\mathbb R)$ is not a connected space, because if it were $\det(\mathrm{GL}_n(\mathbb R))$ (where $\det$ is the function ascribing to each $n\times n$ matrix its determinant) would be a connected space too, since $\det$ is a continuous function. But $\det(\mathrm{GL}_n(\mathbb R))=\mathbb R\setminus\{0\},$ so not connected.
I started thinking if I could prove that $\det^{-1}((-\infty,0))$ and $\det^{-1}((0,\infty))$ are connected. But I don't know how to prove that. I'm reading my notes from the topology course I took last year and I see nothing about proving connectedness...
 A: Let $G_n$ be the subgroup formed by the elements of $GL_n(\mathbb R)$ whose determinant is positive. 
It suffices to prove that $G_n$ is connected. 
We prove this by induction on $n$. 
The case $n=1$ is trivial. 
Assume that $n$ is at least $2$, and that $G_{n-1}$ is connected. Let $e_1$ be the first vector of the canonical basis of $\mathbb R^n$. 
By the Constant Rank Theorem, the map 
$$
\pi:G_n\to\mathbb R^n\setminus\{0\},\quad g\mapsto ge_1
$$
is a surjective submersion with fiber $G_{n-1}\times\mathbb R^{n-1}$. 
The fiber and the base being connected, so is the total space.
EDIT. To make the answer more complete, let's prove:

If $f:M\to N$ is a surjective submersion in the category of smooth manifolds, if $N$ is connected, and if $f^{-1}(y)$ is connected for all $y$ in $N$, then $M$ is connected. 

Indeed, let $C\subset M$ be a connected component. It suffices to prove that $f(C)$ is closed. 
Let $(c_i)$ be a sequence in $C$ such that $f(c_i)$ tends to some point $f(a)\in N$. 
It is enough to find a sequence $(d_i)$ in $C$ satisfying 
$\bullet$ $f(d_i)=f(c_i)$ for all $i$, 
$\bullet$ $d_i$ tends to $a$.  
There exist an open neighborhood $U$ of $a$ in $M$ and a smooth map $s:f(U)\to U$ such that 
$\bullet$  $f(s(x))=x$ for all $x$ in $f(U)$, 
$\bullet$ $s(f(a))=a$. 
We can assume that each $f(c_i)$ is in $f(U)$. Then it suffices to set $d_i:=f(c_i)$. 
EDIT B. Here is a mild generalization of the previous edit. 

Let $f:X\to Y$ be an open continuous surjection between topological spaces. Assume that $X$ is locally connected, that $Y$ is connected, that $f^{-1}(y)$ is connected for all $y$ in $Y$, and that there is, for each $x$ in $X$, an open neighborhood $U_x$ of $x$ in $X$ and a continuous map $s_x$ from $f(U_x)$ to $U_x$ such that $f\circ s_x$ is the identity of $f(U_x)$. Then $X$ is connected.

Let $C$ be a connected component of $X$. It suffices to show that $f(C)$ is closed. 
Let $x$ in $X$ be such that $f(x)$ is in the closure of $f(C)$. It suffices to show that $x$ is in $C$. 
Let $U$ be an open neighborhood of $x$ in $X$. It suffices to show that $U$ intersects $C$. 
We can suppose $U=U_x$. 
As $f(U)\cap f(C)$ is nonempty, we can pick an element $y$ in this subset. 
Then $s_x(y)$ is in $U$ by construction, and $s_x(y)$ is in $C$ because
$\bullet\ $ $y$ is in $f(C)$, 
$\bullet\ $ $s_x(y)$ is in the connected subspace $f^{-1}(y)$, 
$\bullet\ $ $C$ is a connected component.
A: A proof using action of groups:
Let $GL_n(\mathbb{R})_+= \{ M \in GL_n(\mathbb{R}) \mid \det(M)>0 \}$ act on $\mathbb{R}^n \backslash \{0\}$ in the canonical way; notice that the action is transitive. Let $e_1=(1,0,...,0)$.
Introduce the subgroups $H$ and $K$ defined by $H= \left\{ \left( \begin{array}{cc} 1 & 0 \dots 0 \\ \begin{array}{c} 0 \\ \vdots \\ 0 \end{array} & A \end{array} \right) \mid A \in GL_{n-1}(\mathbb{R})_+ \right\}$ and $G= \left\{ \left( \begin{array}{cc} 1 & a_1 \dots a_{n-1} \\ \begin{array}{c} 0 \\ \vdots \\ 0 \end{array} & I_{n-1} \end{array} \right) \mid (a_1,...,a_{n-1}) \in \mathbb{R}^{n-1} \right\}$. Then the stabilizer of $e_1$ is $HG$, homeomorphic to $G \times H \simeq \mathbb{R}^{n-1} \times GL_{n-1}(\mathbb{R})_+$.
You deduce that $\mathbb{R}^{n}\backslash \{0\}$ is homeomorphic to $GL_n(\mathbb{R})_+ /( \mathbb{R}^{n-1} \times GL_{n-1}(\mathbb{R}_+))$. Finally, you can conclude by induction using the following lemma:

Lemma: Let $G$ be a topological group and $H$ be a subgroup of $G$. If $H$ and $G/H$ are connected, then $G$ is connected.

Proof: Let $f : G \to \{0,1\}$ be a continuous function. Since $H$ is connected, $f$ is constant on the classes of $G$ modulo $H$, hence a continuous function $\tilde{f} : G/H \to \{0,1\}$. But $G/H$ is connected, so $\tilde{f}$ is constant. You deduce that $f$ is constant, hence $G$ is connected. $\square$
A: You can prove directly that $GL^{+}(n,\mathbb{R}):=\{A \in GL(n,\mathbb{R}): \, det(A)>0 \}$ is connected by induction:
The group $GL^{+}(1,\mathbb{R})$ coincides with the interval $]0,\infty[$. Let $n > 1$ and assume that $GL^{+}(n-1,\mathbb{R})$ is connected and let $p: M(n,n,\mathbb{R}) \mapsto \mathbb{R}^{n}$ the projection of a matrix on its first column. Clearly $p$ is continuous and open, so its restriction to the open set $GL^{+}(n,\mathbb{R})$ is an open map and moreover
$p(GL^{+}(n,\mathbb{R}))=\mathbb{R}^{n} \setminus \{0\}$, which is connected.
If we prove that the fibers by $p$ are all connected, we finish. (Because we can apply a theorem according to which if $Y$ is a topological connected space and $f: X \mapsto Y$ is connected and surjective such that $f^{-1}(y)$ is connected for all $y \in Y$ and $f$ is an open or closed map, then $X$ is connected.)
But we see that $p^{-1}(1,0,\dots,0)=\mathbb{R}^{n-1} \times GL^{+}(n-1,\mathbb{R})$, so this fiber is connected. Fix a $y \in \mathbb{R}^{n} \setminus \{0\}$. By surjectivity, $p^{-1}(y) \ne \emptyset$; so let $A \in p^{-1}(y)$. Remember that the application $L_A(B)=AB$ is a homeomorphism of $GL^{+}(n,\mathbb{R})$ to itself. Noticing that $p(AB)=Ap(B)$, then follows that $L_A (p^{-1}(1,0,\dots,0))=p^{-1}(y)$ and, therefore, all the fibers are homeomorphic each other... As we shall prove!
A: Your suspicion is correct, $GL_n$ has two components, and $\det$ may be used to show there are at least two of them. The other direction is slightly more involved and requires linear algebra rather than topology. Here is a sketch of how to do this:
i) If $b$ is any vector, let $R_b$ denote the reflection through the hyperplane perpendicular to $b$. These are all reflections. Any two reflections $R_a, R_b$ with $a, b$ linear independent can be joined by a path consisting of reflections, namely $R_{ta+ (1-t)b}, t\in[0,1]$.  
ii) Any $X\in O^+(n)$ (orthogonal matrices with positive determinant) is the product of an even number of reflections. Since matrix multiplication is continuous $O(n)\times O(n) \rightarrow O(n)$ and by i) you can join any product $R_a R_b$ with $R_a R_a = Id$ it follows that $O^+(n)$ is connected.
iii) $\det$ shows $O(n)$ is not connected.
iv) $O^-(n) = R O^+ (n)$ for any reflection $R$. Hence $O^-(n)$ is connected.
v) Any $ X\in GL_n$ is the product $AO$ of a positive matrix $A$ and $O \in O(n)$ (polar decomposition). Now you only need to show that the positive matrices are connected, which can be shown again using convex combination with $Id$. This proves the claim.
A: Here's another proof. First, by Gram-Schmidt, any element of $\text{GL}_n(\mathbb{R})$ may be connected by a path to an element of $\text{O}(n)$. Second, by the spectral theorem, any element of $\text{SO}(n)$ is connected to the identity by a one-parameter group. Multiplying by an element of $\text{O}(n)$ not in $\text{SO}(n)$, the conclusion follows.
The first part of the proof can actually be augmented to say much stronger: it turns out that Gram-Schmidt shows that $\text{GL}_n(\mathbb{R})$ deformation retracts onto $\text{O}(n)$, so not only do they have the same number of connected components, but they are homotopy equivalent. 
Note that $\text{GL}_n(\mathbb{R})$ is a manifold, hence locally path-connected, so its components and path components coincide. 
A: Yes $GL(\mathbb R^n)$ has exactly two components. An easy proof can be obtained in the following way: Have a look at which elementary operations of the Gauss-algorithm can be presented as paths in $GL(\mathbb R^n)$. Conclude, that any point in $GL(\mathbb R^n)$ can be connected to either $\text{diag}_n(1,1,\dots, 1)$  or $\text{diag}_n(1,1,\dots, -1)$ by a path, where $D = \text{diag}_n(a_1,a_2,\dots, a_n)$ is the diagonal matrix with entries $D_{i,i} = a_i$ and $D_{i,j} = 0$ for $i \neq j$.
A: We will show that $G:=Gl_n({\bf R})^+$, set of matrices of positive
determinant, is path connected.
If $A=[a_1\cdots a_n]\in G$, consider $H:={\bf R}^{n-1}$ which is
spanned by $\{ a_i\}_{i=2}^n$ Here there exists some $v_1=e_i$ or
$-e_i$ s.t.
$$ \angle (v_1,a_1) < \pi $$ where $e_i$ is a canonical basis. Clearly there exists
a path, which do not change sign of determinant, so that we have $$
A_1:=[ v_1\ a_2\cdots a_n]  $$
By repeating this process we have $A_n\in SO(n)$. That is if $SO(n)$
is connected, then we are done
Note the fact that $SO(n)/SO(n-1)=S^{n-1}$. Since $SO(2)$ is
connected, by induction, we complete the proof. 
A: It is as you say: $Gl_n(\mathbb{R})$ has two components, $Gl_n(\mathbb{R})^+$ and $Gl_n(\mathbb{R})^-$. This is theorem 3.68, p.131 in Warner's "Foundations of differentiable Manifolds and Lie Groups". The preview in Google Books contains the relevant pages.
Well, I've added it for comfort:





