# Finding the distance between groups of points?

Let's say we have two groups of points : $$a_1,a_2,a_3,\dots,a_n$$ and $$b_1,b_2,b_3,\dots,b_m$$, in $$2$$-dimensional or $$N$$-dimensional space.

I have the distance between every $$a$$ and $$b$$ point, but not between the points in the group internally, i.e.
$$D = |a_i,b_j|$$ is known,
$$D = |a_i,a_j|$$ and $$D = |b_i,b_j|$$, unknown

My question is, is the overall distance between the two groups (I imagine centers of the groups) just the average of all the distances, OR it is calculated some other way?

• You can define such a distance several ways, but the simplest is the distance between the means. Commented Dec 14, 2020 at 22:21
• "distance between the means" .. they are absolute distances, did u mean "mean of the distances"
– sten
Commented Dec 14, 2020 at 22:30
• Take the mean position of all the ${\bf a}$s... $\overline{\bf a}$. Now take the mean position of all the ${\bf b}$s... $\overline{\bf b}$. Now compute the distance between them: $D = | \overline{\bf a} - \overline{\bf b}|$. Commented Dec 14, 2020 at 22:38
• thats the problem, I dont have the mean position for all a's OR all b's, in fact i dont have any position at all ... i only have the distance between all a<-->b
– sten
Commented Dec 15, 2020 at 3:07
• The Hausdorf distance would be one metric. From every point in set A find the shortest distance to a member of set B, similarly from B to A. The Hausdorf distance is the longest of these shortest distances. Commented Dec 15, 2020 at 4:50

Let us simplify the problem to perhaps an unrealistic level: imagine the space is 1-dimensional. Then, all the points will be on the same line. Now imagine two points in group $$a$$ are at the same distance from the same point in group $$b$$ . It could be that those two points are exactly at the same location, or it could be that they are located on opposite sides of the group $$b$$ point at the same distance from it. In the former case, the center of the two points in group $$a$$ would be their shared location. In the latter case, their center would be on the group $$b$$ point. So you see, even in such a simple setting, it is not possible to determine where the center of a group of points is. Having multiple points does not invalidate this argument. And in multiple dimensions, the same problem persists. We lose information when we use absolute values for distance.