TITLE: Fundamental group of the special orthogonal group SO(n)
QUESTION [38 upvotes]: Question: What is the fundamental group of the special orthogonal group $SO(n)$, $n>2$? 
Clarification: The answer usually given is: $\mathbb{Z}_2$. But I would like to see a proof of that and an isomorphism $\pi_1(SO(n),E_n) \to \mathbb{Z}_2$ that is as explicit as possible. I require a neat criterion to check, if a path in $SO(n)$ is null-homotopic or not.
Idea 1: Maybe it is helpful to think of $SO(n)$ as embedded in $SO(n+1)$ via $A \mapsto \begin{pmatrix} A & 0 \\ 0 & 1 \end{pmatrix}$. The kernel of the surjective map $SO(n+1) \to \mathbb{S}^{n} \subset \mathbb{R}^{n+1}$, $B \mapsto B e_{n+1}$, is then exactly $SO(n)$. Therefore $\mathbb{S}^n \cong SO(n+1)/SO(n)$. The fundamental group of $\mathbb{S}^n$ is trivial. If one knew how the fundamental group of quotients $Y = X / A$ looks like, this could be helpful.
Idea 2: The map $SO(n+1) \to \mathbb{S}^n$ defined above can also be though of as a principal $SO(n)$-bundle. There is an exact sequence of homotopy groups for those bundles, which might provide the result. But the descriptions of the maps in this sequence I found were quite vague.

REPLY [6 votes]: Many of you have mentioned the long exact sequence
$
\pi_2(S^n)\to\pi_1(SO(n))\to\pi_1(SO(n+1))\to\pi_1(S^n),
$
which can be used to show $\pi_1(SO(n))=\pi_1(SO(3))=\pi_1(\mathbb{RP}^3)$, which is $\mathbb{Z}/2$, quite explicitly.
Now the question becomes: how to see the isomorphism $\pi_1(SO(n))\simeq\pi_1(SO(n+1))$ explicity?
Since the map from left to right is simply induced by the inclusion, the nontrivial part is to find its (explicit) inverse.
We can visualize $SO(n+1)$ by orthonormal frame in $\mathbb{R}^{n+1}$ with positive orientation. Suppose we have a loop of frames $(e_1(t),\dots,e_{n+1}(t))$. We can view it as
$(e_1(t),\dots,e_n(t))\in T_{e_{n+1}(t)}S^n\subset TS^n$.
Assume $q\in S^n$ is not on the loop $e_{n+1}(t)$. (If $e_{n+1}(t)$ happens to be a space-filling curve, you can homotopy it slightly so that it is not.) Let $p=-q$. Then there is a unique geodesic from $p$ to $e_{n+1}(t)$, which varies continuously with respect to $t$.
Now parallel transport the frame
$(e_1(t),\dots,e_n(t))\in T_{e_{n+1}(t)}S^n$
back along the geodesic to a frame
$(e_1'(t),\dots,e_n'(t))\in T_pS^n$,
which can then be viewed as a loop of orthonormal frames in $\mathbb{R}^n$ with positive orientation. This way we get a loop in $SO(n)$. Continue until $n=3$.