# Is the Jaccard distance between probability vectors a metric?

Let X and Y be probability vectors, meaning that X = $$[x_1, x_2, ..., x_n]^T$$, where $$x_i\leq 1$$ and $$\sum_{i=1}^{n}x_i=1$$ (Y is defined similarly).

Define the Jaccard distance as

$$$$J_d = 1 - \frac{\textbf{X}\cdot\textbf{Y}}{\textbf{X}\cdot \textbf{X}+ \textbf{Y}\cdot\textbf{Y} - \textbf{X}\cdot\textbf{Y}}$$$$

Is $$J_d$$ a proper distance (i.e., metric)?

• Hi! I think you should add your own thoughts and work on this question. May 12 at 8:48
• Seems similar to mathoverflow.net/questions/18084/… (not exactly because that question has cardinalities of sets, but similar methods probably work). May 12 at 8:49
• It looks like a different question (with different answer). May 12 at 8:53
• Does this answer your question? Is the Jaccard distance a distance? May 12 at 11:59
• @Gro-Tsen The Jaccard distance is indeed a metric when applied with bits vectors. My question was regarding the application of this distance with probability vectors (i.e., distribution vectors).
– Yaz
May 12 at 13:24

No, it is not. For fixed $$Y$$, fixed $$Z=(z_1,\ldots,z_n)$$ with $$\sum z_i=0$$, and small $$t$$ we have $$J_d(Y\pm tZ, Y)\sim t^2 \frac{Z\cdot Z}{Y\cdot Y}$$, but $$J_d(Y-tZ,Y+tZ)\sim 4t^2\frac{Z\cdot Z}{Y\cdot Y}>J_d(Y-tZ,Y)+J_d(Y,Y+tZ).$$
• If all coordinates of $Y$ are positive and $\sum z_i=0$, it remains for small values if $t$. May 12 at 15:47
• If you want a concrete example, take $Y=(0.5,0.5)$, $Z=(0.1,-0.1)$ and $t=1$ in Fedor's answer. You obtain $(0.5,0.5)$, $(0.4,0.6)$ and $(0.6,0.4)$ that indeed violate the triangle inequality. May 12 at 18:59