Mahalanobis distance is a distance calculated using the inverse of the covariance matrix as the metric. For two vectors $\mathbf x$ and $\mathbf y$, the Mahalanobis distance is

$$d^2 = (x_i - \bar x) g_{ij} (y_j - \bar y),$$

where $g_{ij} = (S^{-1})_{ij}$ and $\mathbf S$ is the covariance matrix.

The covariance is a normalization that mitigates the covariances.

Published: by ;

Lei Ma (2020). 'Mahalanobis Distance', Datumorphism, 03 April. Available at: https://datumorphism.leima.is/cards/math/mahalanobis-distance/.