Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is defined in Wikipedia

But I saw it as another way of calculating it for vectors and similar

$$d = \mathrm{num}_1 + \mathrm{num}_2 - 2 \times \mathrm{intersect}$$

  • $d$= distance
  • $\mathrm{num}_1$ = number of values in left vector
  • $\mathrm{num}_2$ = number of values in right vector
  • $\mathrm{intersect}$ = intersection number of overlapping values

Is this right ? and how the equation becomes ?

share|cite|improve this question
What is the "number of values" in a vector? And what is the "intersection number of overlapping values"? – Chris Eagle Mar 29 '12 at 18:12
It is not clear what you do. I would like it if you work out an example using your formula here. So, we'll all understand what num1, num2 and intersect mean. – user21436 Mar 29 '12 at 18:13
We can consider vector as a SET , so num1 = total numbers in the set1 , – tnaser Mar 29 '12 at 18:16
I not dealing with points , but numbers in a sets. I want to compare the sets to each others to find show similar they are – tnaser Mar 29 '12 at 18:21
@tnaser: You seem to be considering the size of the symmetric difference $A\Delta B$. You might want to look up Hamming distance, which is close in spirit, and has a taxicab distance character. And intersection is quite different from symmetric difference. – André Nicolas Mar 29 '12 at 18:36
up vote 1 down vote accepted

I think we've clarified that you are suggesting defining the distance between two finite sets $A$ and $B$ to be the number of elements of $A$, plus the number of elements of $B$, minus twice the number of elements in the symmetric difference of $A$ and $B$. But this would make lots of distances negative. E.g., if $A=\{{1,2,3\}}$ and $B=\{{4,5\}}$ then since $A$ and $B$ are disjoint their symmetric difference is their union and your formula gives $3+2-2\times5$ which is negative 5.

If I've misinterpreted what you propose to do, I suggest that instead of adding to the trail of comments you edit your question so it asks what you really want to ask.

share|cite|improve this answer
There was a mapping in the programming which made the confusion , question answered . thanks – tnaser Mar 30 '12 at 15:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.