TITLE: Definition of open and closed sets for metric spaces
QUESTION [5 upvotes]: For metric spaces, the definition of an open set $U\subset X$ is that it is a set which for any point $u\in U$ in the set there exists some $\epsilon>0$ such that the open ball $B_\epsilon(u)\subset U$. So far so good.
1) Let $X=[0,1]$ and $U=[0,1]$. I know then that $U$ is said to be both open and closed. But how does this fit the definition of it being open? Esp. consider the end point $1$. How is the open ball defined for that?
2) Similarly, $X=(0,1)$ and $U=(0,1)$ is said to be closed (in fact both open and closed)...?
Thanks for clarifying.

REPLY [6 votes]: What you need to remember is that the open ball $B_{\epsilon}(u)$ is defined as:
$$B_{\epsilon}(u) = \{x \in X \mid d(x,u)\lt \epsilon\}.$$
That is, the open ball is the collection of all points of $X$ that are less than $\epsilon$ away from $u$.
If $X=[0,1]$, and $U=[0,1]$, then for any $a\in [0,1]$ we have
$$B_{2}(a) = \{ x\in [0,1] \mid d(a,1)\lt 1\} = [0,1]\subseteq U$$
Since $B_2(a)\subseteq U$ for all $a\in U$, then $U$ is open according to the definition.
The reason $U$ is closed is that the complement, the empty set, is open.
Same thing with your second example.
That is: you are looking completely inside of $X$; you need to "forget" the fact that $X$ is sitting inside a larger metric space. That does not matter when discussing the topology of $X$, any more than the fact that $\mathbb{R}$ is sitting inside of the plane matters when discussing open sets of $\mathbb{R}$.

REPLY [2 votes]: The open balls only contains points in $X$. When you say $X=[0,1]$, that's the set you are working in. So, for example,  the open ball in $X=[0,1]$ of radius 1/2 centered at 1/4 would be the set $[0,3/4)$, not the set $(-1/4,3/4)$. 
In the definition of the open ball:
$B_\epsilon(x)=\{ y\in X : d(x,y)<\epsilon\}$, note that we require "$y\in X$".