A set that is open in any metric space that contains it

Let $X$ be a set with the following property: For all metric space $Y$ such that $X\subset Y$ we have that $X$ is an open set on $Y$. $X$ should be the empty set?

-
The formulation is a bit weird. Is what you mean equivalent to: "For every metric space $Y$ and every injective function $i:X\to Y$, the image of $i$ is open"? –  Egbert May 23 '12 at 20:41
@Egbert is the same because any set that contain other can be see as codomain of an inclusion map. –  Gastón Burrull May 23 '12 at 20:49
Natural question, since with "closed" instead of "open" we get a characterization of complete spaces. The answer is yes: such $X$ must be empty. Consider $X\times \{0\}\subset X\times [0,1]$. –  user31373 May 23 '12 at 21:03

The question makes sense only if $X$ is metrizable, in which case the answer is yes.

If $X\ne\varnothing$, fix $p\in X$. Let $Y_0=\{y_n:n\in\Bbb N\}$ be a set of distinct points not in $X$, and let $Y=X\cup Y_0$. Let $d$ be a metric on $X$, and define a metric $d_1$ on $Y$ as follows.

$$d_1(x,y)=\begin{cases} d(x,y),&\text{if }x,y\in X\\ 2^{-n},&\text{if }\{x,y\}=\{p,y_n\}\\ |2^{-n}-2^{-m}|,&\text{if }\{x,y\}=\{x_n,x_m\}\\ 2^{-n}+d(x,p),&\text{if }x\in X\setminus\{p\}\text{ and }y=y_n\\ 2^{-n}+d(y,p),&\text{if }y\in X\setminus\{p\}\text{ and }x=y_n\;. \end{cases}$$

It’s not hard to check that $d_1$ is a metric on $Y$ that agrees with $d$ on $X$. However, $p\in\operatorname{cl}_YY_0$, so $X$ is not open in $Y$. (In case the details obscure what’s really going on, I’ve just added a simple sequence $\langle y_n:n\in\Bbb N\rangle$ converging to $p$.)

Added: The same idea works in general topological spaces. Just declare a set $V\subseteq Y$ to be open iff either it’s an open subset of $X$ that does not contain $p$; it’s a subset of $Y_0$; or $p\in V$, $V\cap X$ is open in $X$, and there is an $n_0\in\Bbb N$ such that $V\supseteq\{y_n\in n\ge n_0\}$. (If you’re familiar with quotient spaces and the one-point compactification, this $Y$ is homeomorphic to the quotient of $X\sqcup Y_0^*$, where $Y_0^*$ is the one-point compactification of the discrete space $Y_0$, obtained by identifying $p$ and the point at infinite in $Y_0^*$.)

-
Thanks again Brian. Is there some analogous consequence for topologycal spaces? –  Gastón Burrull May 23 '12 at 22:01
@GastónBurrull I think you can use Leonid Kovalev's idea to extend it to any topological space. –  Keivan May 24 '12 at 0:02
@Gastón: Yes; I’ve added it to my answer. And as Keivan said, you can also use Leonid Kovalev’s idea. –  Brian M. Scott May 24 '12 at 1:45
As $X$ was merely a set, isn't it automatically contained in a metrizable space, namely equipping it with the discrete topology? –  Hurkyl May 24 '12 at 1:56
@Hurkyl: I think that Gastón intended the set $X$ to come equipped with a topology; otherwise the question isn’t at all interesting. Clearly Leonid made the same assumption. –  Brian M. Scott May 24 '12 at 1:58