# Is the median a "metric" or a "topological" property?

I apologize for the slight abuse of terminology; I hope it will become clear what I mean below.

Consider a random variable $X$. Both the mean and the median can be characterized by an optimality criterion: The mean is that number $\mu$ that minimizes $\mathrm E((X - \mu)^2)$, and the median that number which minimizes $\mathrm E(|X - \mu|)$. In this perspective, the difference between mean and median is the choice of "metric" for evaluating deviations, the square or the absolute value.

On the other hand, the median is that number for which $\mathrm{Pr}(X \leq \mu) = \frac12$ (assuming absolute continuity), i.e. this definition depends only on the ability to order values of $X$ and is independent of how much they differ. A consequence of this is that for every strictly increasing function $f(x)$, $\mathrm{median}(f(X)) = f(\mathrm{median}(X))$, meaning it is "topological" in the sense of invariance under "rubber-like" transformations.

Now I've done the math and I know that starting from the optimality criterion I can arrive at the $\frac12$-quantile, so both describe the same thing. But still I am confused, because my intuition tells me that something that depends on a "metric" cannot lead to a "topological" property.

Can someone resolve this riddle for me?

• Nice title! :-) Commented May 4, 2015 at 8:56

The flaw in your reasoning is that something that depends on a metric cannot be a topological property.

Take compactness of metric spaces. This can be defined in terms of the metric: compactness means that the space is complete (depends on the metric) and totally bounded (depends on the metric). It turns out though, that this property is an invariant under homeomorphism, and indeed, can be defined in terms of only the topology (finite sub covers of any cover, the usual way).

Another example is the various homology theories. Only singular homology is truly topological in its definition. All the others, simplicial, cellular, De Rham (cohomology, but grant me a little looseness), etc, depend on extra structure, but turn out to be equivalent (and quite a bit easier to work with).

This comes up a lot in math, sometimes the easiest way to go about defining something is in terms of some ancillary structure, and then it is demonstrated that the resulting entity does not, in fact, depend on the choice of ancillary structure at all.

• Thanks for the answer! It appears you are taking my terminology more seriously than I thought possible. I have to admit that I have only the most basic knowledge of topological and metric spaces, so this might be a stupid question: I understand that using an ancillary structure makes life easier though it is not strictly necessary – ok, maybe that is the case here, too. Commented May 4, 2015 at 14:32
• But you also say "the resulting entity does not, in fact, depend on the choice of ancillary structure at all". Do I understand correctly that one can use different ancillary structures to arrive at the exact same topology? If yes, then the analogy breaks down here, because using the "square metric" I do not arrive at the median, but at the mean, which is not invariant under monotonic transformations. Commented May 4, 2015 at 14:32
• Good point. I suppose what I'm saying is, it is not that surprising when something that can be defined in terms of a structure tuns out to be definable in terms of a weaker structure - and often when this happens you have found a useful concept! In your case, you can define the median in terms of the arithmetic and integration of real numbers, which is a lot of structure, but in fact, there is a definition that trades the arithmetic for the ordering, a weaker structure. My cases were at the far extreme, where the weaker structure turns out to be almost no structure at all. Commented May 4, 2015 at 14:49
• Another point. You could say that the reason that monotonic transformations preserve the median is because there is a way to define them in terms of structure for which monotonic transformations are the morphisms. Morphism is a general abstract nonsense word that means function that preserves some structure. Commented May 4, 2015 at 14:54
• Ok, I get the general point. But I still have the feeling there is something left unexplained, in particular the point mentioned above. I upvoted, but for this reason I won't accept your answer – maybe someone comes up with some additional insight. Thanks again! Commented May 5, 2015 at 1:42