If $E\subset Y\subset X$ and $X$ is a metric space then give the example & prove the Theorem stated below. Suppose $E\subset Y\subset X$, where $X$ is a metric space.

*

*Give an example such that $E$ is closed relative to $Y$, but not closed relative to $X$.


*Show that $E$ is closed relative to $Y$ iff $E=Y\cap F$ for some closed set $F$ of $X$.
This question came to me when I was reading Sec. 2.32 (Compact Sets) from Baby Rudin. The questions are not explicitly stated in the book. So if any of them is false, then sorry and provide proof. But I suspect both the questions are true.
 A: 2.30 Theorem:  Suppose $E\subset Y\subset X$. $E$ is open relative to $Y$ iff $E=Y\cap G$ for some open subset $G$ of $X$.
Proof of 2:
Suppose $E$ is closed relative to $Y$. Then $Y\setminus E$ is open relative to $Y$ and $Y\setminus E=Y\cap G$ for some open subset $G$ of $X$. $p\in E\Rightarrow p\notin Y\setminus E\Rightarrow p\in Y$ but $p\notin G\Rightarrow p\in Y$ and $p\in X\setminus G$. So $E\subset Y\cap X\setminus G$. Again $q\in Y\cap X\setminus G\Rightarrow q\in Y$  but $q\notin G\Rightarrow q\in Y $ but $q\notin Y\cap G=Y\setminus E\Rightarrow q\in E$. Thus $Y\cap F=E$, where $F=X\setminus G$ is a closed subset of X.
Conversely, let $F$ is closed in $X$ and $E=Y\cap F$. Now $t\in Y\setminus E\Rightarrow t\notin F\Rightarrow V_t\cap F=\emptyset$ for some open ball $V_t$ in $X\Rightarrow (Y\cap V_t)\cap (Y\cap F)=\emptyset\Rightarrow (V_t\cap Y)\cap E=\emptyset$.
So $t$ is not a limit point of $E$ relative to $Y$ and $E$ is closed relative to $Y$.
A: The open balls in $(X,d)$ are of the form $B_X(a,r):=\{x \in X: d(a,x)<r\}$, then the open balls in $(Y,d)$ (let's write $d|_{Y\times Y}=d$) should be $B_Y(a,r):=\{x \in Y: d(a,x)<r\}$ but then $B_Y(a,r)=B_X(a,r)\cap Y$ and this is true for any open ball. The same is true for any open set too. Let $O\subseteq Y$ be open relative to $Y$, since $O$ is an open neighborhood of each of its points (relative to Y), for each $x_\alpha \in O,~~~\exists~~~r_\alpha>0$ such that $x_\alpha \in B_X(x_\alpha,r_\alpha)\cap Y\subseteq O$. So $\cup_\alpha (B_X(x_\alpha,r_\alpha)\cap Y)=O$ (you can show if $x_\alpha \in O$ then $x_\alpha \in B_X(x_\alpha,r_\alpha)\cap Y$) this implies $(\cup_{\alpha}B_X(x_\alpha,r_\alpha))\cap Y=O$. $B_X(x_\alpha,r_\alpha)$'s are open in $X$ and arbitrary union of open sets are open so our claim is proved.\
Now we prove 2. $\Rightarrow$   Let $E$ is closed relative to $Y$ then $Y\setminus E$ is open relative to $Y$, there exists an open set $O$ in $X$ such that $Y\setminus E = Y \cap O$ from which you can show  that $E=Y \cap (X \setminus O)$ where $X \setminus O=F$.\
$\Rightarrow$   Let $F$ be closed in $X$ and $E=Y \cap F$. We will show any $y \in Y \setminus E$ is not a limit point of $E$ relative $Y$. Note that $y \notin F$, there exists an open ball $B_X(y,r)$ in $X$ such that $B_X(y,r) \cap F=\phi $ which implies $(Y \cap B_X(y,r))\cap (Y \cap F)=\phi$. Thus $E$ is closed in $Y$.\

*

*Take $X=\mathbb{R},~Y=(0,1),~E=[\frac{1}{2},1)$ then $E=Y \cap [\frac{1}{2},\frac{3}{2}]$.

