Proof of the last part of the Reeb theorem I'm trying to prove Reeb's theorem as stated in Milnor's Morse Theory.

Suppose we have an $n$-manifold $M$ together with a smooth function $f$ with exactly two critical points (both non-degenerate), then $M$ is homeomorphic to $S_n$. 

But at the end of the proof he said it's easy to show it is homeomorphic.
I have problem to show that. Could you help me? I am a starter in morse theory.
 A: First off, you want $M$ to be compact.  Then the two critical points correspond to a maximum and minimum.  Denote the minimum $p$ and maximum $q$.  Let $f(M) = [0,1]$.  For small enough $\epsilon >0$, $f^{-1}[1-\epsilon, 1]$ and $f^{-1}[0,\epsilon]$ are $n$-disks due to Morse's lemma.  That is, pick coordinates $(x_1, \ldots, x_n)$ in a neighborhood $U$ around $p$ so that $$f = x_1^2 + \ldots +x_n^2$$ around $p$ and similarly coordinates $(y_1, \ldots, y_n)$ in a neighborhood $V$ around $q$ so that $$f = 1-y_1^2 - \ldots -y_n^2$$ around $q$.  The sublevel sets $M^{\epsilon}$ and $M^{1-\epsilon}$ are diffeomorphic since there aren't any other critical points besides $p$ and $q$.  Now, we have that $M$ is the union of two $n$-disks.
Now, the basic idea is that $S^{n}$ is just two $n$-disks glued via the identity map on $S^{n-1}$ while our manifold has the two $n$-disks glued via $\varphi$.  If we can construct a homeomorphism between these spaces, then we are done.
Let $D_1$ be the disk we got from looking at $f^{-1}[1-\epsilon,1]$ and $D_2$ the disk from $f^{-1}[0,\epsilon]$ (which is in fact diffeomorphic to $M^{1-\epsilon}$).  Let's construct the homeomorphism 
$$g: D_1 \cup_{\text{Id}} D_2 \to D_1 \cup_{\varphi} D_2$$
explicitly via:
$ g(x) = \left\{ 
  \begin{array}{l l}
 x & \quad \text{ for $x \in D_1$}\\
    0 & \quad \text{ for $x=0$ (recall $0\in D_2$)}\\
\|x\| \varphi\left(\frac{x}{\|x\|}\right) & \quad \text{ for $x \in D_2 - \{0\}$}
  \end{array} \right. $
