TITLE: How do you define the "boundary" of a topological space?
QUESTION [24 upvotes]: As described here (and as I always thought was the most general definition of boundary), a possible definition of the boundary of a subset $S$ of a topological space $X$ is $\partial S = \overline S \backslash \mathrm{int}(S)$. 
I am reading Allen Hatcher's book on algebraic topology, and they often refer to "the" boundary of a topological space, for instance by saying that $\partial D^2 = S^1$. How is this notion of boundary uniquely defined? Because if I take an injection of $D^2$ into $\mathbb R^2$, I'm going to get $S^1$, but if I take the injection of $D^2$ into $\mathbb R^3$, then $D^2$ becomes its own boundary. I know that the $\partial$ is an important operation in topology so I'm trying to figure it out, and I feel like it doesn't quite make sense here. 
So can anyone describe precisely what is meant by $\partial X$ when $X$ is a topological space? Or at least explain what is meant by that in particular contexts where it is used.

REPLY [4 votes]: The concept of boundary can be extended to the (regular) CW-complexes, as suggested here.  
The boundary of a (regular) CW-complex $X$ is :  $$\partial X := \overline{\bigcup_{n \ge 0}(\bigcup_{c \in \text{n-cells}} \partial c) / (\bigcup_{c \ne c'\in \text{n-cells}} (\partial c \cap \partial c'))}$$    
Definition : The notation "$n$-cells" above, is the set of closed $n$-cells.     

Example : Let $X$ be a topological space with the following simplicial complex structure :
 
All the sets : 

$0$-cells $=\{ A,B,C,D,E,F \}$ 
$1$-cells $=\{ [A,B],[B,C],[C,D], [D,E],[E,A],[A,F]...  \}$
$2$-cells $=\{ [A,B,F],[B,C,F],[C,D,F], [D,E,F],[E,A,F]\}$  

Now :  

$\partial A = \partial B = ... = \partial F = \emptyset$   
$\partial [A,B] = \{A,B \}$ , $\partial [B,C] = \{B,C \}$ , ....
$\partial [A,B,F] = [A,B] \cup [B,F] \cup [A,F] $, $\partial [B,C,F] = [B,C] \cup [C,F] \cup [B,F] $, ...    

So :  

$(\bigcup_{c \in \text{0-cells}} \partial c) / (\bigcup_{c \ne c'\in \text{0-cells}} (\partial c \cap \partial c')) = \emptyset$  
$(\bigcup_{c \in \text{1-cells}} \partial c) / (\bigcup_{c \ne c'\in \text{1-cells}} (\partial c \cap \partial c')) = \emptyset$  
$(\bigcup_{c \in \text{2-cells}} \partial c) / (\bigcup_{c \ne c'\in \text{2-cells}} (\partial c \cap \partial c')) = (A,B) \cup (B,C) \cup (C,D) \cup (D,E) \cup (E,A)$  

Conclusion : $\partial X = [A,B] \cup [B,C] \cup [C,D] \cup [D,E] \cup [E,A]$   

Questions : Let $X$ be a topological space admitting a (regular) CW-complex structure :       

Does $\partial X$ depend on the choice (regular) CW-complex structure ?
Can we extend this definition for all the topological spaces ?