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

If you've got multiple arrays like this:



every array being 6 integers, each integer in range [0,60]

I would like to find the distance between those 2 arrays. The problem is related to computer science, however, I would like to interpret these arrays as "planes" so as to find the distance between the two.

What's the best way to find the distance between those 2 arrays? Can we interpret them as 6 points on a plane? Or maybe 3 coordinates?

share|cite|improve this question
There's no "the" distance between two arrays, and no canonical interpretation of an array of six integers as a "plane." Thus, your problem is poorly stated. It's totally natural to want to compute some function that you haven't quite defined; in this case, what you can do is state some (mathematical!) properties you want the function to satisfy. Otherwise, it's difficult to narrow down the vast number of possible answers to the few that are going to be useful to you. – Darsh Ranjan Nov 5 '10 at 20:17
Excuse me: a distance is what i meant – Sev Nov 5 '10 at 20:22
up vote 4 down vote accepted

You can interpret them any way you want, each array as three points in a plane (but using which order), two points in space, one point in six-dimensional space. There are various distances available. If you define the points as $a=(a_1,a_2,a_3,a_4,a_5,a_6)$ and similarly for $b$ you can use $\sum |a_i-b_i|$ or $\sum (a_i-b_i)^2$, for example. Note I didn't use the dimension at all.

share|cite|improve this answer
I'll give this one a shot, thank you. – Sev Nov 5 '10 at 19:58
Depending upon your application, if you use the sum of squares you might want to take the square root of that expression. That would make the units right and make the triangle inequality hold. Either of those may be important to you. – Ross Millikan Nov 5 '10 at 20:07
Thank you, I was thinking the same. – Sev Nov 5 '10 at 21:04
@Sev, Slightly rephrased, you have a lot of the Hölder norms to pick: Ross already gave two, and there's also $\max|a_i-b_i|$. You will have to experiment on which one is appropriate. – J. M. Nov 5 '10 at 22:47
@J.M - Thanks for your input, much appreciated! – Sev Nov 6 '10 at 21:51

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.