analysis (differential/integral calculus, functional analysis, topology)
metric space, normed vector space
open ball, open subset, neighbourhood
convergence, limit of a sequence
compactness, sequential compactness
continuous metric space valued function on compact metric space is uniformly continuous
…
…
The key conditions on a distance function for metric spaces and on norms on normed vector spaces is that the distance $d(x,z)$ between any two points $x,z$ is no larger than the sum of the distances $d(x,y) + d(y,z)$ via any third point $y$
For the usual metric/norm on Euclidean space and $f$ and $g$ two edges of a triangle
then this inequality expresses that the straight path from $x$ to $z$ is always shorter or at worst as long as the path from $x$ to $z$ via $y$.
However, normed fields and hence normed vector spaces for which this example gives the correct intuition are rare among all normed fields and vector spaces (they are the archimedean ones). Most norms instead satisfy the stronger ultrametric triangle inequality which says that
A norm with this property is called non-archimedean.
One may equivalently regard the triangle equality in metric spaces as the composition operation in a certain incarnation of the metric space as an enriched category (Lawvere 73). From this perspective some concepts from analysis usefully generalize to other enriched categories, notably the concept of Cauchy complete categories. For more on this see at Lawvere metric space.
Namely regard the half-open interval $[0,\infty) \subset \mathbb{R}$ as a poset under the relation $\geq$, and regard this poset as a category (see at (0,1)-category). The operation of addition of real numbers makes this a monoidal category.
This means that a category enriched over this monoidal category $([0,\infty){\geq}, +)$ is
(objects) a set $X$;
(hom objects) for every pair of points $(x,y) \in X \times X$ a real number $d(x,y) \in [0,\infty)$
(composition) for all $x,y,z \in X$ a morphism in $[0,\infty)_{\geq}$ of the form
such that
(unitality) $d(x,x) = 0$;
(associativity) …
Now since the category $[0,\infty)_{\geq}$ is a poset, there is at most one morphism between any given pair of objects, and hence the choice of composition morphism $\circ_{x,y,z}$ above is really a condition on $d(-,-)$. Moreover, since a morphism $x \to y$ in $[0,\infty)$ exists precisely if $x \geq y$, then this condition is exactly the triangle identity
Moreover, the unitality condition is part of the non-degeneracy condition on a metric, $d(x, y) = 0$ iff $x = y$, and the associativity condition is automatically satisfied once composition is defined.
Wikipedia, Triangle inequality
Bill Lawvere (1973). Metric spaces, generalized logic and closed categories. Reprinted in TAC, 1986. Web.