Let $(X,d)$ be a metric space, $Z \subseteq Y \subseteq X$. Let $Z$ is closed in $(Y,d)$ and $Y$ is closed in $(X,d)$. Show $Z$ is closed in $(X,d)$. 
Let $(X,d)$ be a metric space, $Z \subseteq Y \subseteq X$. 
a) Assume $Z$ is closed in $(Y,d)$ and $Y$ is closed in $(X,d)$. Show $Z$ is closed in $(X,d)$:
b) Assume instead $Z$ is open in $(Y,d)$ and $Y$ is open in $(X,d)$. Show $Z$ is open in $(X,d)$:

In $(a)$ I know that for every $z \in Z^C$ there exists $r > 0$ such that $B_r(z) = \{y \in Y \mid d(y,z)<r \}\subseteq Z^C$. I also know $Y^C \subseteq Z^C$. Also $Y$ is closed in $(X,d)$ so for every $y \in Y^C$ there exists $r > 0$ such that $B_r(y) = \{x \in X \mid d(y,x
)<r \}\subseteq Y^C$. 
If $z \in Z^C$ is an element of $Y^C$ we are done. 
Could someone point out why the assumptions are important ?
 A: The assumptions are important because without them the statements are not true. Consider the real line with the usual metric/topology, and let $Y = [ 0 , 1 )$.


*

*Note that $Z = [ \frac{1}{2} , 1 )$ is a closed subset of $Y$, however it is clearly not closed in $\mathbb{R}$ (since $1$ is a limit point of the set in $\mathbb{R}$ which is not in $Z$).

*Note that $Z = [0, \frac{1}{2} )$ is an open subset of $Y$, however it is not open in $\mathbb{R}$ (since no ball from $\mathbb{R}$ around $0$ is a subset of $Z$).


The attentive reader will have noticed that I could have taken $Z = Y$ in both of the examples above.

The following hints are pretty strong (but also purely topological):


*

*If $Z$ isn't closed in $X$, take some $x \in \mathrm{cl}_X ( Z ) \setminus Z$.  Recall that this means that for any open neighbourhood $U$ of $x$ in $X$ we have that $Z \cap U \neq \varnothing$.  Since $x \in \mathrm{cl}_X ( Z )$ we know that $U \cap Z \neq \varnothing$.  There are two options.  If $x \in Y$, find a contradiction to $Z$ being a closed subset of $Y$ (using the fact that if $U$ is an open subset of $X$, then $U \cap Y$ is an open subset of $Y$).  If $x \notin Y$, find a contradiction to $Y$ being a closed subset of $X$.

*If $Z$ is an open subset of $Y$, then recall that the open subsets of the subspace $Y$ of $X$ look like $V \cap Y$ for some open subset $V$ of $X$: so $Z = V \cap Y$ for some open $V \subseteq X$.  This should tell us a lot about $Z$.


In the context of metric spaces, consider the following:


*

*If $A$ is a subset of a metric space $X$, then $x \in \mathrm{cl}_X (A)$ iff there is a sequence of points of $A$ converging to $x$.

*A subset $A$ of a metric space $X$ is open iff for each $x \in A$ there is a $\epsilon > 0$ such that $B(x;\epsilon) \subseteq A$.  (And if $Y$ is a subspace of $X$ with the inherited metric, then $B_Y (x;\epsilon) = B_X (x;\epsilon) \cap Y$.)

