In a vector space model when we are given a query as a vector πβ and documents π1 , π2 β¦, we usually rank the documents in relevance to the query vector using cosine similarity. Show by a mathematical proof that if the vectors πβ and ππ all are normalized unit vectors (i.e., |π₯β|) than the ranking by ordering the documents with increasing euclidean distance from the query is always identical to the ranking of ordering the documents with decreasing cosine similarity.
1 Answer
$\begingroup$
$\endgroup$
3
Just notice that, if $u$ and $v$ are unit vectors, then $$ \Vert u-v\Vert^2=\Vert u\Vert^2+\Vert v\Vert^2-2 \langle u,v\rangle=2(1- \cos \theta), $$ where $\theta$ is the angle between $u$ and $v$. Therefore, in this case, ordering by Euclidean distance is the same as ordering by cosine dissimilarity.
-
$\begingroup$ thank you for your answer, but are you sure that a right answer ? $\endgroup$ Commented Dec 12, 2020 at 17:35
-
$\begingroup$ I don't care about the typo I just need the right answer $\endgroup$ Commented Dec 12, 2020 at 17:55
-
$\begingroup$ thank you sir I thankful your help $\endgroup$ Commented Dec 12, 2020 at 18:01