A map of a compact connected manifold with non-empty boundary to a sphere of the same dimension is null-homotopic In Milnor & Kervaire's Groups of Homotopy Spheres paper, this claim:

A map of a compact connected manifold with non-empty boundary to a sphere of the same dimension is null-homotopic

is made without justification or reference. Can anyone see why is it true?
All I can think of is that compact manifolds with non-empty boundary have top homology $0$, so this map induces $0$ in all homology groups (except the $0$th, of course). However, this doesn't seem to help. It's easy to see that the map restricted to the boundary is null-homotopic (since it can't be surjective there, say by Sard's theorem), but that also doesn't seem to help. Any explanations / references are appreciated.
 A: A connected compact smooth manifold $M$ of dimension $n$ with nonempty boundary deformation to a simplicial complex where all cells have dimension at most $n-1$. See this answer by Lee Mosher for a proof. The basic idea, as far as I understand, is to remove the boundary to get a noncompact manifold, take a triangulation of the resulting manifold, and then shrink all the $n$-cells starting "from the outside" (like when you deformation retract $[0,\infty)$ onto $\{0\}$) – this last part is rather tricky and the first version of my answer was a bit naive, thanks to Lee Mosher for giving me a link to the full proof.
And now by cellular approximation, a map from a simplicial complex of dimension $\le n-1$ to $S^n$ is nullhomotopic, because you can consider a CW-complex structure on $S^n$ where the $(n-1)$-skeleton is just a point.
(I used a triangulation here, I'm not sure it's strictly necessary... Maybe there's an easier argument.)
A: This follows from the fact that such a manifold has no top-dimensional cohomology.
Note that one can construct a $K(\mathbb{Z}, n)$ from $S^n$ by gluing on cells of dimension at least $n + 2$ to kill the higher homotopy groups. So the $(n+1)$-skeleton of this $K(\mathbb{Z}, n)$, denoted $K(\mathbb{Z}, n)^{(n+1)}$, is $S^n$. As Eilenberg-MacLane spaces represent cohomology, for any $n$-dimensional manifold $M$ we have
$$H^n(M; \mathbb{Z}) \cong [M, K(\mathbb{Z}, n)] \cong [M, K(\mathbb{Z}, n)^{(n+1)}] \cong [M, S^n]$$
where we use cellular approximation in the second step. Therefore, if $M$ is an $n$-dimensional manifold which is not closed, every map $M \to S^n$ is nullhomotopic.
