# Y open relative to X

I'm trying to prove the following theorem: Let $X\subseteq\mathbb{R}^{k}$, $Y\subseteq X$. Then $Y$ is open relative to $X$ $\iff$ $\forall y\in Y\exists\epsilon>0\ N_{\epsilon}^{X}(y)\subseteq Y$, with $N_{\epsilon}^{X}(y)=\left\{ x|x\in X\ ||x-y||<\epsilon\right\}$.

This is what I did so far:

Proof. Y is open relative to X if there exists Z open such that $Y=X\cap Z$.

Direction 1: Suppose Y is open relative to X . Then a fitting Z exists. Suppose $Y\neq\emptyset$ . If X is open, then $X\cap Z$ is open, and Y is open. Since $Y\subseteq X$ and $\forall y\in Y\exists\epsilon>0\ N_{\epsilon}(y)\subseteq Y$ . Here, $N_{\epsilon}(y)=N_{\epsilon}^{X}(y)$ , hence the statement is true.

If X is closed and $Z\subseteq X$ , then $Y=X\cap Z=Z$ , hence the statement is true.

If X is closed and $X\subseteq Z$ , then Y=X . Hence the statement is true.

If X is closed and neither $X\subseteq Z$ nor $Z\subseteq X$ , then $Y=X\cap Z$ is neither open nor closed. Also, $\left\{ X\cap Z\right\} \subset X$ , hence $\forall y\in Y\exists\epsilon>0\ N_{\epsilon}^{X}(y)\subseteq Y$ . The statement is true.

These are all the possibilities.

Direction 2: $Let Y\subseteq X\subseteq\mathbb{R}^{k}$ . Suppose $\forall y\in Y\exists\epsilon>0\ N_{\epsilon}^{X}(y)\subseteq Y$. . Suppose by contradiction Y is not open relative to X . Two cases, if Y=X , then Y is open relative to X , and the proof is over. If $Y\subset X$...?

I'm stuck here. I think I understand the intuition behind the concept of openness relative to another set, so the second direction seems trivial. Yet, I am unable to write the proof formally.

Also I'd like to get feedback on the first direction, as it is quite unelegant.

For the first direction, your proof has issues: (a) you haven't considered the case when $X$ is neither open nor closed, and (b) in your final case, you seem to be claiming that $X \cap Z \subset X$ implies that $\forall y\in Y\exists\epsilon>0\ N_{\epsilon}^{X}(y)\subseteq Y$, without any justification, which is just assuming the result.
One thing to note: if $X$ is neither open nor closed and neither $X \subset Z$ nor $Z \subset X$, then this "case" is the case where you know essentially nothing more than just $Z$ is open and $X \cap Z = Y$. So if you have a proof that works for this case, then it almost certainly works for all the other cases too, so you can skip the splitting into cases bit and just use that proof.
A hint for a proof for part 1: Note that $N_\epsilon^X(y) = N_\epsilon^{\mathbb R^k}(y) \cap X$, and use the fact that $Z$ is open in $\mathbb R^k$.
For part 2, you've been given $Y \subset X$, and you're trying to construct $Z$ which is open in $\mathbb R^k$ such that $Z \cap X = Y$. For all $y$ you've been given $\epsilon_y$ such that $N_{\epsilon_y}^X(y) \subset Y$. How might you extend these to open neighbourhoods in $\mathbb R^k$? Can you then use those to construct a suitable $Z$?
Direction 1: Assume Y is open relative to X Then $\exists$Z$\subseteq$$\mathbb{R}$$^{k}$ Y=X$\cap$Z, Z open. Let y$\in$Y. Then y$\in$Z. Therefore $\exists\epsilon>0\ N_{\epsilon}(y)\subseteq$Z , hence, N$_{\epsilon}^{X}(y)\subseteq$ Z$\cap$X=Y.
Direction 2: Assume $\forall y\in Y\ \exists\epsilon>0\ N_{\epsilon}^{X}(y)\subseteq Y$. If $X\subsetneq Z$, then there is nothing to prove. Else: Let $Y=X\cap Z$ but suppose by contradiction Z is not open. Then $X\cap Z$ is not open. Then $\exists y\in Y\ \forall\epsilon>0\ N_{\epsilon}(y)$$\not{\subseteq}Y$ . Notice $N_{\epsilon}^{X}(y)\subseteq N_{\epsilon}(y)\not{\subseteq}Y$, which is a contradiction. $\blacksquare$