Let $M = \mathbb{R}^2 \setminus \{0\}$. We have a global coordinates $(x, y)$ on $M$. We want to compute the cohomology of the complex
$$0 \to \Omega^0(M)\ \stackrel{d}{\to}\ \Omega^1(M)\ \stackrel{d}{\to}\ \Omega^2(M)\ \to 0$$
where $\Omega^k(M)$ is the space of smooth $k$-forms on $M$. So we want to compute $H^k(M) = Z^k(M)/B^k(M)$ where $Z^k(M) = \{\alpha \in \Omega^k(M),\, d\alpha = 0\}$ (closed $k$-forms) and $B^k(M) = \{d\beta,\, \beta \in \Omega^{k-1}(M)\}$ (exact $k$-forms). In this situation,
- Elements of $\Omega^0(M)$ are just smooth functions $f(x,y)$ on $M$
- Elements of $\Omega^1(M)$ can be written $u(x,y) dx + v(x,y) dy$ (where $u$ and $v$ are smooth functions on $M$)
- Elements of $\Omega^2(M)$ can be written $g(x,y) dx \wedge dy$ (where $g$ is a smooth function on $M$)
Compute $H^0(M)$:
$B^0(M) = \{0\}$ and $Z^0(M)$ consists of functions $f(x,y)$ such that $df = 0$. Since $M$ is connected, this implies that $f$ is constant. It follows that $H^0(M)$ is isomorphic to $\mathbb{R}$.
Compute $H^1(M)$:
This is the where the all the fun happens :)
Let $\alpha \in Z^1(M)$, this means that $\alpha = u(x,y) dx + v(x,y) dy$ with $\frac{\partial v}{\partial x} - \frac{\partial u }{\partial y} = 0$.
Lemma 1: Let $R$ be a closed rectangle in $\mathbb{R}^2$ which does not contain the origin. Then $\int_{\partial R} \alpha = 0$.
Proof: This is just Green's theorem (or Stokes' theorem) (in its most simple setting, where it's not hard to show directly).
Lemma 2: Let $R$ and $R'$ be closed rectangles in $\mathbb{R}^2$ whose interiors contain the origin. Then $\int_{\partial R} \alpha = \int_{\partial R'} \alpha$.
Proof: This is a consequence of Lemma 1. It might be a bit tedious to write down (several cases need to be addressed, according to the configuration of the two rectangles), but it's fairly easy. You need to cut and rearrange integrals along a bunch of rectangles so that the two initial integrals agree up to integrals along rectangles who do not contain the origin.
Let's denote by $\lambda(\alpha)$ the common value of all integrals $\int_{\partial R} \alpha$ when $R$ is a closed rectangle whose interior contains the origin.
Lemma 3: If $\alpha$ is exact iff $\lambda(\alpha) = 0$.
Proof: "$\Rightarrow$" is trivial1, let's prove the converse. Fix permanently some point $m_0 \in M$, whichever you like best. For any $m\in M$, consider a rectangle $R$ in $\mathbb{R}^2$ whose boundary contains $m_0$ and $m$ but avoids the origin. Let $\gamma$ be one of the two paths joining $m_0$ and $m$ along $\partial R$. Let $f(m) = \int_\gamma \alpha$. Since $\lambda(\alpha) = 0$, this definition does not depend on the choice of the rectangle or the path. In other words $f: M \rightarrow \mathbb{R}$ is well defined. Let's see that $df = \alpha$. Check that $\frac{f(x+h, y) - f(x,y)}{h} = \frac{1}{h}\int_x^{x+h} u(t,y) dt$, so that taking the limit when $h\rightarrow 0$ yields $\frac{\partial f}{\partial x} = u$. Same for $v$.
Finally let's consider the $1$-form $d\theta = \frac{-ydx + xdy}{x^2 + y^2}$. NB: Be well aware that $d\theta$ is a misleading (but standard) notation: it is not an exact form.
Lemma 4: $d\theta$ is a closed $1$-form and $\lambda(d\theta) = 2\pi$.
Proof: This is a direct computation.
Now're done:
Proposition: $H^1(M)$ is the one-dimensional vector space spanned by $[d\theta]$.
where $[d\theta]$ denotes the class of $d\theta$ in $H^1(M)$. Note that $[d\theta] \neq 0$: see Lemma 4 and 3.
Proof: Let $\alpha$ be a closed $1$-form. Consider $\beta = \alpha - \frac{\lambda(\alpha)}{2 \pi} d\theta$. We have $\lambda(\beta) = 0$ so $\beta$ is exact by Lemma 3. This proves that $[\alpha] = \frac{\lambda(\alpha)}{2 \pi} [d\theta]$.
Compute $H^2(M)$:
Let's show that $H^2(M) = 0$, in other words every closed $2$-form on $M$ is exact. This solution is taken from Ted Shifrin in the comments below.
Here's the idea: in polar coordinates, a $2$-form $\omega$ can be written $\omega = f(r,\theta) dr \wedge d\theta$. Then $\eta = (\int_1^r f(\rho, \theta) d\rho)\, d\theta$ is a primitive of $\omega$.
Although it's not very insightful, this can be checked by a direct computation without refering to a change of variables.
Let $\omega(x,y) = g(x,y) dx \wedge dy$. Define $$h(x,y) = \int_1^{\sqrt{x^2+y^2}} t\, g\left(\frac{tx}{\sqrt{x^2+y^2}}, \frac{ty}{\sqrt{x^2+y^2}}\right) \,dt$$
Check that $h(x,y) d\theta$ is a primitive of $\omega$.
NB: Any course / book / notes on de Rham cohomology will show that if $M$ is a connected compact orientable manifold, $H^n(M) \approx \mathbb{R}$. However, I don't think I've read anywhere that when $M$ is not compact, $H^n(M) = 0$. I wonder if there is an "elementary" proof.
1 I'll explain this by request of OP. It is a general fact that if $\gamma : [a, b] \rightarrow M$ is a ${\cal C}^1$ path and $\alpha$ is a smooth exact one-form i.e. $\alpha = df$ where $f$ is a smooth function, then $\int_\gamma \alpha = f(\gamma(b)) - f(\gamma(a))$. This is because $\int_\gamma \alpha = \int_a^b \alpha(\gamma(t))(\gamma'(t))\,dt$ (by definition) and here $\alpha(\gamma(t))(\gamma'(t)) = df(\gamma(t))(\gamma'(t)) = f'(\gamma(t)) \gamma'(t) = \frac{d}{dt}\left(f(\gamma(t))\right)$.
This fact extends to piecewise ${\cal C}^1$ maps by cutting the integral. In particular, is $\gamma$ is a closed piecewise ${\cal C}^1$ path and $\alpha$ is exact, then $\int_\gamma \alpha = 0$.
In fact, it is useful (e.g. for Cauchy theory in complex analysis) to know that
- A one-form is closed iff its integral along any homotopically trivial loop is zero (any boundary of a rectangle contained in the open set is enough).
- A one-form is exact iff its integral along any loop is zero.
Note that the "smooth" condition can be weakened.
Best Answer
The trick is to look at the actual arrows involved. Also for convenience sake, I will assume $N$ is actually $M$ delete an open ball, since they're homotopy equivalent.
The $0$, $1$ exact sequence
Consider the exact sequence $$ 0 \to H^0(M)\to H^0(N)\oplus \Bbb{R}\to \Bbb{R}\to H^1(M)\to H^1(N)$$ The trick is to observe that $H^0(M)=\Bbb{R}$, since $M$ is connected. Thus we have $$ 0 \to \Bbb{R} \to H^0(N)\oplus \Bbb{R}\to \Bbb{R},$$ and since $N\ne \varnothing$, we see that the dimension of $H^0(N) \oplus \Bbb{R}$ is greater than or equal to 2, but it's also at most 2, since it fits into this exact sequence. Thus $H^0(N)=\Bbb{R}$ and the map $H^0(N)\oplus \Bbb{R}\to \Bbb{R}$ is surjective.
We could also show this geometrically ($N$ must be connected, so $H^0(N)=\Bbb{R}$ from that consideration alone, and surjectivity of the map is clear geometrically).
Regardless, surjectivity of this map allows us to split the exact sequence as $$ 0\to H^0(M)\to H^0(N)\oplus \Bbb{R} \to \Bbb{R} \to 0$$ and $$ 0\to H^1(M)\to H^1(N).$$ If $n> 2$, then this fits in as $0\to H^1(M)\to H^1(N)\to 0$, giving $H^1(M)\simeq H^1(N)$. Otherwise this is part of the other exact sequence we don't understand, so let's look at that one next.
The $n$, $n-1$ exact sequence
We have $$ 0 \to H^{n-1}(M) \to H^{n-1}(N) \to \Bbb{R} \to H^n(M)\to H^n(N) \to 0$$
Consider the map $H^{n-1}(N)\to \Bbb{R}$. This is induced by restricting a differential form $\omega$ representing some cohomology class $[\omega]$, defined on $N$ to the boundary sphere of $N$.
Then observe that $$\int_{\partial N} \omega = \int_N d\omega = \int_N 0 = 0,$$ by Stokes' theorem and that $\omega$ is closed.
Therefore the image of $[\omega]$ in $\Bbb{R} = H^{n-1}(\partial N)$ is $0$. Thus the map $H^{n-1}(N)\to \Bbb{R}$ is $0$.
Therefore we can split the exact sequence again into the pieces $$0\to H^{n-1}(M)\to H^{n-1}(N)\to 0$$ and $$0\to \Bbb{R}\to H^n(M)\to H^n(N)\to 0,$$ and using that $H^n(M)=\Bbb{R}$, since $M$ is connected, compact, and orientable, we see that $H^n(N)=0$, as desired.
Alternatively without using that $H^n(M)=\Bbb{R}$, we already have $b_n(N) = b_n(M)-1$.