# Does a continuous distance satisfy the triangle inequality?

I am not sure what tags are most appropriate here, so any help is appreciated (I found no tags for premetrics, quasimetrics, pseudometric, etc.). My level is undergrad-master.

Let a distance function on $$X$$ be a function $$d:X\times X\to[0,\infty]$$ that satisfies:

1. reflexive: $$d(x,x)=0\quad\forall x\in X$$
2. symmetric: $$d(x,y)=d(y,x)\quad\forall x,y\in X$$

A distance $$d$$ could then further satisfy the triangle inequality, i.e.

1. $$d(x,y)\leq d(x,z)+d(z,y)\quad\forall x,y,z\in X$$.

We can also define convergence of sequences for a distance, saying that $$\{x_n\}_n\to x$$ if $$\lim_{n\to\infty}d(x_n,x)=0$$. And thus we could define a distance $$d$$ to be continuous if for any sequences $$x_n,y_n$$ s.t. $$x_n\to x, y_n\to y$$ then $$d(x_n,y_n)\to d(x,y)$$.

I am then interested to see what the triangle inequality (3) gives us more precisely.

We can prove that a distance $$d$$ satisfying (3) is continuous:

$$$$|d(x_n,y_n)-d(x,y)|=|d(x_n,y_n)-d(x_n,y)+d(x_n,y)-d(x,y)|\leq \\ |d(x_n,y_n)-d(x_n,y)|+|d(x_n,y)-d(x,y)|\leq d(y_n,y)+d(x_n,x)\to 0, \text{ as }n\to\infty.$$$$

Question(s): However, can we prove that a continuous distance satisfies (3)? If so (not): any hints (counterexamples)? Also, could we then somewhat informally say that what (3) gives us is precisely what is needed to talk about continuity of a distance, i.e. that (3) characterizes the notion of continuity of a distance? Am I missing something obvious here or does this reasoning make sense?

This is a concrete instance of Example $$2.2$$ from The Geodesic Problem in Quasimetric Spaces by Qinglan Xia.

Define $$d$$ on $$\mathbb{R}^2$$ by $$d(x,y)=|x-y|+2|x-y|^2$$

Clearly, $$d$$ is continuous, nonnegative, reflexive, and symmetric.

We have \begin{align} d(1,3)&=2+2\cdot4=10\\ d(3,6)&=3+2\cdot9=21\\ d(1,6)&=5+2\cdot25=55 \end{align}

and the triangle inequality doesn't hold.

• I just noticed that the simpler example $d(x,y)=|x-y|^2$ also works. Commented Apr 19, 2021 at 15:06
• Nevertheless, this was a great answer. No wonder I wasn't able to prove it. It was just one of those things that felt like it ought to be true somehow. But I guess I should've caught that simple counterexample though. Commented Apr 19, 2021 at 15:08
• @Christopher.L That's odd. As soon as I saw it, I thought it wasn't true, though I didn't know why not. Probably just that if it were true, it would be common knowledge. Commented Apr 19, 2021 at 15:11
• Yes, well, I guess my feeling wasn't that well founded to be honest. My intuition was along the lines of triangle inequality playing the role of transitivity and continuity somehow being about staying connected. I guess these studies of more general distances is still a bit new to me. I though it was interesting though, but because of lack of knowledge I wasn't as able to seek out an answer. (Well done, and quick!) Commented Apr 19, 2021 at 15:19