# Find an example of a metric spaces

Find an example of a metric subspace $X$ of $\Bbb R$ in which : Every open set in $X$ is an open set in $\Bbb R$ , but not every closed set in $X$ is a closed set in $\Bbb R$.

I thought that i can take the set of rational numbers $\Bbb Q$ but im not sure if the conditions hold , :( please help me .

$\Bbb Q$ definition doesn’t work: $\Bbb Q$ itself is an open set in $\Bbb Q$ that is not open in $\Bbb R$.
HINT: Take $X=(0,1)$. You should have no trouble showing that every open set in $X$ is open in $\Bbb R$. Finding a closed set in $X$ that is not closed in $\Bbb R$ is a little harder; I’ve left a further hint in the spoiler-protected block below.
Look for a sequence in $(0,1)$ that converges in $\Bbb R$ but not in $(0,1)$.
$\def\Q{\mathbf Q}\Q$ will not work, as the set $U := (0,1) \cap \Q$, is open in $\Q$, but not in $\def\R{\mathbf R}\R$ (any $\R$-ball around $\frac 12$ contains irrational numbers). But you can take $X := (0,1)$. If $U \subseteq (0,1)$ is $(0,1)$-open, then for $x \in U$ there exists $\epsilon > 0$ such that $B_\epsilon(x) \cap (0,1) \subseteq U$, as $(0,1)$ is open in $\R$, after decreasing $\epsilon$, we have $B_\epsilon(x) \subseteq (0,1)$, hence $B_\epsilon(x) \subseteq U$. So $U$ is $\R$-open. But $(0,1)$ is $(0,1)$-closed, without being $\R$-closed.
It is necessary and sufficient that $X$ is an open subset of $R$ and that $\phi\ne X\ne R$....(I) It is necessary that $X$ is open in $R$ because $X$ is open in $X$. It is necessary that $X$ is not closed in $R$, otherwise for every $Y\subset R$ we would have $Cl_X(Y)=Cl_R(Y)$. So it is necessary that $X$ is open but not closed in $R$, which requires $\phi\ne X\ne R$....(II) For any $Y\subset X$ which is open in $X$ to also be open in $R$ it is sufficient that $X$ is open in $R$. It is sufficient that $X$ is not closed in $R$ because then $X=Cl_X(X)$ is not closed in $R$. So it is sufficient that $X$ is open but not closed in $R$, in other words that $X$ is open in $R$ and $\phi\ne X\ne R$. For example let $X=(0,1).$