I am looking for a reference for the fact that the top cohomology $H^n(X;A)$ of an $n$-dimensional manifold $X$ is non-trivial precisely when $X$ is compact.


I tried to ask [this question on Math.Stackexchange](https://math.stackexchange.com/questions/167002/top-cohomology-detecting-compactness), but there was some issue regarding orientability.


If $X$ is orientable, this should follow from standard Poincaré duality, but in my understanding the assumption of orientability can be removed by using "twisted" Poincaré duality. In this case, the coefficients must be local for $H^n$ to be non-trivial. (Edit: They don't need to be local, see the answer by Johannes Ebert below.) But if the coefficients respect the orientation (i.e. the coefficients are a constant sheaf, which is twisted by the orientation character), then $H^n\neq0$ if and only if $X$ is compact.


I vaguely remember hearing about an isomorphism $H^n\cong H\_c^0$, where $H\_c^\ast$ denotes compactly supported cohomology. The argument then goes that $H\_c^0$ is non-trivial precisely when $X$ is non-compact, which I think of by using covers in Čech cohomology. $0$th cohomology with values in the sheaf of locally constant functions is just constant functions on all open sets of the cover $\{U\_i\}$ and these functions must agree on single intersections $U\_i\cap U\_j$. The cohomology classes are thus given by globally constant functions, which, for compactly supported cohomology can only be the zero function when $X$ is non-compact, and can be any constant function when $X$ is compact.


It seems this argument makes no use of orientability, provided, there exists a twisted version of $H^n\cong H\_c^0$...



Top cohomology detecting compactness
A connected $n$-manifold $M \neq \emptyset$ is compact iff $H^n (M;\mathbb{Z}) \neq 0$.


EDIT: my old reference to Bredon, Topology and Geometry, page 346 ff, does not completely settle the issue, as George pointed out. So let me give a proof here. For compact $M$, Corollary 7.14 of the cited book gives the answer.


If $M$ is not compact, then Corollary 7.12 shows that $H\_n (M;\mathbb{Z})=0$. By Corollary 7.13, $H\_{n-1}(M;\mathbb{Z})$ is torsionfree. That is not by itself enough to conclude that $H^n (M,\mathbb{Z})=0$, since for example it could potentially happen that $H\_{n-1}(M;\mathbb{Z})=\mathbb{Q}$, leading to a horrendous Ext-term. But such pathologies do not happen.


By Poincare duality,
$$H^n(M;\mathbb{Z}) \cong H\_0^{lf}(M;\mathbb{Z}\_w)$$
(locally finite homology twisted by the orientation character). Any class in $H\_0^{lf}(M;\mathbb{Z}\_w)$ is represented by a locally finite collection of points, each labelled with an element of the fibre of $\mathbb{Z}\_w$.


In other words, for every class $x \in H\_0^{lf}(M;\mathbb{Z}\_w)$, there is an at most countable discrete space $S$, a proper map $f:S \to M$ and $y \in H\_0^{lf} (S,f^{\ast} \mathbb{Z}\_w)= H\_0^{lf}(S,\mathbb{Z})$ such that $f\_\ast (y)=x$.


To show that $x=0$, I show that each proper map $f: S \to M$ can be extended to a proper map $h: S \times [0,\infty) \to M$. This settles the claim as $H\_0^{lf}(S \times [0,\infty))=0$.


For each point $s \in S$, there is an 'exit path', i.e. a proper map $q\_s: [0, \infty) \to M$, $q(0)=f(s)$. I wish to choose $h:S \times [0,\infty) \to M$ as the disjoint union of all the $q\_s$'s, but without further care, $h$ can fail to be proper. We have to arrange the exit paths in such a way that each compact region $K \subset M$ is only hit by finitely many $q\_s$'s.


To overcome this problem, write $M= \bigcup\_{n\geq 0} N\_n$ as the ascending union of compact codimension $0$ submanifolds with boundary. After replacing $N\_n$ with $M\_n$, the union of $N\_n$ with all relatively compact connected components of $M-N\_n$, the following is true: $M= \bigcup\_{n \geq 0} M\_n$, $M-M\_n$ has no relatively compact connected component. The construction of the exhaustion guarantees that if $f(s) \in M\_n-M\_{n-1}$, $q\_s$ can be chosen to stay in $M-M\_{n-1}$. Hence the required finiteness is guaranteed.


