Skip to main content
3 of 3
Included the title of the linked paper
Martin Sleziak
  • 4.7k
  • 4
  • 35
  • 40

Possibly the simplest proof of the triangle inequality for the jaccard distance comes from the fact that it is the collision probability of the MinHash algorithm, and that's all we need. Let $H(X) = \text{argmin}_{i\in X} \pi(i)$ where $\pi(i)$ is a uniformly random permutation.

\begin{align*} J(X,Y) &= \Pr\left[H(X) = H(Y)\right] \\ 1 - J(X,Y) &= \Pr\left[H(X) \neq H(Y)\right].\\ \end{align*} So for any $Z$, \begin{align*} \Pr\left[H(X) = H(Y)\right] &\ge \Pr\left[H(X) = H(Z) \land H(Y) = H(Z)\right] \\ \Pr\left[H(X) \neq H(Y)\right] &\le \Pr\left[H(X) \neq H(Z) \lor H(Y) \neq H(Z)\right] \end{align*} But by the union bound, \begin{align*} \begin{split} \Pr\big[H(X) \neq H(Z) \lor H(Y) \neq H(Z)\big] &\le \Pr\big[H(X) \neq H(Z)\big] + \Pr\big[H(Y) \neq H(Z)\big] \end{split} \end{align*}

My co-author used this to prove that a particular jaccard generalization is a metric after I'd been struggling to prove it for a month, and I couldn't believe it.