2

How to prove that the cosine distance ($1-\text{cosine similarity}$) does not satisfy the four properties (Non-Negativity, Coincidence Axiom, Symmetry, Triangle Inequality) of a metric over Euclidean space?

If some properties are satisfied then how can I show it is satisfied?

Parcly Taxel
  • 103,344

1 Answers1

1

We have $$D(x,y) = 1- S(x,y)$$ where $$S_c(x,y) = \frac{x \cdot y}{||x|| \, ||y||}$$ First of all, $S(\cdot, \cdot)$ is not defined when either of its inputs is $0$, so $D$ cannot be a metric on $\mathbb{R}^n$. A better question to ask is whether or not $D$ is a metric on $\mathbb{R}^n \backslash \{0\}$. The answer is still no: $$D((1,1), (2,2)) = 1 - \frac{(1,1)\cdot(2,2)}{||(1,1)|| \, ||(2,2)||}$$ $$=1- \frac{4}{\sqrt{2} \cdot 2\sqrt{2}} = 0$$ actually, the coincidence axiom is violated for any pair of nonequal vectors which are positive scalar multiples of each other. Why? Think of the definition of cosine and angles between vectors in $\mathbb{R}^n$!

  • well, I have to show whether cosine distance is satisfied each of the properties of metrics or not. So in your explanation, which condition you proved? – Elizabeth J. Magee Nov 22 '20 at 07:11
  • The cosine distance is symmetric and nonnegative. I show above that it does not satisfy the coincidence axiom, hence it is not a metric.

    I would give a detailed explanation as to why each of the above properties are or aren't true, but if you need to ask "what condition was proved" in the above explanation while asking for explicit solutions to this problem, I would wager that you are not mathematically mature enough to be studying this material (no offense intended), since it is a rather simple exercise in metric spaces.

    – user5583511 Nov 22 '20 at 07:22
  • ok if I want to show that cosine distance is nonnegative and symmetric. How can I show with an example? – Elizabeth J. Magee Nov 22 '20 at 07:25
  • You cannot prove symmetry and nonnegativity with "examples" -- you need to give proofs. These are very simple calculations -- I would go far as to say that symmetry is a trivial result. If you are having trouble with this, I do not think you are ready to study this kind of problem. – user5583511 Nov 22 '20 at 07:33
  • ok. thanks for your help. let me try. – Elizabeth J. Magee Nov 22 '20 at 07:37
  • Why we need these 4 conditions for a metric please? – Avv Mar 03 '23 at 00:19