The Mahalanobis distance is defined as the distance between a (multidimensional) point and a distribution. It is the multivariate form of the distance measured in units of standard deviation and is named after the famous Indian statistician R.P. Mahalanobis (1893 – 1972).
Given a normal distribution with covariance matrix S and mean μ, the squared Mahalanobis distance of a point x to the mean of this distribution is given by d2(x)=(x-μ)′S-1(x-μ), where (x-μ)′ is the transpose of (x-μ).
The distance formula above says that we have to weigh dimensions according to their covariances. If the covariance matrix S happens to be diagonal the formula above reduces to d2(x)=Σi=1N (xi-μi)2/σi.
© djmw, January 20, 2016