TITLE: Coefficients in cohomology
QUESTION [30 upvotes]: (Sorry if this is too elementary for this site)
I’m having some trouble understanding sheaf cohomology. It’s supposed to provide a theory of cohomology “with local coefficient”, and allow easy comparison between different theories like singular, Cech, de Rham and Alexander Spanier. What I don’t understand is: what’s all the fuss with coefficients that vary with each open set? Indeed what’s all the fuss with changing coefficients in an ordinary cohomology theory as in Eilenberg Steenrod?
Homology is trying to measure the “holes” of a space; wouldn’t integer coefficients suffice already? I’m not really sure what cohomology is trying to measure; at least I think the first singular group is trying to measure some kind of “potential difference”, like explained in Hatcher’s book. It gets worse for me when the coefficient group isn’t the integers. But when I get to sheaf cohomology I’m totally dumbstruck as to what it’s trying to measure, and what useful information of the space can be extracted from it. Now if it’s just about comparisons of different theories I can live with that…
Can someone please give me an intuitive explanation of the fuss with all these different coefficients? Please start off with why we even use different coefficients in Eilenberg Steenrod. Sorry if this is too elementary.

REPLY [33 votes]: This (elementary and perfectly standard) example might help show the power of sheaves with non-constant coefficients:
First, think about the circle $S^1$.  Suppose you want to understand (real) line bundles on the circle.  You can certainly cover the circle with two open contractible subsets $U_1$ and $U_2$ (which you can take to be the complements of the north and south poles), and we know that any line bundle on a contractible space is trivial.  So if you've got a line bundle $L$ over $S^1$, you can restrict it to either $U_i$ and get a trivial bundle $L_i$.  $L$ is built from these $L_i$ and the way they they are patched together over $U_1\cap U_2$.
Now what does it mean to patch the $L_i$ together over $U_{12}=U_1\cap U_2$?  It means choosing an isomorphism $L_1|U_{12}\rightarrow L_2|U_{12}$.  For any $x\in U_{12}$, the restriction of this isomorphism to the fiber $L_x$ over $x$ is an isomorphism between 1-dimensional vector spaces, and so (after choosing bases) can be identified with an element of ${\bf R}^*$ (the non-zero reals).  Therefore your patching consists of a continuous map 
$$U_{12}\rightarrow {\mathbb R}^*$$ 
which is to say, a Cech 1-cocycle for the sheaf of continuous ${\bf R}^{*}$-valued functions.
Now of course you could build a line bundle in some other way, say by starting with two different contractible sets $U_1$ and $U_2$.  When do two sets of patching data give isomorphic line bundles?  A little thought reveals that the answer is:  When and only when the corresponding cocycles give the same class in 
$$H^1(S^1,G^{*})$$ 
with $ G^{*} $ being the sheaf of continuous ${\bf R}^*$-valued functions.
Therefore line bundles are classified by $H^1(S^1,G^{*})$.  Now consider the exact sequence of sheaves
$$0 \rightarrow G \rightarrow G^*\rightarrow {\bf Z}/2{\bf Z}\rightarrow 0$$
where $G$ is the sheaf of continuous ${\bf R}$ valued functions, and the map on the left is exponentiation.  Follow the long exact sequence of cohomology, use the fact that $G$ is acyclic, and conclude that $H^1(S^1,G^*)=H^1(S^1,{\bf Z}/2{\bf Z})={\bf Z}/2{\bf Z}$.  In other words, there are exactly two real line bundles over $S^1$  --- and indeed there are:  the cylinder and the Mobius strip.
Exercise:  Do a similar calculation for ${\bf CP}^1$ (the Riemann sphere).  Conclude that the set of (complex) line bundles is in one-one correspondence with $H^2({\bf CP}^1,{\bf Z})={\bf Z}$.