Self-intersections of loops Let $X$ be a topological space with basepoint $x_0$. Define a map $s\colon\pi_1(X,x_0)\to\mathbb{Z}_{\geq 0}$ by
$$s([\gamma])=\min\{\text{number of self-intersections of }\gamma'\colon \gamma'\in [\gamma]\}.$$
Has the map $s$ been studied before? Is there some well-established theory about it?
To be specific, for example, how would one prove that if $A$ is annulus, then
$$s(n)=\left\{
 \begin{array}{ll}
  0  & \mbox{if } n = 0 \\
  |n|-1 & \mbox{if } n \neq 0
 \end{array}
\right.$$

The invariant you are interested in, is called the geometric intersection number. (As opposed to the "oriented" or "algebraic intersection number" mentioned by Mike.) It is interesting when $X$ is a surface (although it has generalizations in other dimensions, but you use submanifolds of other dimensions, not loops). The geometric intersection number plays critical role in Thurston's theory of hyperbolic surfaces. See for instance "Thurston's work on surfaces" (section 3.3 and onward) or/and F.Luo and R.Stong "Measured lamination spaces on surfaces and geometric intersection numbers", 
Topology and its Applications, Volume 136, 2004, p. 205–217.  
