Distance of a test point from the center of an ellipsoid

I would like to introduce a geometric example to fix notation and then move to the Mahalonobis distance (quite informal) analysis.

  • Ellipsoid in $\mathbb R^{3}$: an easy example

Let us introduce the geometric definition of an ellipsoid centered at $y\in\mathbb R^{3}$, i.e. the locus of points $x\in\mathbb R^{3}$ satisfying

$$\langle(x-y),A^{-1}(x-y)\rangle=1.$$

Here $A$ is any positive definite matrix. For example, if $A=diag\{a^2,b^2,c^2\}$, $x=(x_1,x_2,x_3)$ and $y=(y_1,y_2,y_3)$, then the ellipsoid we are looking for is

$$\frac{(x_1-y_1)^2}{a^2}+ \frac{(x_2-y_2)^2}{b^2}+ \frac{(x_3-y_3)^2}{c^2}=1.$$

The parameter $a$ controls the distance between the center $y$ and the point $x$ along the 1st axis; similar considerations hold for $b$ and $c$. The ratios $\frac{a}{b}, \frac{b}{c}$ and $\frac{a}{c}$ determine the "shape" ("oblate", "prolate") of the given ellipsoid.

  • Ellipsoids and Mahalanobis distance in $\mathbb R^{n}$

The Mahalanobis distance

$$D(x,y)=\sqrt{\langle(x-y),C^{-1}(x-y)\rangle}$$

gives, by definition, the distance between the vectors $x$ and $y$ in $\mathbb R^{n}$ of realizations of a given multivariate random process $X=(X_1,\dots,X_n)$. $C$ is (an estimate of) the matrix of covariance. Looking at the formula for the geometric ellipsiod, you can identify the random vector $y$ in $D(x,y)$ with the center of the ellipsoid defined by $D(x,y)=d$, for some $d>0$. To be really precise, you should arrive at $D(x,y)=1$ by dividing the inverse $C^{-1}$ of the matrix of covariance by $d^2$.

  • On the second question

The sentence "The Mahalanobis distance is simply the distance of the test point from the center of mass divided by the width of the ellipsoid in the direction of the test point." can be understood with a simplified exposition.

Let us keep the above set up: $x$ is a random vector of realizations of the multivariate random process $X=(X_1,\dots,X_n)$. Let us introduce the vector $s=(s_1,\dots,s_n)$ of standardized variables

$$s_i:=\frac{x_i-\mu_i}{\sigma_i},$$

denoting by $\mu_i$ the mean of the realizations of the $i$-th random process $X_i$ and by $\sigma_i$ its variance. Let us consider the Mahalanobis distance of a vector $x$ from the center $\mu=(\mu_1,\dots,\mu_n)$, i.e.

$$D(x,\mu)=\sqrt{\langle (x-\mu),C^{-1}(x-\mu) \rangle }, $$

where the matrix of covariance is the diagonal matrix $C=\{\sigma^2_1,\dots,\sigma^2_n\}$. Then

$$D(x,\mu)=\sqrt{\langle s,s\rangle } ,$$

by construction. As in the geometric example above, the variance $\sigma_i$ in $C=\{\sigma^2_1,\dots,\sigma^2_n\}$ controls the "shape" (or width) of the ellipsoid defined by the Mahalanobis distance along the $i$th-axis.


In simple terms Mahalanobis distance is explained by me like this. It is for calculating the scope or evaluating an event occurring within a period. Consider that some 'm'events of Type I occurred in the month of January and 'n' events of Type 2 occurred in the month of March. Type 1 and type 2 could be anything like say, some Revolution or a strike by employees and the m and n events correspond to two groups of people. If a single event occurred in the month of February, we want to identify whether it belongs to groups responsible -say Type I or Type 2 -

Then draw an ellipse of m or n events data along the Dates of the month which happens to be the best fit of the data. Identify the date which happens to be the centroid of each ellipse drawn independently for Jan and March months. Then calculate the distance ie the date of occurrence of event to the centroid date of ellipses corresponding to m and n data sets. The date closer to the centroid could be considered as similar to Type 1 or Type 2. This is my explanation of Mahalanobis distance in time domain. Here the number of days is considered as Mahalanobis distance.... .......