# Mahalanobis Distance

## #Distance #Metric

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_{i,j} (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;

## Table of Contents

**References:**

**Current Ref:**

- cards/math/mahalanobis-distance.md