There is a similarity function particular popular for processing sparse vectors such as textual data (word frequency counts etc.) commonly referred to as cosine similarity.
There are two variants to invert it to a dissimilarity, often referred to as cosine and arccos distance (distance in the weak sense, not the strict mathematical definition though!)
In essence, the similarity function is: $\text{cosine-similarity}(A,B) = \frac{\left}{||A||\cdot||B||}$ Which is then used as a distance function as either $\text{cosine-dist}(A,B) := 1 - \text{cosine-similarity}(A,B)$ $\text{arccos-dist}(A,B) := \arccos(\text{cosine-similarity}(A,B))$
Obviously, these distances cannot be a distance function on $\mathbb{R}^n$, as they are not well defined for the point $\{0\}^n$, as this leads to $0/0$. What is the proper result then? $1$? $\infty$?
I tried finding a formal proof on Google that these distances do or do not satisfy the triangle inequality. Wikipedia seems to claim only the second is a proper metric, but does not give a reference.
Update: reworked my question from here on, with updated thoughts on this issue.
As confirmed by joriki, the $0$ is a problem for this distance function, as one cannot compute the angle to this vector. There is another issue with this distance, that however in many circumstances is intentional: two vectors that are a positive linear multiple of each other will have the angle of 0, while not being the same. See his reply on why cosine-dist does not satisfy the triangle equality for small angles (I wonder if this issue is comparable to that of $L_p$ with $p<1$).
I have the following ideas in my mind, and again appreciate any pointers to literature, references, errors in these thoughts, extensions:
A) Instead of $\mathbb{R}^n$, lets look at the unit sphere instead, i.e. vectors of length $1=||A||=||B||$. $\arccos(\left)$ then is the geodesic distance on the unit sphere, which is metric, right? So in this restricted domain, arccos-dist is a proper distance?
B) Assuming I have an injective (not necessarily surjective) map from another domain to the unit sphere, then use this distance function, this becomes also a metric space? After all, any of the distance function properties should still hold, right?
C) Is arccos-dist a pseudo-metric on $\mathbb{R}^n \setminus \{0\}$? (i.e. I accept that $d(x,y) = 0 \not\Rightarrow x=y$, only $d(x,x)=0$)