I'm calculating the mahalanobis distance between two individuals/vectors of the same pool as it is described in mahalanobis distance between individuals by using https://stats.stackexchange.com/a/48576/163146 as code for R. Now I wonder the following: Is the resulting distance then really between the two individuals or is it in both cases relative to the center? In case of this assumption the distance between two individuals could also be calculated in the following way:

  1. Calculate distance of the one individual relative to the center
  2. Calculate distance of the other individual relative to the center
  3. Sum these distances (in which way ever.. I just recognize that's probably a hint that this can't be true :)

However, just ignoring my thoughts: What's the unit of the distance between two individuals then? Typically it is measured in standard deviations but standard deviations between two individuals? Does that make sense? Can you please shine a bit light on me?

  • 1
    $\begingroup$ I believe all your questions may be answered at stats.stackexchange.com/questions/62092/…. In particular, the explanation there should make it obvious that the Mahalanobis distance is unitless. $\endgroup$
    – whuber
    Nov 21, 2017 at 14:53
  • 1
    $\begingroup$ If you orthonormalize the variables (aka perform data whitening) by PCA or another linear approach, so that the data cloud is now round with radius (st. dev.) 1, then Euclidean distance between two points or between a point and the general centroid will be equal to the corresponding Mahalanobis distance. $\endgroup$
    – ttnphns
    Nov 22, 2017 at 8:56

1 Answer 1


The Mahalanobis distance between random vectors $x,y$ is given by $$ D_M(x,y)= \sqrt{(x-y)^T S^{-1}(x-y)} $$ (refer to Bottom to top explanation of the Mahalanobis distance? for more information). Here $S$ is the (sample) covariance matrix. For the scalar case this reduces to $$ D_M(x,y)= \sqrt{\frac{(x-y)^2}{S^2}} $$ and this makes it pretty obvious that the Mahalanobis distance is unitless. The units is canceling out.

  • $\begingroup$ Thanks! I've got another (probably plain) question: As far as I can see there is a calculation of vector * matrix and then matrix * vector. How is it possible to consider any correlations between two vectors when I just use the covariance matrix of the whole pool? Or is it the covariance matrix only of the two used vectors? I guess you already explained it because you said S is the (sample) covariance matrix but I would like to ensure that. S is only the covariance matrix between the two vectors and not the one of the whole pool? $\endgroup$
    – Ben
    Nov 23, 2017 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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