Computing the De Rham Cohomology Group of Connected Sum $H_{\rm dR}^p(M_1 \# M_2)$ I'm reading Lee's Introduction to Smooth Manifolds. I have a question about problem 17-7.

Problem 17-7 Let $M_1$, $M_2$ be connected smooth manifolds of dimension $n\geq3$, and let $M_1\# M_2$ denote their smooth connected
sum (Example 9.31). Prove that $H_{\rm dR}^p(M_1 \# M_2)\cong H_{\rm
dR}^p(M_1)\oplus H_{\rm dR}^p(M_2)$ for $0<p<n-1$. Prove that the same
is true for $p=n-1$ if $M_1$ and $M_2$ are both compact and
orientable. [Hint: use Problems 9-12 and 17-6.]
Problem 9-12 Suppose $M_1$ and $M_2$ are connected smooth $n$-manifolds and $M_1\# M_2$ is their smooth connected sum (see
Example 9.31). Show that the smooth structure on $M_1\# M_2$ can be
chosen in such a way that there are open subsets $\widetilde{M_1},
\widetilde{M_2}\subseteq M_1\# M_2$ that are diffeomorphic to
$M_1-\{p_1\}$ and $M_2-\{p_2\}$, respectively, such that
$\widetilde{M_1}\cup\widetilde{M_2}=M_1\# M_2$ and
$\widetilde{M_1}\cap\widetilde{M_2}$ is diffeomorphic to
$(-1,1)\times\mathbb{S}^{n-1}$.
Problem 17-6 Let $M$ be a connected smooth manifold of dimension $n\geq3$. For any $x\in M$ and $0\leq p\leq n-2$, prove that the map
$H_{\rm dR}^p(M)\rightarrow H_{\rm dR}^p(M-\{x\})$ induced by
inclusion $M-\{x\}\hookrightarrow M$ is an isomorphism. Prove that the
same is true for $p=n-1$ if $M$ is compact and orientable.

Here is my attempt about problem 17-7:
According to problem 9-12, there are open subsets $\widetilde{M_1}, \widetilde{M_2}\subseteq M_1\# M_2$, such that $\widetilde{M_1}$ is diffeomorphic to $M_1-\{p_1\}$, $\widetilde{M_2}$ is diffeomorphic to $M_2-\{p_2\}$, $\widetilde{M_1}\cup\widetilde{M_2}=M_1\# M_2$ and $\widetilde{M_1}\cap\widetilde{M_2}$ is diffeomorphic to $(-1,1)\times\mathbb{S}^{n-1}$.
Note that $(-1,1)\times\mathbb{S}^{n-1}$ and $\{0\}\times\mathbb{S}^{n-1}$ are homotopy equivalent, and $\{0\}\times\mathbb{S}^{n-1}$ is diffeomorphic to $\mathbb{S}^{n-1}$. Therefore $H_{\rm dR}^p(\widetilde{M_1}\cap\widetilde{M_2})\cong H_{\rm dR}^p((-1,1)\times\mathbb{S}^{n-1})\cong H_{\rm dR}^p(\mathbb{S}^{n-1})=0$ for $0<p<n-1$.
According to Mayer–Vietoris Theorem,
$$\cdots\rightarrow H_{\rm dR}^{p-1}(\widetilde{M_1}\cap\widetilde{M_2})\rightarrow H_{\rm dR}^p(M_1\# M_2)\rightarrow H_{\rm dR}^p(\widetilde{M_1})\oplus H_{\rm dR}^p(\widetilde{M_2})\rightarrow H_{\rm dR}^p(\widetilde{M_1}\cap\widetilde{M_2})\rightarrow\cdots$$
is exact. The groups on both ends are trivial when $1<p<n-1$, which implies that
$$H_{\rm dR}^p(M_1 \# M_2)\cong H_{\rm dR}^p(\widetilde{M_1})\oplus H_{\rm dR}^p(\widetilde{M_2})\cong H_{\rm dR}^p(M_1-\{p_1\})\oplus H_{\rm dR}^p(M_2-\{p_2\}).$$
According to problem 17-6, for $0\leq p\leq n-2$,
$$H_{\rm dR}^p(M_i-\{p_i\})\cong H_{\rm dR}^p(M_i),i=1,2.$$
Therefore
$$H_{\rm dR}^p(M_1 \# M_2)\cong H_{\rm dR}^p(M_1)\oplus H_{\rm dR}^p(M_2)$$
for $1<p<n-1$.
My question is how to handle the cases $p=1$ and $p=n-1$. Group on the left end of the exact sequence is isomorphic to $\mathbb{R}$ (not trivial) when $p=1$. If $M_1$ and $M_2$ are both compact and orientable, according to problem 17-6, though
$$H_{\rm dR}^{n-1}(M_i-\{p_i\})\cong H_{\rm dR}^{n-1}(M_i),i=1,2,$$
group on the right end of the exact sequence is isomorphic to $\mathbb{R}$ (not trivial). Both of the two cases will make it unclear to directly infer
$$H_{\rm dR}^p(M_1 \# M_2)\cong H_{\rm dR}^p(\widetilde{M_1})\oplus H_{\rm dR}^p(\widetilde{M_2}).$$
Any help would be appreciated.
 A: As in the other answer, I'll write $U$ for $\widetilde{M_1}$ and $V$ for $\widetilde{M_2}$ just to save on typing.
The $p=1$ case is doesn't depend on orientability or having closed manifolds.
The Mayer-Vietoris sequence starts with $$0\rightarrow H_{dR}^0(M)\rightarrow H_{dR}^0(U)\oplus H_{dR}^0(V)\rightarrow  H_{dR}^0(U\cap V)\rightarrow H^1_{dR}(M)\rightarrow H^1_{dR}(U)\oplus H^1_{dR}(V)\rightarrow H^1_{dR}(U\cap V).$$
But $H^0_{dR}$ measures the number of components.  Indeed, there are no $(-1)$-forms, so $H^0_{dR}$ is simply the kernel of the differential $d$, when restricted to functions.    But a function with trivial derivative is constant on connected sets.  Because $n\geq 2$, both $U$ and $V$ are connected.  In addition, as you noted, $U\cap V$ is homotopy equivalent to $S^{n-1}$ and $n\geq 3$, so $H^1_{dR}(U\cap V) = 0$.
Thus, the MV sequence looks like $$0\rightarrow \mathbb{R}\rightarrow \mathbb{R}^2 \rightarrow \mathbb{R}\rightarrow  H^1_{dR}(M)\rightarrow H^1_{dR}(U)\oplus H^1_{dR}(V)\rightarrow 0.$$
The first map $\mathbb{R}\rightarrow \mathbb{R}^2$ is injective, so the image is a one-dimensional subspace of $\mathbb{R}^2$.  This must be the kernel of the map $\mathbb{R}^2\rightarrow \mathbb{R}$.  Now the rank-nullity theorem implies that this map has rank $1$, so it must actually be surjective.  That is, the map $\mathbb{R}^2\rightarrow \mathbb{R}$ has image all of $\mathbb{R}$.  This is the kernel of the map $\mathbb{R}\rightarrow H^1_{dR}(M)$.  In other words, the map $\mathbb{R}\rightarrow H^1_{dR}(M)$ is the $0$ map.  Exactness now implies that the map $H^1_{dR}(M)\rightarrow H^1_{dR}(U)\oplus H^1_{dR}(V)$ is injective.  Since it is also surjective, it must be an isomorphism.  This concludes the $p=1$ case.
For the $p=n-1$ case, we'll have to work a bit harder.  As you noted, using the fact that $H_{dR}^\ast(S^{n-1})$ is known, the Mayer-Vietoris sequence looks like
$$0\rightarrow H^{n-1}_{dR}(M)\rightarrow H^{n-1}_{dR}(U)\oplus H^{n-1}_{dR}(V)\rightarrow \mathbb{R}\rightarrow H^n_{dR}(M)\rightarrow H^n_{dR}(U)\oplus H^n_{dR}(V)\rightarrow 0$$
Claim:  The map $H^{n-1}_{dR}(U)\rightarrow H^{n-1}_{dR}(U\cap V)$ is the $0$-map.  So is the map $H^{n-1}_{dR}(V)\rightarrow H^{n-1}_{dR}(U\cap V)$.
Let's believe the Claim for now.  Believing it, the map $H^{n-1}_{dR}(U)\oplus H^{n-1}_{dR}(V)\rightarrow \mathbb{R}$ must be the zero map.  Thus, its kernel is everything.  Exactness now implies the map $H^{n-1}_{dR}(M)\rightarrow H^{n-1}_{dR}(U)\oplus H^{n-1}_{dR}(V)$ is surjective.  Since this map is also injective, it is an isomorphism when $p=n-1$ as well.
Thus, we need only prove the Claim:
Proof: I'll just prove this for $U$, the proof for $V$ being analogous.
As you noted, $U\cap V$ is diffeomorphic to $S^{n-1}\times (-1,1)$, and I'm thinking of $S^{n-1}\times \{1-\epsilon\}$ as being a very tiny ball around the deleted point in $M_1$.  Consider the homotopy where we retract the interval $(-1,1)$ to $(-1,0]$.  Performing this homotopy on $U$ (keeping points of $U\setminus (S^{n-1}\times (0,1)$) fixed, we see that the pair $(U,U\cap V)$ is homotopy equivalent to $(M'_1, \partial M_1')$ where $M_1'$ denotes $M_1$ with a small ball removed and $\partial M_1'\cong S^{n-1}$.
So, instead of studying the map $H^{n-1}_{dR}(U)\rightarrow H^{n-1}_{dR}(U\cap V)$, we may instead study the map $H^{n-1}_{dR}(M_1')\rightarrow H^{n-1}_{dR}(\partial M_1')$.  Because $M_1$ is closed and orientable, $M_1'$, is a compact orientable manifold with boundary, so is amenable to Stokes's theorem.
Now, let $[\eta]\in H^{n-1}_{dR}(M_1')$.  Since $\eta$ has a cohomology class, $d\eta = 0$.  Stokes's theorem now yields
$$0 = \int_{M_1'} d\eta = \int_{S^{n-1}}\eta.$$
This means that $\eta$ restricts to a $0$-volume form on $S^{n-1}$ which, as you know, implies that it restricts to an exact form.  Thus, $i^\ast(\eta) = 0$ where $i:S^{n-1}\cong \partial M_1'\rightarrow M_1'$ denotes the inclusion and $i^\ast:H^{n-1}_{dR}(M_1')\rightarrow H^{n-1}_{dR}(\partial M_1')$ is the induced map.$\square$
A: You have the sequence $$H^{n-1}(U\cup V) \to H^{n-1}(U)\oplus H^{n-1}(V)\to H^{n-1}(U\cap V \simeq S^{n-1}) = \mathbb{R} \to H^n(U\cup V) = \mathbb{R} \ \to H^n(U)\oplus H^n(V) = 0 \to 0$$ where $U, V$ are correspondingly $\tilde{M_1}, \tilde{M_2}.$
Since $U\cup V  = M_1\sharp M_2$ is oriented and compact, by Poincare duality, $H^n(U\cup V) = \mathbb{R}$ and $H^n(U) = H^n(V) = 0.$
So we deduce that $H^{n-1}(M_1\sharp M_2) = H^{n-1}(U)\oplus H^{n-1}(V).$
Again, by Poincare duality, $H^1(M_1\sharp M_2) = H^{n-1}(M_1\sharp M_2).$
PS: maybe you know it, if we have a finite exact sequence (of finitely-dimensional vector spaces) $\ldots\to V_i\to V_{i+1} \to V_{i+2} \to \ldots$ then we have $\sum (-1)^i \dim V_i =0.$ It will help the computation.
