TITLE: Fundamental group as a functor
QUESTION [21 upvotes]: Is it right to consider assigning a fundamental group to a topological space the same as having a functor from $\mathbf{Top}$ to $\mathbf{Grp}$ ?
Are there any other examples of such functors ?

REPLY [36 votes]: Assigning the fundamental group to a topological space is definitely a functor. But you have to keep in mind that a fundamental group is always taken with respect to a base point, and hence the functor assigns a pair $(X,x_0)$ consisting of a topological space $X$ and a point $x_0\in X$ to its fundamental group $\pi_1(X,x_0)$. As such, the functor goes from $\mathbf{Top}_\ast$ to $\mathbf{Grp}$.
In more detail, the fundamental group $\pi_1(X,x_0)$ is the group of homotopy classes of loops starting and ending in the base point $x_0$. It is not so hard to show that the map $[\gamma]\mapsto[f\circ\gamma]$ is well-defined for each loop $\gamma$ from $x_0$ to $x_0$ and each morphism $f:(X,x_0)\to(Y,y_0)$ of the category $\mathbf{Top}_\ast$; we take this map to be $\pi_1(f)$. Roughly, this is a definition by post-composition, so it is immediate that this functor respects identity morphisms and compositions.

This is a side remark, because you have been asking about the fundamental group explicitly. But I feel it is in place here because it is natural to consider a functor with domain $\mathbf{Top}$ that is `like taking the fundamental group'.
Instead of $\mathbf{Top}_\ast\to\mathbf{Grp}$, one could also work with a functor $\mathbf{Top}\to\mathbf{Grpd}$, where the category $\mathbf{Grpd}$ is the category of groupoids (categories in which all morphisms are isomorphisms). The functor sends a topological space $X$ to the groupoid which has the points of $X$ as objects and between two points $x$ and $y$ of $X$ the morphisms are the homotopy classes of paths from $x$ to $y$. This gives you the fundamental groupoid rather than the fundamental group.
The n-lab has more information on the fundamental groupoid.

There are many more examples of functors from $\mathbf{Top}$ or related categories. An important one is the singular functor to the category $\mathbf{Sset}$ of simplicial sets. The category if simplicial sets is defined as follows: first you consider the category $\Delta$ consisting of an object $[n]$ for each natural number $n$, where $[n]$ is the partial ordered set $\{0,\ldots,n\}$ with the usual order; the morphisms are the order preserving maps. Then $\mathbf{Sset}$ is the category of contravariant functors from $\Delta$ to $\mathbf{Set}$. 
For each natural number $n$, there is the topological space
$$
|\Delta^n|:=\big\{(t_0,\ldots,t_n)\in[0,1]^{n+1}:\textstyle\sum_{i=0}^n t_i=1\big\},
$$
which is called the standard $n$-simplex. To test your understanding of these definitions, you can show that the map $[n]\mapsto|\Delta^n|$ is a functor from $\Delta$ to $\mathbf{Top}$. Now we can define the functor $S:\mathbf{Top}\to\mathbf{Sset}$, which is called the singular functor, by assigning to each topological space $X$ the functor
$$
n\mapsto\mathbf{Top}(|\Delta^n|,X)
$$
It turns out that the simplicial sets $S(X)$ have very nice properties. One of them is that they really are $\infty$-groupoids. Also, the set $\mathbf{Top}(|\Delta^n|,X)$ is used to define the $n$-th homology group of $X$, which is gives yet another functor from the category of topological spaces. All of these functors have been (and are) important for the investigation of topological spaces.