# When is a real-valued function on a metric space a metric?

Let $X$ be a space, $\ f:X\times X\rightarrow\mathbb{R}^+\cup\{0\}$ be a map satisfying the first two axioms for a metric (so $f(x,y)=0$ exactly when $x=y$, and $f$ is symmetric). Now, consider the topology generated by the following sets (informally thought of as open balls), for $x\in X$ and $a\in \mathbb{R}$: $$U(x,a)=\{y\in X: f(x,y)<a\}.$$ Assuming this topology can be proven to be Hausdorff, second-countable and regular, Urysohn's metrization theorem gives that $X$ is metrizable.

From this information, can one conclude that $f$ is a metric?

• No. Take for example $X = \mathbb{R}^2$ and $f(x, y) = ((x_1 - y_1)^p + (x_2 - y_2)^p)^{1/p}$ for $0 < p < 1$. The topology is the usual one but this is not a metric. – Todd Trimble Nov 23 '16 at 13:13
• Another (slightly sillier) example is to take $f(x,y)=(x1−y1)^2+(x2−y2)^2$ (notice the absence of the square root). – Ruy Nov 23 '16 at 13:22
• +1 Both are very good examples, thank you. Can one of you write it up (with an explicit pair for when the triangle inequality fails - eg for $(0,1),(1,0),(0,1/2)$ for Ruy's example) so I can accept it? – Simon_Peterson Nov 23 '16 at 14:14
• Also, do you know of any sufficient conditions on $X$ or $f$ to guarantee the triangle inequality? – Simon_Peterson Nov 23 '16 at 14:15

Following the example of my comment, with $X = \mathbb{R}^2$ and
$$f((x_1, y_1), (x_2, y_2)) = ((x_1 - x_2)^{1/2} + (y_1 - y_2)^{1/2})^2,$$
one sees that $f((0, 0), (0, 1/2)) = 1/2$ and $f((0, 1/2), (1/2, 1/2)) = 1/2$, whereas $f((0, 0), (1/2, 1/2)) = 2$, so the triangle inequality fails.
In general, if $X$ is a vector space (over a local field such as $\mathbb{R}$) and $N: X \to [0, \infty)$ satisfies the homogeneity condition $N(\alpha x) = |\alpha|N(x)$ for scalars $\alpha$, then the function $f(x, y) = N(x - y)$ is a metric iff the unit ball $\{x: N(x) \leq 1\}$ is convex; this implies that every ball is convex. So in some sense the triangle inequality is a generalized convexity condition.