# Nonobvious examples of metric spaces that do not work like $\mathbb{R}^n$

This week, I come to the end of the first year analysis, and suffer from a "crisis of motivation." With this question, I want to chase away my thought, "Why is it important to study the general properties of metric spaces? Is every good example just a subset of $\mathbb{R}^n$?"

I will explain. During many proofs, I visualize something like $\mathbb{R}^2$. The professor always draws these pictures: This is good for many theorems, since much of the analysis is motivate by questions about $\mathbb{R}^n$. But my mental picture is now only $\mathbb{R}^n$. For appreciate the study of metric spaces in full generality, and for intuition, I request more useful examples of metric spaces that are significantly different from $\mathbb{R}^n$, and are not contain in $\mathbb{R}^n$.

Here, I say "useful" to mean that the example "could naturally arise in another context", in mathematics or an application. It is frustrate when I ask why some property does not hold in general, and someone tells me consider the discrete metric. Yes, it is true, and it is easy to see, but the discrete metric is stupid. Does my property fail in any metric space that someone would care about?

In other words, I have the following taxonomy of metric spaces:

• $\mathbb{R}^n$ and the subsets

• degenerate examples like the discrete metric

• contrived examples that I would not see except in analysis (I mean if they are only exist to be pathological, this is where I think to place the Cantor set)

I want to expand this taxonomy, so that when I hear the new definition or theorem, I can compare to this collection of good examples. I know there must be examples with intricate and intuitive interpretations in statistics, science, and engineering.

Which metric spaces are not in my mental taxonomy? In general, what are the useful, non-obvious metric spaces that a student should keep in his mind when learning analysis?

To me, the ideal answer includes the description of the metric space, what properties it has to be unique and different, some consequences of the properties that make different from my examples, and (if not obvious) where I could find the metric space in practice.

One last thing is that I am looking specifically for the examples which are different as metric spaces, so no equivalence to $\mathbb{R}^n$ or any of the subsets or my other list items. I mean isometry with equivalence, I think, but maybe to homeomorphism, I am not sure how I make the best cut. I am just unsatisfy for spaces that look too much like what I could build in $\mathbb{R}^n$ and use in practice.

• How about function spaces such as the $L^p$ spaces? They might be "examples that you would not see except in analysis", but they are extremely important, not contrived by any means. There are also the corresponding sequence spaces $l^p$. – Bungo Dec 12 '14 at 3:48
• @Bungo Maybe you can write some about how to see these, I have heard about but do not know a lot how they work. (I think this question has a few answers, but I hesitate to make big-list so that it will not be an opinion.) – Samuel Handwich Dec 12 '14 at 3:52
• Ok, I added an answer, hopefully you'll find it interesting. – Bungo Dec 12 '14 at 4:11
• One that I find fun to think about is the Hausdorff metric on the set of compact subsets of $\mathbb{R}^n$. An expanding ball centered on a point, or compact set, is the set itself dilating. This metric space is important in the context of fractals. – Ross Pure Dec 12 '14 at 4:15
• Speaking of the discrete topology, here's an interesting theorem: a space under the discrete topology is homeomorphic to a subset of $\Bbb R^n$ if and only if it is countable. – Ben Grossmann Dec 12 '14 at 15:04

Nice question. I'm not sure that this will be exactly what you want, but let's go for it: consider $X = \{A,B,C,D\}$, and define $d: X \times X \to \Bbb R$ putting $d(p,p) = 0$ for all $p \in X$, $d(p,q) = d(q,p)$ for all $p,q \in X$, and:

$$d(A,B) = d(A,C) = d(B,C) = 2, \qquad d(A,D) = d(B,D) = d(C,D) = 1.$$ Here, $1$ and $2$ are for simplicity (note: $1 < 2$). Here's a picture: I like to think that this little space is useful for convincing myself that a result I'm seeing for the first time is true.

• I do like this little example very much :) – Samuel Handwich Dec 12 '14 at 4:10
• By the way, this is a specific case of neuguy's example of distance on a graph, in this case a star graph with three leaves. – user856 Dec 16 '14 at 6:51

Here is one that comes up pretty frequently. Consider a graph $(V,E)$ where $V$ is the set of vertices and $E$ the set of edges. For two vertices $v,w\in V$ define $$d(v,w) = \text{length of shortest path between}~v~\text{and}~w.$$ You can check this is a metric fairly easily. It has applications in discrete mathematics (where you may want to use metric space properties to study a graph), which probably isn't surprising. What may surprise you is that it also has applications in group theory: one can represent a group using a graph (the Cayley graph), and then this metric defines what is called the word metric on the graph. This is one of the topics one might study in geometric group theory.

• This is very good, I think it is qualitate from a lot of the other. What are the metric properties for this metric (like compact and open sets)? Is there a page with the list? – Samuel Handwich Dec 12 '14 at 4:12
• The metric topology coincides with the discrete topology in this case, so topological questions typically aren't very interesting. The interesting questions are how the metric interacts with actions on the group. This lets you study the group via its quasi-isometries, or as a dynamical system, etc. – Gyu Eun Lee Dec 12 '14 at 4:28
• I see, that is still very cool. – Samuel Handwich Dec 12 '14 at 5:05
• @SamuelHandwich: The metric can be extended to the graph itself, by requiring that each edge $E$ be isometric to the unit interval $[0,1]$. These examples are extremely important in group theory where they fall under the nomenclature of the "Cayley graph" of a group en.wikipedia.org/wiki/Cayley_graph. These Cayley graphs are the foundation of an entire branch of mathematics known as "geometric group theory" en.wikipedia.org/wiki/Geometric_group_theory. – Lee Mosher Dec 12 '14 at 17:37

I think completely ruling out subsets of $\,\mathbb{R}^n$ misses the point.

Suppose you have a curved surface (for definiteness, sitting in 3-space). If you want to stay inside it, as we do when considering large distances here on earth, we don't use the ambient space metric, but rather the arclength of the shortest path between 2 points, called the geodesic. This metric space can be very different from the ambient space (for instance, the sphere is compact).

Also, the reason your professor's drawing is so useful is because that's precisely the idea metric spaces try to capture: they are sets where we have tools to filter points with balls of arbitrary length. Once we identify a problem can be phrased in the language of metric spaces, our experience with these drawings gives us instant intuition, and enables us to ask the right questions. In abstract places like function spaces, it's this kind of "ball reasoning" that lets us produce beautiful theorems like the Stone-Weierstrass Theorem , even when it might difficult to visualize what ball of functions looks like.

• +1 for "that's precisely the idea metric spaces try to capture" – Benjamin Dec 12 '14 at 10:33
• Years later, I find I finally understand this comment. Thanks again. – Samuel Handwich Jul 1 '16 at 4:14

One important set of spaces that are fundamental to analysis are the $L^p$ spaces. For any real number $p \geq 1$, we define $L^p$ to be the set of all (say real-valued) functions $f$ such that $$\int |f(x)|^p dx < \infty$$ where the integral is taken over the domain of interest, for example $\mathbb{R}$.

For a function $f \in L^p$, we define the $L^p$ norm of $f$ to be $$\|f\|_p = \left(\int |f(x)|^p dx\right)^{1/p}$$ and if $f,g \in L^p$, we define the metric (distance) between $f$ and $g$ to be $$d_p(f,g) = \|f - g\|_p = \left(\int |f(x) - g(x)|^p dx\right)^{1/p}$$ It turns out that $d_p$ satisfies the triangle inequality, which is usually called Minkowski's inequality in this context. (Note that the triangle inequality fails for $p < 1$, which is why we restrict our attention to $p \geq 1$.) Also, clearly $d_p(f,g) = d_p(g,f)$ and $d_p(f,g) \geq 0$ for all $f,g \in L^p$.

One subtle point is that $d_p$ is not quite a metric, because it's possible to have $d_p(f,g) = 0$ for two different functions $f$ and $g$. However, if $d_p(f,g) = 0$, then $f$ and $g$ are "almost" equal (we say that they are equal almost everywhere, or equal except on a set of measure zero). So with the understanding that we don't make a distinction between functions that are almost equal, $d_p$ is indeed a metric and so $L^p$ is a metric space.

The $L^p$ spaces are especially nice because they are not merely metric spaces, but also enjoy some other nice properties.

• The $L^p$ spaces are complete: if $(f_n)$ is a Cauchy sequence of functions in $L^p$, then $(f_n)$ converges to a limit $f \in L^p$.
• The $L^p$ spaces are normed vector spaces: you can add and subtract elements (functions) and multiply them by scalars, and there is a norm ("size") $\|f\|_p$ associated with each element. In fact, any normed vector space is a metric space if we define the distance between two elements $a$ and $b$ in terms of the norm: $d(a,b) = \|a-b\|$
• The special case of $L^2$ is essentially an infinite-dimensional analogue of euclidean distance: $\left(\int |f(x) - g(x)|^2 dx\right)^{1/2}$ is the continuous equivalent of the euclidean distance $\left(\sum_{n=1}^{N} |x_n - y_n|^2\right)^{1/2}$.
• There is also an inner product on $L^2$, defined by $\langle f,g\rangle = \int f(x) g(x) dx$ (assuming real-valued functions), which is analogous to the dot product $x \cdot y = \sum_{n=1}^{N}x_n y_n$. We can use this to extend the notion of orthogonality to functions: $f,g \in L^2$ are said to be orthogonal if $\langle f,g\rangle = 0$. The important Cauchy-Schwarz inequality holds in $L^2$, namely $|\langle f,g\rangle| \leq \|f\|\|g\|$. We can even define the angle between two functions analogously with the dot product: namely, the value of $\theta$ satisfying $\langle f,g \rangle = \|f\|_2 \|g\|_2 \cos(\theta)$.
• Note: The special properties of $L^2$. as Bungo illustrates here, turn it into what is known as a Hilbert space, generalizations of Euclidean space. – Lost Dec 12 '14 at 4:22
• Another note to solidify the fact that this is not a subset of $\Bbb R^n:$ for any $p$, the $L^p$ space over an interval does not satisfy the Heine-Borel theorem. That is, there exist closed and bounded sets that are not compact. In particular, the unit ball around $0$ is not compact. For characterizations of compact sets in $L^p$ spaces, we need results like the Arzela-Ascoli theorem (which applies for $p = \infty$). – Ben Grossmann Dec 12 '14 at 14:50

Why is it important to study the general properties of metric spaces?

What properties of metric spaces have you studied? What have you gone on to do with them?

I agree that there is a tendency to introduce metric spaces at the beginning of an analysis course as a sort of "proper generality". This naturally leads to the OP's question, because analysis is not the study of general metric spaces. Rather, it really is the study of subspaces of $\mathbb{R}^n$ first and foremost, and then the study of certain spaces of real- and complex-valued functions on sets, which are often (though not always) endowed with a metric. So if you haven't reached the point in analysis where you are studying spaces of functions, then in my opinion you are essentially correct in your point of view: you haven't needed to think about general metric spaces yet.

One more comment: the picture you produced is indeed one of the most common pictures one should have in mind when dealing with abstract metric spaces. There is no doubt that the idea of a metric space comes first and foremost from Euclidean spaces, and our geometric intuition for these spaces is so strong that we should use it as much as possible when working in a metric space. Intuition is a powerful and tricky thing: we don't need to be working in the setting in which our intuition was developed in order for it to be useful (or even indispensable). I worried about this too as a young student: my instructors would talk about curves over an arbitrary field, or sometimes explicitly over a finite field, and they would still draw them as curves in the plane. But a curve over a finite field is a finite set of points [or, if you want to be more scheme-theoretically sophisticated than I was then, a countably infinite set of points: no help!]. It took me a while to realize that it was "okay" to use these pictures even when they clearly didn't literally apply, and in fact that it was very clever to do so.

On the other hand, the intuition gained in one setting is not always helpful in a genuinely different setting: that is more or less the definition of "genuinely different". So one wants to supplement that intuition with some understanding of the differences. One crisp way to phrase your question is:

What are some properties of any subset of Euclidean n-space that are not shared by a general metric space?

Here are three important ones:

1) They have at most continuum cardinality.
2) They are separable: equivalently (for metric spaces), they have a countable basis.
3) Bounded subsets are totally bounded.

In each case this holds because the property is possessed by Euclidean n-space itself and is hereditary: i.e., passes from a metric space to all of its subspaces.

Note that in any metric space, total boundedness implies separability implies at most continuum cardinality. So in my opinion "bounded but not totally bounded" is a good answer to your question: in my experience this is precisely a property of a metric space that is hard to understand at first because it is possessed by subspaces of Euclidean space. The property of total boundedness is often not made explicit in analysis courses, but it's certainly lurking under the surface. Total boundedness is critically used in the standard "Lion-Hunting" proof of the Heine-Borel Theorem given in Rudin's Principles. In fact, that argument is clearly some kind of family relative of the "abstract" theorem that a metric space is compact iff it is complete and totally bounded. More plainly, whenever you have a metric space which is bounded not totally bounded, by taking its completion you get a metric space which is complete [hence "absolutely closed"] and bounded but not compact. Most of the examples given in the other answers admit subspaces of this form.

Another important example is the Hilbert cube $\prod_{n=1}^{\infty} [0,1/n]$. This metric space is compact, hence totally bounded. It cannot be embedded in finite-dimensional Euclidean space for reasons of topological dimension theory [if there is some quick, elementary argument, I'd like to see it]. Every separable metric space can be topologically embedded in the Hilbert cube.

Most of the examples discussed above really live in the "uniform category", i.e., we could replace isometric embeddings with uniformly continuous maps and have the same result. Truly metric obstacles are quite different in nature. Ivo Terek's answer is the optimal example of this: it is (the smallest) finite metric space which cannot be embedded in Euclidean space. Being finite, any injection into $\mathbb{R}^n$ is uniformly continuous, so this is really about isometries rather than uniform maps. By the way, spaces in analysis are usually only studied up to uniform equivalence (at the most, up to Lipschitz equivalence). The study of isometries is called geometry.

The discrete metric is not stupid at all, I do not know why you would say that.
(I am not kidding, I bet in the future you will appreciate it more and more :)

Take $\{0,1\}$ with, well, not much choice, the discrete metric, $d(0,1)=1$.

Now take $\{0,1\}^\omega$ with the product topology. One nice metric for it is $d(\langle x_0,x_1,..\rangle,\langle y_0,y_1,..\rangle)=2^{-k}$ where $k=\min\{m:x_m\not=y_m\}$. (True in this definition I do not really use the discrete metric, I do not need any metric on $\{0,1\}$, but we are talking after all about the countable power of the discrete topological space $\{0,1\}$, and it is most natural to think of $\{0,1\}$ as having the discrete metric.)

Of course $\{0,1\}^\omega$ is homeomorphic to the Cantor set, but nevertheless the above metric (different from the one inherited from the real line) is interesting, since it is non-Archimedean: Given any two open balls, they either do not intersect, or one is contained in the other. (The above example is closely related to the Baire space as used in descriptive set-theory: A metric defined in a similar way as above, but on $\Bbb N^\omega$. See also this related answer.)

• I just say discrete metric is stupid because it is the easy example when you are wrong, but mostly it says nothing. It is like the trivial group, if you say all groups have non-trivial normal subgroup, the trivial group tells you no, but if you ask for a group with no non-trivial normal subgroups, the trivial group has one, but it is the stupid example. Maybe I am just not appreciate until I am old enough in analysis. – Samuel Handwich Dec 12 '14 at 4:52
• Anyway, I do like this non-Archimedean, even though it is pretty pathologic. Does it come up in another place sometimes? – Samuel Handwich Dec 12 '14 at 4:53
• @SamuelHandwich Cantor sets are quite important. They are of course very nice counterexamples to some of our intuitive reasoning, but they also give us the notion of singular functions, which gets naturally extended into the notion of singular measures. This gets you the Lebesgue decomposition theorem. The first real application of singular functions I can think of is in defining continuous time stochastic processes which have reflecting boundaries. These are very physically motivated; for example, the problem of heat diffusion in an insulated body corresponds to this situation. – Ian Dec 12 '14 at 14:39
• @Samuel: The class of all discrete metric spaces is much more interesting than the trivial group! A discrete metric space is exactly as interesting as its underlying set, and arbitrary sets are very interesting. There are also many topological constructions that take discrete spaces as input and yield highly nondiscrete spaces as output. For instance the Stone-Cech compactification of (even) a countably infinite discrete space is a highly interesting mathematical object. – Pete L. Clark Dec 23 '14 at 18:20
• To add to this old thread, and to address the questions raised by @SamuelHandwich, the Cantor set is so far from pathological that is appears naturally in several branches of mathematics, albeit with different metrics. Number theory: For a prime $p$, the ring of integers $\mathbb Z_p$ in the field of $p$-adic numbers $\mathbb Q_p$ (described in my answer to this question), is a Cantor set. Geometric group theory: The space of ends of the free group $F_n$, aka the Gromov boundary of $F_n$, is a Cantor set. Dynamical Systems: The recurrent set of the Smale horseshoe is a Cantor Set. – Lee Mosher Feb 15 '20 at 14:55

An example is the Schwartz class $S(\mathbb{R^n}) = \{f(x): \mathbb{R}^n \to \mathbb{C} : f(x) \in C^{\infty}(\mathbb{R}^n)$ and $\operatorname{sup}_{x \in \mathbb{R^n}}|x^{\alpha}\partial^{\beta}f(x)|< \infty$ for all multi-indices $\alpha, \beta$}

with the metric $$d\left( f,g \right) =\sum _{\alpha, \beta }{\frac{1}{{2}^{|\alpha|+|\beta|}}}\frac{{\left\|f-g \right\|}_{\alpha,\beta }}{ 1+{ \left\| f-g \right\| }_{ \alpha,\beta } }$$

where $||f||_{\alpha, \beta} = \operatorname{sup}_{x \in \mathbb{R^n}}|x^{\alpha}\partial^{\beta}f(x)|$

The Schwartz space itself is nice because it provides a convenient space in which we can do Fourier analysis - as all functions and their derivatives of all orders decrease rapidly, we don't have to worry about convergence of the integral in the definition of the Fourier transform and can define the FT for all derivatives as well. The Fourier transform defines an automorphism of the Schwartz class.

Furthermore, $S(\mathbb{R^n})$ is complete with respect to this metric and is dense in $L^p(\mathbb{R^n})$ for $p \geq 1$ (see Bungo's answer for more on those spaces). The latter is because the space $C_c^{\infty}(\mathbb{R^n})$, the space of smooth, compactly supported functions, is dense in $S(\mathbb{R^n})$ itself. Note that the fact that $L^2$ is a Hilbert space allows us to do Fourier analysis on $L^2(\mathbb{R^n})$ itself.

Here is an example that comes from number theory rather than from analysis.

Euler believed that if you fix a prime number $p$ then infinite series of the form $$a_0 + a_1 p + a_2 p^2 + a_3 p^3 + \cdots$$ make some kind of mathematical sense, where the coefficients are chosen in $\{0,1,…,p-1\}$. More generally one might wonder how to make sense of a similar series starting not just at $0$ but at any integer, $$a_k p^k + a_{k+1} p^{k+1} + \cdots$$ In modern number theory a series as above is called a "$p$-adic number".

The field of $p$-adic numbers is constructed formally from the rational numbers $\mathbb{Q}$ by using metric completion, quite like the way in which $\mathbb{R}$ is constructed from $\mathbb{Q}$ using metric completion, but the metric is very different.

Formally, one defines a metric on the rational numbers $\mathbb{Q}$ by the formula $$d_p\biggl(\frac{a}{b},\frac{c}{d}\biggr) = p^{-i}$$ where the exponent $i$ is defined by the equation $$\frac{a}{b} - \frac{c}{d} = p^i \frac{e}{f}$$ and the integers $e,f$ have no factors of $p$. This metric $d_p$ on $\mathbb{Q}$ is incomplete. The space of $p$-adic numbers, denoted $\mathbb{Q}_p$, is defined to be the metric completion of $\mathbb{Q}$ with respect to the metric $d_p$.

One way to sum this all up is to notice that starting from the series above, the sequence of partial sums $$S_m = a_0 + a_1 p + a_2 p^2 + \cdots + a_m p^m$$ is a Cauchy sequence with respect to the $p$-adic metric $d_p$, and so the infinite series does indeed exist as an element of $\mathbb{Q}_p$.

As Bungo said in the comments, you can also consider the $\ell^p(\mathbb{N})$ spaces.

For $1 \leq p < \infty$ they're the sets of summable sequences to the p-th power:$$\ell^p = \bigg\{x \colon \sum_{n = 1}^{\infty} |x_n|^p < \infty\bigg\}$$ With the norm $$\|x\|_p = \bigg(\sum_{n = 1}^{\infty} |x_n|^p\bigg)^{1/p}$$

And for $p = \infty$

$$\ell^{\infty} = \bigg\{x \colon \sup_{n \in \mathbb{N}} |x_n| < \infty\bigg\}$$ That is, the sequences of all bounded functions, with the norm $\|x\|_{\infty} = \sup_{n \in \mathbb{N}} |x_n|$.

They have the same properties that Bungo listed, so I wont list them again. This is because an $\ell^p$ space is an ${L}^p$ space wich is integrating the functions that take natural numbers under what is called a counting measure, this will be a bit more clear when you take a course that teaches Lebesgue integration.

But you can also consider two metric spaces more related to $\ell^p$, $c$ and $c_0$, the first one, $c$, is the sets of all convergent sequences under the $\|\cdot \|_\infty$ norm, and $c_0$ is the set of all convergent sequences to $0$ under the same norm.

You can also order these spaces in the following form

$$\ell^1 \subseteq \ell^2 \subseteq \dots \subseteq c_0 \subseteq c \subseteq \ell^{\infty}.$$

For more on $\ell^p$ spaces and metric spaces I could refer you to:

1. Real analysis. Carothers (a third of this book is dedicated to metric spaces), followed by
2. A short course on Banach space theory

or indepently

1. Infinite Dimensional Analysis a Hitchiker's guide.

Another metric space (used in Information Theory) you can consider is, taking finite tuples or sequences of zeros and ones with the same lenght $n$, and defining over them what is called a Hamming distance:

$$d(x,y) = \sum_{\substack{x_i\neq y_i\\ i =1}}^n 1 = \sum_{i = 1}^n |x_i - y_i|$$

Here the right hand is the $\ell^1$ distance, but the middle one would still make sense if you consider for example instead of zeros and ones, vectors of natural numbers.

A graphic example, taken from, Red shows the distance from $011$ to $100$, $d(011,100) = 3$, and blue from $111$ to $010$, $d(111,010) = 2$.

The Hilbert space $(z_1,z_2,z_3,\ldots)$ where each $z\in\mathbb C$ and $\sum_{n=1}^\infty |z_n|^2<\infty$ certainly comes up. It is isomorphic to the space of functions $f:[0,1]\to\mathbb C$ with the metric $d(f,g)=\int_0^1 |f(x)-g(x)|^2\,dx<\infty$.

Another example is spaces with the uniform metric $d(f,g)=\sup \{ |f(x)-g(x)|: x\in\text{some domain} \}$.

Smooth manifolds can have metrics. And then one speaks of things like curvature. On one very well known manifold one can find three points $a,b,c$ that are a degenerate triangle (i.e. equality holds in the triangle inequality) and a fourth point whose distance from each of the three is $1$.

• What is the well-known manifold? I think its triangle is the same one as Ivo Terek example. – Samuel Handwich Dec 12 '14 at 4:15
• I had in mind the sphere: suppose $a,b,c$ are on the equator and $d$ is the north pole. ${}\qquad{}$ – Michael Hardy Dec 12 '14 at 4:25

Consider the space of all continuous functions on $[0,1]$ with the sup norm, or the integral norm.

For this question: In general, what are the useful, non-obvious metric spaces that a student should keep in his mind when learning analysis?

What about distance on $\mathcal{M}(X)$ the set of all Borel probability measures on $X$? Wasserstein distance for example. Let $(X,d)$ a metric space and define $$d_W,_p(\mu,\nu)=\bigr(\inf_{m\in \prod(\mu,\nu)}\int_{X\times X}d(x,y)^pd_m(x,y)\bigl)^{1/p}$$

where $\prod(\mu,\nu)$ is the set of all couplings of $\mu$ and $\nu$.

Another one is Lévy–Prokhorov metric.

The truth of the matter is is that if you only consider pairs of points within a metric space and only do reasoning with pairs of points at a time, then the pictures you draw in $\mathbb{R}^2$ still carry over very well to arbitrary metric spaces. However, if you start asking about properties that concern the entire metric space or subsets of the metric space, you need to be careful.

There is one phrase from a professor that really helped me detach metric spaces from Euclidean space:

Metric spaces do not necessarily represent spatial relationships. They measure distance.

The point to his quote, that I inferred, is that distance between two objects can be construed in many different senses other than just spatial. As just a few examples, you can measure distances by how long it would take you to get somewhere, how difficult it is to accomplish a task, how grand of a miracle would need to occur to attach two events, how much of a technological leap would be necessary to get somewhere.

Don't get hung up on distances as representing spatial relationships, and you'll be well on your way.

In my experience, there are five properties of $\mathbb{R}^n$ (off the top of my head) that could potentially foul up your reasoning because they don't hold for arbitrary metric spaces.

• $\mathbb{R}^n$ is second-countable.
• The closure of $\{y\in\mathbb{R}^n: d(x_0,y)<r\}$ coincides with the set $\{y\in\mathbb{R}^n: d(x_0,y)\leq r\}$.
• The set $\{y\in\mathbb{R}^n: d(x_0,y)\leq r\}$ is compact.
• If you have a sequence $\{B_n\}$ of closed balls such that $B_{n+1}\subseteq B_n$. Then the intersection $\bigcap B_n$ is non-empty; i.e. $\mathbb{R}^n$ is spherically complete.
• $\mathbb{R}^n$ does not have "local groups" or "sets of points which are equally easy to get to from another fixed point". By this I mean that if you have two distinct points $x$ and $y$ from $\mathbb{R}^n$ and you have another point $y_2$ which is "close to $y$ in comparison to $x$" then it still might be possible that it is strictly easier to get to $y_2$ from $x$ than it is get to $y$ from $x$.

The first property sort of says that $\mathbb{R}^n$ isn't very "wide". The second property says that points which are $r$ units away from some fixed point are still close to points which are less than $r$ units away from that same fixed point. The third property sort of intimates that $\mathbb{R}^n$ doesn't have "very many dimensions". The fourth property says that if you give somebody a countable set of narrower and narrower commands (but not necessarily a set of commands that uniquely identify one course of action), they'll be able to satisfy the entire set of your commands. I'll expand on the fifth property with ultrametric spaces.

There are several examples of metric spaces that undermine each of these properties. Function spaces, such as $\ell^2$ and the set of bounded functions on $[0,1]$ with the sup norm, are usually the best places to find counterexamples to these criteria.

However, my favorite example of a metric space which does not behave like Euclidean space at all (and still are extremely relevant to several different areas of study) has to be ultrametric spaces, which typify the fifth property that I bulleted. Here are a couple of systems that exemplify ultrametric spaces:

• The universe. Where distance is measured by the technological sophistication needed in order to get to different places in the universe. It's far easier to travel within our solar system than it is to travel to the next closest solar system. So much so that all the points in our system might as well be the same distance from earth in comparison to points in that solar system. Likewise it is far easier to travel within our galaxy than it is to travel to the next closest galaxy (at least until Andromeda hits us). And then it's far easier to travel to the next galaxy in our local cluster than to leave our cluster (which we probably won't ever do).
• The Earth. Where distance is measured by the type of transportation and the type of roadways you would need to use to arrive at a destination in a timely manner.
• Complex biological organisms. Where distance is measured by the number of organ systems that need to handle a molecule to get it to a location where it can be used.
• Algorithms with parallel subprocedures and parallel sub-subprocedures and etc... which accepts and spits out the same type of data structure. Where distance is measured by the hierarchical path that an input has to take in order to be transformed into another input.

More concrete, and more rigorous, examples of ultrametric spaces are given in the other answers. The $p$-adic rationals $\mathbb{Q}_p$, for a fixed prime $p$, are perhaps the most relevant example you need to know to continue to study analysis or to enter analytic number theory.

• would you consider discipline of analysis to be about spatial relationships? about distance (like metric space)? or, about relating distance to spatial relationship? – Samuel Handwich Jul 25 '18 at 14:43
• @SamuelHandwich analysis is about inequalities. Implicit (through the use of sequences or limits) or explicit. Metric spaces provide the abstract setting in which to study the triangle inequality in its greatest generality. Despite its modest formulation, the triangle inequality (and its various instances) is the most used inequality in analysis. – user123641 Jul 25 '18 at 15:01

I am surprised nobody mentioned the Levenshtein distance which is a metric between strings - yet strings are no vectors in $$\mathbb R^n$$.