Given a non-discrete topology on a finite set $X$, can you define a metric?

Let $X$ be a finite set and $\tau$ a topology in $X$ different from the discrete topology. Is it possible to define a metric in the set $X$ such that $\tau$ is the topology associated with the metric?

In a finite metric space the natural associated topology is always discrete: define $$r:=\min\{d(x,y):x,y\in X, x \neq y\}>0.$$ Then $B(x,r)=\{x\}$ for every $x\in X$, therefore singletons are open.

• Am I missing something? The topology $\{\emptyset,X\}$ does not contain any singleton and yet is a topology on $X$, one that does not correspond to your metric. The OP is asking for metrizability of any topology on $X$. But maybe do I miss the point. – MoebiusCorzer Jan 6 '17 at 12:04
• @MoebiusCorzer The topology associated to a given metric is given (at least from what I know) by all sets $U$ which are open in the metric, meaning that for every $x\in U$ there is a ball $B(x,r)\subset U$ with $r>0$. – Del Jan 6 '17 at 12:25
• Yes, I understand the point you try to make. But firstly, in your definition, $r=0$ since you did not specify $x\neq y$ (but it is a detail). Secondly, you say "the natural associated topology". Why is that natural? But I completely agree with your answer, because the minimum always exist and thus if a topology in $X$ is metrizable, it must be the discrete one. I was initially confused by your wording. I think that a clearer answer would be "Suppose there is a metric on $X$. As $X$ is finite, $r=\min\{d(x,y):x\neq y;x,y\in X\}$ is well-defined. Now, take $B(x,r/2)=\{x\}$." – MoebiusCorzer Jan 6 '17 at 12:36
• @MoebiusCorzer You're completely right that I forgot to put the condition $x\neq y$! Thanks to arjafi for the edit. As for the "natural", I think it is the usual definition of topology associated to a metric. In fact I believe (maybe someone can confirm) that historically open sets were defined just in metric spaces as those sets that contained a ball around every point, and only later topology came in to generalize the concept (but keeping in the axioms of topology the properties that were true for metric spaces) – Del Jan 6 '17 at 13:58
• I am sincerely sorry: I thought you meant that the discrete topology is the natural one to impose on a finite metric space and, believing you meant so, I didn't see how this could answer the OP's question. I eventually understand what you wrote. My bad :) – MoebiusCorzer Jan 6 '17 at 14:03

In general the answer is no. A topology for which such a metric does exist is said to be metrizable, and many topologies are not metrizable, even on finite sets. In fact, the only $T_1$ topology on a finite set is the discrete topology, which of course is metrizable; since a metric space is automatically $T_1$, this means that there is only one metrizable topology on a finite set, the discrete topology. And if the set has more than one element, there are other topologies, starting with the indiscrete topology.

One of the nicer non-metrizable topologies on the set $[n]=\{1,\ldots,n\}$ is the one whose open sets are initial segments:

$$\tau=\{[k]:k\in[n]\}\cup\{\varnothing\}\;.$$

Since this isn’t $T_1$, it clearly cannot be metrizable. I’ll call it a nest topology on $[n]$.

More generally, if $X$ is any finite set, let $\mathscr{P}$ be a partition of $X$ having at least one part with more one element. Give each $P\in\mathscr{P}$ a nest topology, and make each $P\in\mathscr{P}$ an open set in $X$. The resulting topology is $T_0$ but not $T_1$. The closest you can get to a metrizable space finite space without actually making the topology discrete is a special case of this, in which one part has two points, and the rest have one each. This is what you get if you start with a discrete space and replace one of the points with an open copy of the Sierpiński space. You now have a space with (say) $n+1$ points, $n$ of which are isolated; the remaining point has a smallest nbhd consisting of itself and one of the other points.

The situation with infinite spaces is much more interesting. You may know some of this already, but this seems a nice opportunity to list some common examples of (mostly quite nice) non-metrizable spaces. All of them are at least $T_1$. The spaces in the second, third, and fifth bullet points are $T_5$ spaces, i.e., $T_1$ and hereditarily normal. And the spaces in the fourth bullet point are Tikhonov provided that the factor spaces are Tikhonov.

• The cofinite topology on an infinite set is not metrizable. One way to see this is to note that every metric space is Hausdorff, but the cofinite topology on an infinite set is not Hausdorff. For similar reasons the co-countable topology on an uncountable set is not metrizable.

• The Sorgenfrey line $S$ is not metrizable. One way to see this is to show that $S\times S$, the Sorgenfrey plane, is not normal; since every metric space is normal, and the product of two metric spaces is metrizable, it follows that $S$ cannot be metrizable.

• The one-point compactification $X$ of an uncountable discrete space is a very nice space in many ways, since it’s compact and Hausdorff, but it’s not metrizable: every metric space is first countable, but the point at infinity in $X$ does not have a countable local base.

• The box topology on the product of infinitely many non-trivial spaces is never metrizable, because it’s never first countable.

• An uncountable ordinal $\alpha$ with the linear order topology is never metrizable. If $\alpha>\omega_1$, it isn’t even first countable, and $\omega_1$, the smallest uncountable ordinal, is countably compact but not compact. Since a metric space is compact if and only if it is countably compact, $\omega_1$ cannot be metrizable.

• Nice answer, but the OP talks about finite $X$. – martini Jan 6 '17 at 12:00
• @martini: I know: I caught that at the last minute and accidentally posted it before I was done. – Brian M. Scott Jan 6 '17 at 12:19