cohomology(k, Delta, R)
Each abstract simplicial complex $\Delta$ determines a chain complex $\widetilde C(\Delta, k)$ of free modules over its coefficient ring $k$. For all integers $i$, the $i$th term of $\widetilde C(\Delta, k)$ has a basis corresponding to the $i$dimensional faces of $\Delta$. The reduced cohomology of $\Delta$ with coefficients in $R$ is, by definition, the cohomology of the chain complex $\operatorname{Hom}( \widetilde C(\Delta, k) \otimes R, R)$.
The 2sphere has vanishing first cohomology, but nontrivial second cohomology.




A figure eight has rank two first cohomology.

