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

How to calculate the distance between two (possibly unbounded) ranges of positive real numbers? For example, if three guys specify their prices they would pay for a product:

A would pay between 2€ and 10€
B would pay less than 6€
C would pay more than 8€

How to say if A's offer is more similar to B's or C's? If all ranges are bounded, I could use the Hausdorff distance. But what if one or both of the sets are unbounded? Note that they can be unbounded only from one side (all numbers are positive).

EDIT: To explain why I need this... I'm working on a clustering algorithm to group similar objects that are represented by ranges of real numbers. Let's say that I have a group of people who are buying sugar. Each of them defines minimum and maximum amount he would be willing to buy. What I would like to do is to put in one cluster those people that want to buy similar amount. For example, one of the result clusters would be for people who need between 3 and 4 kg of sugar, while the other one might be between 6 and 8 kg. For this, I have to create a distance function which would tell how similar the requirements of the buyers are, i.e., what is the distance (or difference) between two ranges.

share|cite|improve this question
The "right" measure of the closeness of sets (if one exists) will depend on the context. Are you picking two numbers at random from the sets and asking "how far away can they be?" Are you trying to find common ground and asking "how much common ground is there?" Are you thinking there is no common ground and asking "How much do things have to change before compromise is possible?" Is the goal just to have a metric, so that you can use general theorems about metric spaces? – Aaron Jun 17 '11 at 9:18
Hey @Aaron I updated my original post. – Ivan Jun 20 '11 at 9:26
Since you are dealing entirely with intervals (even if they are allowed to be infinite), that simplifies matters considerably. For finite intervals, they are encoded by their average and their size, and attempting clustering on the average (putting all infinite things into their own bin) might be one way of going about things. Another possibility (which works for clustering, but doesn't give a metric) is to look for the values that are contained in the most intervals, make that value a cluster point, remove all intervals containing that point, and then act recursively on what is left. – Aaron Jun 20 '11 at 15:50
Another possibility, whose appropriateness depends greatly on what you consider to be important when calling two intervals "similar" is to pick some nice homeomorphism of $[-\infty,\infty]$ with $[-1,1]$, such as $x\mapsto x/(1+x^2)$, use this to map your intervals into finite intervals, and then use something like Hausdorff distance. Or you could find a large but finite number $M$ and you could replace a possibly infinite interval $I$ with $I\cap [-M,M]$, and then use Hausdorff distance. This is assuming that Hausdorff distance makes sense for you when your intervals are finite. – Aaron Jun 20 '11 at 16:01

Your Answer


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

Browse other questions tagged or ask your own question.