How to determine the homotopy class of a given path in $GL^+(n,\mathbb{R})$ The first homotopy group of $GL^+(n,\mathbb{R})$ is $\mathbb{Z}$ for n=2, and $\mathbb{Z}_2$ for $n \geq 3$. 
Now consider the following problem: Given a set of matrices $M(t)\in GL^+(n,\mathbb{R})$, where $t\in[t_1,t_2]$ and $M(t_1)=M(t_2)$ (such that we are really dealing with a closed path in $GL^+(n,\mathbb{R})$, how can one determine which equivalence class does the path belong to? Is there a simple way of checking whether a given path for $n\geq 3$ is null-homotopic or non-trivial?
I found a solution for $n=2$. 
In this case, a general matrix $M\in GL^+(2,\mathbb{R})$ can be expressed using four real numbers $p_{x,y},q_{x,y}$ (or two complex numbers $\hat {p} = p_x + i p_y$ and $\hat{q} = q_x + i q_y$) as
\begin{equation}
M = \left(\begin{array}{cc}
p_x + q_x & p_y + q_y \\
-p_y + q_y & p_x - q_x
\end{array}\right)
\end{equation} 
with the condition $\det M > 0$ implying that $|\hat{p}|^2 > |\hat{q}|^2$. In this case, the ($\mathbb{Z}$-valued) homotopy class of $M(t)$ is simply the relative winding of $\hat{p}(t)$ with respect to $\hat{q}(t)$ in the complex plane. If one defines a complex number $\hat{z}(t) = \hat{p}(t)/\hat{q}(t)$, then
this winding number can be elegantly expressed as
\begin{equation}
w[M(t)] = \frac{-i}{2\pi} \int_{t_1}^{t_2}  dt \left[\hat{z}^{-1}(t)\frac{d}{dt} \hat{z}(t)\right].
\end{equation}
(Here, the derivative produces a term from the radius $|\hat{z}|$ which integrates to zero, and another term from the phase $\arg(\hat{z})$ which integrates to an integer multiple of $2\pi i$. The factor $-i$ makes the result real.)
However, this solution does not generalize to $n \geq 3$ for at least two obvious reasons: The specific parametrization with two complex number, and the fundamental group becoming $\mathbb{Z}_2$ instead of $\mathbb{Z}$. What also worries me is that the formula is insensitive to the condition on magnitudes $|\hat{p}|^2 > |\hat{q}|^2$. 
I hoped there is an elegant solution which does not depend on the specific choice of $n$, for example through looking at the eigenvalues or eigenvectors. Are you aware of any such a relation? Is there any known solution to the formulated problem?
 A: As Travis says in the comments, $GL^{+}_n(\mathbb{R})$ deformation retracts onto $SO(n)$, e.g. via Gram-Schmidt, so one can reduce the question to the same question for $SO(n)$. When $n = 2$ we have $SO(2) \cong S^1$ and so it is very clear that we're just talking about winding numbers. 
In general it's not clear to me what sort of format you want an answer in (e.g. some winding number-like integral?). Here is one possible answer. Let me first explain it for $n = 3$, which has the virtue of admitting a very clear visualization. As explained in e.g. this blog post (regrettably without pictures), points in $SO(3)$ can be visualized as pairs consisting of a point on the sphere $S^2$ and a unit tangent vector to that point. This is because this space is the unit tangent bundle of $S^2$, and $SO(3)$ acts freely and transitively on it. So paths in $SO(3)$ can be visualized as paths taken by this point and this unit tangent vector; I like to think of it as a little tank, which can move around the sphere and swivel its turret around. 
Now, $S^2$ is simply connected, so any such path is homotopic to a path where the tank does not move at all, so the only thing that happens is that the turret swivels around. Once you perform this homotopy, the resulting path, as an element of the fundamental group $\pi_1(SO(3)) \cong \mathbb{Z}_2$, is just the winding number of this path $\bmod 2$. 
This strategy generalizes to all $n$. In general, the action of $SO(n)$ on $S^{n-1}$ produces a fiber bundle
$$SO(n-1) \to SO(n) \to S^{n-1}$$
and the fact that, for $n \ge 3$, $S^{n-1}$ is simply connected implies as above that any path in $SO(n)$ is homotopic to a path in $SO(n-1)$. Repeatedly conducting such homotopies allows you to reduce eventually to the case of $SO(2)$ as we did above. 
