TITLE: How can 1-manifold can be written as a finite union of spaces homeomorphic to [0,1]
QUESTION [5 upvotes]: I'm studying from Munkres' Topology textbook. There is an example in page 308 that says:

Every 1-compact manifold X has topological dimension 1. The space X can be written as a finite union of spaces that are homeomorphic to the unit interval [0,1]; then the preceding corollary applies.

There is also a very similar statement in the next example that says the same but instead of a 1-manifold is a 2-manifold and instead of [0,1] is the closed ball in $R^2$
I don't quite get that.
Edit: I'll write down the definition that Munkres gives to "m-manifold" to make my question more independent:
An m-manifold is a Hausdorff space X with a countable basis such that each point $x$ of $X$ has a neighborhood that is homeomorphic with an open subset of $R^m$

REPLY [4 votes]: By definition of a $1$-manifold, every point has an open neighbourhood homeomorphic to $(0,1)$. That gives an open cover of $X$. Since $X$ is compact, we can extract a finite subcover, say $U_1,\dotsc, U_n$. We can assume that this finite cover is minimal, i.e. none of the sets can be removed without losing the covering property. For $1\leqslant k \leqslant n$ let $\varphi_k \colon U_k \to (0,1)$ a homeomorphism.
Consider $A_1 = X\setminus (U_2 \cup \dotsc \cup U_n)$. That is a closed (in $X$), hence compact subset of $U_1$, and by the minimality assumption non-empty. We let $a_1 = \min \varphi_1(A_1)$ and $b_1 = \max \varphi_1(A_1)$. Then $0 < a_1 \leqslant b_1 < 1$, and $B_1 = \left[\frac{a_1}{2},\frac{1+b_1}{2}\right]$ is a compact subinterval of $(0,1)$. Let $C_1 = \varphi_1^{-1}(B_1)$ and $V_1 = \varphi_1^{-1}\left(\left(\frac{a_1}{2},\frac{1+b_1}{2}\right)\right)$. By construction, $C_1$ is homeomorphic to $[0,1]$, and $V_1,U_2,\dotsc,U_n$ still covers $X$.
Let $A_2 = X \setminus (V_1 \cup U_3 \cup \dotsc \cup U_n)$. That is a compact non-empty subset of $U_2$. In the same way as above, find $C_2$ homeomorphic to $[0,1]$ and $V_2$ homeomorphic to $(0,1)$ with $A_2 \subset V_2 \subset C_2$.
Iterate the construction, to obtain $V_1,\dotsc, V_n$, each homeomorphic to $(0,1)$ still covering $X$, and $C_k \supset V_k$ homeomorphic to $[0,1]$. Then $C_1,\dotsc,C_n$ is the desired cover of $X$ by sets homeomorphic to $[0,1]$.