# How would you quantify the closeness between sets.

How would you represent the closeness (distance?) between sets?
For example: how close are the sets: {8,4,5} and {9,8,2}? Could it be a percentage?

If there is no way to do this, would you need two sets?
How close is {8,4,5} to {9,8,2} compared to the closeness of {2,8,5} to {9,8,2}?

PS this is for a computer science project, yet a mathematical question.

Edit: I plan to have something like this: {a:1,b:5,c:6} and compare it to {a:2,b:18,c:24}. In this example, one might say they are fairly close due to the 'a' value being similar, however, {a:5, b:16, c:20} could be considered closer overall.
This is being used in a genre recognition program. We want to compare the features of songs (represented as values) by figuring out the values for an "average" song of a certain genre, and later compare other songs to the averages and see which one is closest (and hopefully be able to give a percentage of similarity).

-
Given that it's a CS project, I just want to make sure we're talking about the same thing. When mathematicians use the word "set", there is no implied order at all, and things cannot repeat. If you want to take order into account and have repetitions, the word we typically use is "list". If order doesn't matter but repeats are allowed, this is yet another different thing. The name doesn't matter, but you don't want to get a well-meaning answer that's just not useful because of unclear foundations :) – Eric Stucky Jun 27 '13 at 1:31
Anyway, there are a lot of ways that two sets might be considered "close", can you talk a bit more (edit the question) about sets that you want to be close? Nothing rigorous, just something like "I think $\{3,4,2,5\}$ and $\{1,3,5,7\}$ are pretty close because they have the same sum and have the same number of digits. But maybe $\{3,4,5,6,7\}$ is not close to $\{102,-77\}$ because the second set is a lot smaller than the first." – Eric Stucky Jun 27 '13 at 1:33
You could also consider something like the Hausdorff Distance: en.wikipedia.org/wiki/Hausdorff_distance – Jeremy Jun 27 '13 at 1:56

You're actually asking a deep question because there are many ways to do this.

What you described in your edit is actually comparing two tuples, which is different than comparing two sets. (Remember sets are unordered).

The distance in the Euclidean plane (on a sheet of paper) between $(2,8,5)$ and $(9,8,2)$ is $$\sqrt{ (2-9)^2 \ + \ (8-8)^2 \ + \ (5-2)^2 }$$. But for example you could change all the $^2$'s to $^9$'s and the $\sqrt{}$ to a $\sqrt[9]{}$. What would that do?

The actual distance between music genres is an unsolved problem and the answer will depend on information from real life (i.e., outside of pure mathematics) as well as on asking mathematical questions (i.e., thinking more precisely than you currently are—which is not an insult, I would start out asking the question the same way).

(For example what does "average" mean? Here are some pictures to get you thinking about why it might not be as simple as $\mathtt{average}(3,5,7)=5$.

Have fun!

-
You can't measure the distance between sets as if it were the distance between lists. Any reasonable notion of distance between sets should be isomorphism invariant -- in particular the distance from {2,8,5} to {9,8,2} should be the same as the distance from {8,5,2} to {9,8,2}. There are more useful metrics for sets involving suprema. – Egbert Jan 17 '14 at 14:41
@Egbert Yes. See the second sentence in my answer, the Edit in the question, and the first comment at the top. – isomorphismes Jan 17 '14 at 14:55